You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: ERRORCODES.md
+1
Original file line number
Diff line number
Diff line change
@@ -79,6 +79,7 @@ The following warnings are currently emitted by default:
79
79
| Y063 | Use [PEP 570 syntax](https://peps.python.org/pep-0570/) (e.g. `def foo(x: int, /) -> None: ...`) to denote positional-only arguments, rather than [the older Python 3.7-compatible syntax described in PEP 484](https://peps.python.org/pep-0484/#positional-only-arguments) (`def foo(__x: int) -> None: ...`, etc.). | Style
80
80
| Y064 | Use simpler syntax to define final literal types. For example, use `x: Final = 42` instead of `x: Final[Literal[42]]`. | Style
81
81
| Y065 | Don't use bare `Incomplete` in argument and return annotations. Instead, leave them unannotated. Omitting an annotation entirely from a function will cause some type checkers to view the parameter or return type as "untyped"; this may result in stricter type-checking on code that makes use of the stubbed function. | Style
82
+
| Y066 | When using if/else with `sys.version_info`, put the code for new Python versions first. | Style
Copy file name to clipboardexpand all lines: tests/sysversioninfo.pyi
+26
Original file line number
Diff line number
Diff line change
@@ -29,3 +29,29 @@ if sys.version_info <= (3, 0): ... # Y006 Use only < and >= for version compari
29
29
ifsys.version_info< (3, 5): ...
30
30
ifsys.version_info>= (3, 5): ...
31
31
if (2, 7) <=sys.version_info< (3, 5): ... # Y002 If test must be a simple comparison against sys.platform or sys.version_info
32
+
33
+
ifsys.version_info>= (3, 10):
34
+
deffoo1(x, *, bar=True, baz=False): ...
35
+
elifsys.version_info>= (3, 9):
36
+
deffoo1(x, *, bar=True): ...
37
+
else:
38
+
deffoo1(x): ...
39
+
40
+
ifsys.version_info< (3, 9):
41
+
deffoo2(x): ...
42
+
elifsys.version_info< (3, 10):
43
+
deffoo2(x, *, bar=True): ...
44
+
45
+
ifsys.version_info< (3, 10): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if sys.version_info >= (3, 10)"
46
+
deffoo3(x): ...
47
+
else:
48
+
deffoo3(x, *, bar=True): ...
49
+
50
+
ifsys.version_info< (3, 8): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if sys.version_info >= (3, 8)"
51
+
deffoo4(x): ...
52
+
elifsys.version_info< (3, 9): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if sys.version_info >= (3, 9)"
53
+
deffoo4(x, *, bar=True): ...
54
+
elifsys.version_info< (3, 10): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if sys.version_info >= (3, 10)"
0 commit comments