-
Notifications
You must be signed in to change notification settings - Fork 21.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable UFMT format on test/typing files (#126038)
Fixes some files in #123062 Run lintrunner on files: test/typing/**/* ``` $ lintrunner -a --take UFMT --all-files ok No lint issues. Successfully applied all patches. ``` Pull Request resolved: #126038 Approved by: https://github.com/shink, https://github.com/ezyang
- Loading branch information
1 parent
1cc9354
commit 7ee74d9
Showing
10 changed files
with
111 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
# flake8: noqa | ||
import torch | ||
|
||
torch.tensor([3], dtype='int32') # E: Argument "dtype" to "tensor" has incompatible type "str"; expected "dtype | None" [arg-type] | ||
torch.ones(3, dtype='int32') # E: No overload variant of "ones" matches argument types "int", "str" | ||
torch.zeros(3, dtype='int32') # E: No overload variant of "zeros" matches argument types "int", "str" | ||
torch.tensor( | ||
[3], | ||
dtype="int32", # E: Argument "dtype" to "tensor" has incompatible type "str"; expected "dtype | None" [arg-type] | ||
) | ||
torch.ones( # E: No overload variant of "ones" matches argument types "int", "str" | ||
3, dtype="int32" | ||
) | ||
torch.zeros( # E: No overload variant of "zeros" matches argument types "int", "str" | ||
3, dtype="int32" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
# flake8: noqa | ||
import torch | ||
|
||
torch.set_rng_state([1, 2, 3]) # E: Argument 1 to "set_rng_state" has incompatible type "list[int]"; expected "Tensor" [arg-type] | ||
torch.set_rng_state( | ||
[ # E: Argument 1 to "set_rng_state" has incompatible type "list[int]"; expected "Tensor" [arg-type] | ||
1, | ||
2, | ||
3, | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import torch | ||
|
||
|
||
# ModuleList with elements of type Module | ||
class FooModule(torch.nn.Module): | ||
pass | ||
|
||
|
||
class BarModule(torch.nn.Module): | ||
pass | ||
|
||
|
||
ml: torch.nn.ModuleList = torch.nn.ModuleList([FooModule(), BarModule()]) | ||
ml[0].children() == [] # noqa: B015 | ||
reveal_type(ml) # E: {ModuleList} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.