-
-
Notifications
You must be signed in to change notification settings - Fork 453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to mypy 0.991 for compatible-mypy & CI #1260
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,13 +7,14 @@ ignore_missing_imports = True | |
incremental = True | ||
strict_optional = True | ||
show_traceback = True | ||
warn_no_return = False | ||
warn_unused_ignores = True | ||
warn_redundant_casts = True | ||
warn_unused_configs = True | ||
warn_unreachable = True | ||
disallow_untyped_defs = true | ||
disallow_incomplete_defs = true | ||
show_error_codes = False | ||
disable_error_code = empty-body | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replaced |
||
|
||
plugins = | ||
mypy_django_plugin.main | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -249,6 +249,8 @@ def get_customize_class_mro_hook(self, fullname: str) -> Optional[Callable[[Clas | |
and sym.node.has_base(fullnames.BASE_MANAGER_CLASS_FULLNAME) | ||
): | ||
return reparametrize_any_manager_hook | ||
else: | ||
return None | ||
|
||
def get_base_class_hook(self, fullname: str) -> Optional[Callable[[ClassDefContext], None]]: | ||
# Base class is a Model class definition | ||
|
@@ -309,6 +311,8 @@ def get_type_analyze_hook(self, fullname: str) -> Optional[Callable[[AnalyzeType | |
"django_stubs_ext.annotations.WithAnnotations", | ||
): | ||
return partial(handle_annotated_type, django_context=self.django_context) | ||
else: | ||
return None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was added because I removed |
||
|
||
def get_dynamic_class_hook(self, fullname: str) -> Optional[Callable[[DynamicClassDefContext], None]]: | ||
# Create a new manager class definition when a manager's '.from_queryset' classmethod is called | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ psycopg2-binary | |
-e .[compatible-mypy] | ||
|
||
# Overrides: | ||
mypy==0.982 | ||
mypy==0.991 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
show_error_codes
default changed in mypy 0.990.I'm reverting to the old behavior, because so many
.yml
test files have mypy error messages without the error code.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we try to work towards
show_error_codes = True
? It feels reasonable that tests are granular enough to fail if a specific error code changes.It could be an option to try to resolve this over time. Best thing would probably be to have a linter that disallows
type: ignore
i.e. without code in the test suite. I suppose that could be tracked in an issue.