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
[](https://github.dev/sco1/flake8-annotations)
7
7
8
-
`flake8-annotations` is a plugin for [Flake8](http://flake8.pycqa.org/en/latest/) that detects the absence of [PEP 3107-style](https://www.python.org/dev/peps/pep-3107/) function annotations and [PEP 484-style](https://www.python.org/dev/peps/pep-0484/#type-comments) type comments (see: [Caveats](#Caveats-for-PEP-484-style-Type-Comments)).
8
+
`flake8-annotations` is a plugin for [Flake8](http://flake8.pycqa.org/en/latest/) that detects the absence of [PEP 3107-style](https://www.python.org/dev/peps/pep-3107/) function annotations.
9
9
10
-
What this won't do: Check variable annotations (see: [PEP 526](https://www.python.org/dev/peps/pep-0526/)), respect stub files, or replace [mypy](http://mypy-lang.org/).
10
+
What this won't do: replace [mypy](http://mypy-lang.org/), check type comments (see: [PEP 484](https://peps.python.org/pep-0484/#type-comments)), check variable annotations (see: [PEP 526](https://www.python.org/dev/peps/pep-0526/)), or respect stub files.
11
11
12
12
## Installation
13
13
Install from PyPi with your favorite `pip` invocation:
@@ -32,7 +32,7 @@ cog.out(
32
32
]]] -->
33
33
```bash
34
34
$ flake8 --version
35
-
5.0.4 (flake8-annotations: 2.9.1, mccabe: 0.7.0, pycodestyle: 2.9.1, pyflakes:2.5.0) CPython 3.10.6 on Darwin
35
+
6.0.0 (flake8-annotations: 3.0.0, mccabe: 0.7.0, pycodestyle: 2.10.0, pyflakes: 3.0.1) CPython 3.11.0 on Darwin
36
36
```
37
37
<!-- [[[end]]] -->
38
38
@@ -62,17 +62,12 @@ With the exception of `ANN4xx`-level warnings, all warnings are enabled by defau
62
62
|`ANN205`| Missing return type annotation for staticmethod |
63
63
|`ANN206`| Missing return type annotation for classmethod |
64
64
65
-
### Type Comments
66
-
**Deprecation notice**: Support for type comments will be removed in `3.0`. See [this issue](https://github.com/sco1/flake8-annotations/issues/95) for more information.
|`ANN401`| Dynamically typed expressions (typing.Any) are disallowed.<sup>2</sup> |
70
+
|`ANN402`| Type comments are disallowed. |
76
71
77
72
Use [`extend-select`](https://flake8.pycqa.org/en/latest/user/options.html#cmdoption-flake8-extend-ignore) to enable opinionated warnings without overriding other implicit configurations<sup>3</sup>.
78
73
@@ -195,54 +190,6 @@ Will not raise linting errors for missing annotations for the arguments & return
195
190
196
191
Decorator(s) to treat as `typing.overload` may be specified by the [`--overload-decorators`](#--overload-decorators-liststr) configuration option.
197
192
198
-
## Caveats for PEP 484-style Type Comments
199
-
**Deprecation notice**: Support for type comments will be removed in `3.0`. See [this issue](https://github.com/sco1/flake8-annotations/issues/95) for more information.
200
-
### Mixing argument-level and function-level type comments
201
-
Support is provided for mixing argument-level and function-level type comments.
202
-
203
-
```py
204
-
deffoo(
205
-
arg1, # type:bool
206
-
arg2, # type:bool
207
-
): # type:(...)->bool
208
-
pass
209
-
```
210
-
211
-
**Note:** If present, function-level type comments will override any argument-level type comments.
212
-
213
-
### Partial type comments
214
-
Partially type hinted functions are supported for non-static class methods.
215
-
216
-
For example:
217
-
218
-
```py
219
-
classFoo:
220
-
def__init__(self):
221
-
# type:()->None
222
-
...
223
-
224
-
defbar(self, a):
225
-
# type:(int)->int
226
-
...
227
-
```
228
-
Will consider `bar`'s `self` argument as unannotated and use the `int` type hint for `a`.
229
-
230
-
Partial type comments utilizing ellipses as placeholders is also supported:
231
-
232
-
```py
233
-
deffoo(arg1, arg2):
234
-
# type:(bool)->bool
235
-
pass
236
-
```
237
-
Will show `arg2` as missing a type hint.
238
-
239
-
```py
240
-
deffoo(arg1, arg2):
241
-
# type:(...,bool)->bool
242
-
pass
243
-
```
244
-
Will show `arg1` as missing a type hint.
245
-
246
193
## Dynamic Typing Caveats
247
194
Support is only provided for the following patterns:
0 commit comments