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: README.md
+14-5Lines changed: 14 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,10 +15,10 @@ Auto-fixer for Python code that adds `typing.Final` annotation to variable assig
15
15
Basically, this, but handles different operations (like usage of `nonlocal`, augmented assignments: `+=`, etc) as well.
16
16
17
17
- Keeps mypy happy.
18
-
- Ignores global variables to avoid confusion with the type aliases like `Fruit = Apple | Banana`.
19
-
- Ignores class variables: it is common to use `typing.ClassVar` instead of `typing.Final`.
20
18
- Adds global import if it's not imported yet (`import typing`/`from typing import Final`).
21
19
- Inspects one file at a time.
20
+
- Is careful with global variables: adds Final only for uppercase variables, ignores variable that are referenced in `global` statement inside functions in current file, and avoids removing Final when it already was set.
21
+
- Ignores class variables: it is common to use `typing.ClassVar` instead of `typing.Final`.
22
22
23
23
## How To Use
24
24
@@ -34,7 +34,6 @@ or:
34
34
pipx run auto-typing-final .
35
35
```
36
36
37
-
38
37
### Options
39
38
40
39
You can specify `--check` flag to check the files instead of actually fixing them:
0 commit comments