Skip to content

mypy annotations quick wins (resolve many str-format, has-type, valid-type, var-annotated, valid-type, type-var)#2336

Open
Avasam wants to merge 9 commits intomhammond:mainfrom
Avasam:mypy-easy-fixes
Open

mypy annotations quick wins (resolve many str-format, has-type, valid-type, var-annotated, valid-type, type-var)#2336
Avasam wants to merge 9 commits intomhammond:mainfrom
Avasam:mypy-easy-fixes

Conversation

@Avasam
Copy link
Copy Markdown
Collaborator

@Avasam Avasam commented Jul 27, 2024

I simply turned on check_untyped_defs = true and resolved as many str-format, has-type, valid-type, var-annotated, valid-type and type-var as I could.

Some are left to other PRs:

Overlaps with #2321, #2333, and #2397, merging those first would reduce changes here

@Avasam Avasam requested a review from mhammond October 18, 2024 18:52
Comment on lines +442 to 443
if hasattr(mod, "__file__") and mod.__file__:
fname = mod.__file__
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively

Suggested change
if hasattr(mod, "__file__") and mod.__file__:
fname = mod.__file__
if fname := getattr(mod, "__file__", None):

@Avasam Avasam changed the title mypy: resolve many str-format, has-type, valid-type, var-annotated, valid-type, type-var mypy annotations quick wins (resolve many str-format, has-type, valid-type, var-annotated, valid-type, type-var) May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant