-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flake8-pyi]: PYI011, PYI014 (#3238)
Implement PYI011 and PYI014 with the latest changes: PyCQA/flake8-pyi#326 PyCQA/flake8-pyi#316 rel: #848 rel: https://github.com/PyCQA/flake8-pyi/blob/4212bec43dbc4020a59b90e2957c9488575e57ba/pyi.py#L718
- Loading branch information
Showing
15 changed files
with
759 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
def f12( | ||
x, | ||
y: str = os.pathsep, # OK | ||
) -> None: | ||
... | ||
|
||
|
||
def f11(*, x: str = "x") -> None: # OK | ||
... | ||
|
||
|
||
def f13( | ||
x: list[str] = [ | ||
"foo", | ||
"bar", | ||
"baz", | ||
] # OK | ||
) -> None: | ||
... | ||
|
||
|
||
def f14( | ||
x: tuple[str, ...] = ( | ||
"foo", | ||
"bar", | ||
"baz", | ||
) # OK | ||
) -> None: | ||
... | ||
|
||
|
||
def f15( | ||
x: set[str] = { | ||
"foo", | ||
"bar", | ||
"baz", | ||
} # OK | ||
) -> None: | ||
... | ||
|
||
|
||
def f16(x: frozenset[bytes] = frozenset({b"foo", b"bar", b"baz"})) -> None: # OK | ||
... | ||
|
||
|
||
def f17( | ||
x: str = "foo" + "bar", # OK | ||
) -> None: | ||
... | ||
|
||
|
||
def f18( | ||
x: str = b"foo" + b"bar", # OK | ||
) -> None: | ||
... | ||
|
||
|
||
def f19( | ||
x: object = "foo" + 4, # OK | ||
) -> None: | ||
... | ||
|
||
|
||
def f20( | ||
x: int = 5 + 5, # OK | ||
) -> None: | ||
... | ||
|
||
|
||
def f21( | ||
x: complex = 3j - 3j, # OK | ||
) -> None: | ||
... | ||
|
||
|
||
def f22( | ||
x: complex = -42.5j + 4.3j, # OK | ||
) -> None: | ||
... |
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
def f12( | ||
x, | ||
y: str = os.pathsep, # Error PYI011 Only simple default values allowed for typed arguments | ||
) -> None: ... | ||
def f11(*, x: str = "x") -> None: ... # OK | ||
def f13( | ||
x: list[ | ||
str | ||
] = [ # Error PYI011 Only simple default values allowed for typed arguments | ||
"foo", | ||
"bar", | ||
"baz", | ||
] | ||
) -> None: ... | ||
def f14( | ||
x: tuple[ | ||
str, ... | ||
] = ( # Error PYI011 Only simple default values allowed for typed arguments | ||
"foo", | ||
"bar", | ||
"baz", | ||
) | ||
) -> None: ... | ||
def f15( | ||
x: set[ | ||
str | ||
] = { # Error PYI011 Only simple default values allowed for typed arguments | ||
"foo", | ||
"bar", | ||
"baz", | ||
} | ||
) -> None: ... | ||
def f16( | ||
x: frozenset[ | ||
bytes | ||
] = frozenset( # Error PYI011 Only simple default values allowed for typed arguments | ||
{b"foo", b"bar", b"baz"} | ||
) | ||
) -> None: ... | ||
def f17( | ||
x: str = "foo" # Error PYI011 Only simple default values allowed for typed arguments | ||
+ "bar", | ||
) -> None: ... | ||
def f18( | ||
x: str = b"foo" # Error PYI011 Only simple default values allowed for typed arguments | ||
+ b"bar", | ||
) -> None: ... | ||
def f19( | ||
x: object = "foo" # Error PYI011 Only simple default values allowed for typed arguments | ||
+ 4, | ||
) -> None: ... | ||
def f20( | ||
x: int = 5 | ||
+ 5, # Error PYI011 Only simple default values allowed for typed arguments | ||
) -> None: ... | ||
def f21( | ||
x: complex = 3j | ||
- 3j, # Error PYI011 Only simple default values allowed for typed arguments | ||
) -> None: ... | ||
def f22( | ||
x: complex = -42.5j # Error PYI011 Only simple default values allowed for typed arguments | ||
+ 4.3j, | ||
) -> None: ... |
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 |
---|---|---|
@@ -0,0 +1,79 @@ | ||
def f12( | ||
x, | ||
y=os.pathsep, # OK | ||
) -> None: | ||
... | ||
|
||
|
||
def f11(*, x="x") -> None: | ||
... # OK | ||
|
||
|
||
def f13( | ||
x=[ # OK | ||
"foo", | ||
"bar", | ||
"baz", | ||
] | ||
) -> None: | ||
... | ||
|
||
|
||
def f14( | ||
x=( # OK | ||
"foo", | ||
"bar", | ||
"baz", | ||
) | ||
) -> None: | ||
... | ||
|
||
|
||
def f15( | ||
x={ # OK | ||
"foo", | ||
"bar", | ||
"baz", | ||
} | ||
) -> None: | ||
... | ||
|
||
|
||
def f16(x=frozenset({b"foo", b"bar", b"baz"})) -> None: | ||
... # OK | ||
|
||
|
||
def f17( | ||
x="foo" + "bar", # OK | ||
) -> None: | ||
... | ||
|
||
|
||
def f18( | ||
x=b"foo" + b"bar", # OK | ||
) -> None: | ||
... | ||
|
||
|
||
def f19( | ||
x="foo" + 4, # OK | ||
) -> None: | ||
... | ||
|
||
|
||
def f20( | ||
x=5 + 5, # OK | ||
) -> None: | ||
... | ||
|
||
|
||
def f21( | ||
x=3j - 3j, # OK | ||
) -> None: | ||
... | ||
|
||
|
||
def f22( | ||
x=-42.5j + 4.3j, # OK | ||
) -> None: | ||
... |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
def f12( | ||
x, | ||
y=os.pathsep, # Error PYI014 | ||
) -> None: ... | ||
def f11(*, x="x") -> None: ... # OK | ||
def f13( | ||
x=[ # Error PYI014 | ||
"foo", | ||
"bar", | ||
"baz", | ||
] | ||
) -> None: ... | ||
def f14( | ||
x=( # Error PYI014 | ||
"foo", | ||
"bar", | ||
"baz", | ||
) | ||
) -> None: ... | ||
def f15( | ||
x={ # Error PYI014 | ||
"foo", | ||
"bar", | ||
"baz", | ||
} | ||
) -> None: ... | ||
def f16(x=frozenset({b"foo", b"bar", b"baz"})) -> None: ... # Error PYI014 | ||
def f17( | ||
x="foo" + "bar", # Error PYI014 | ||
) -> None: ... | ||
def f18( | ||
x=b"foo" + b"bar", # Error PYI014 | ||
) -> None: ... | ||
def f19( | ||
x="foo" + 4, # Error PYI014 | ||
) -> None: ... | ||
def f20( | ||
x=5 + 5, # Error PYI014 | ||
) -> None: ... | ||
def f21( | ||
x=3j - 3j, # Error PYI014 | ||
) -> None: ... | ||
def f22( | ||
x=-42.5j + 4.3j, # Error PYI014 | ||
) -> None: ... |
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
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.