Skip to content
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

Improve types for CheckMessage subclasses #1107

Merged
merged 1 commit into from
Aug 26, 2022

Conversation

adamchainz
Copy link
Contributor

I have made things!

These classes pass all but the first argument through to CheckMessage: https:/django/django/blob/e30d6678421b7573a1995f61521f14348c9b2a17/django/core/checks/messages.py#L59-L81

For type checking purposes it's best to redeclare all the arguments so they are type checked.

Related issues

n/a

@sobolevn
Copy link
Member

Hi! Thanks a lot for your PRs.
I've seen them, but we need to solve python/mypy#13422 first 😞

@adamchainz
Copy link
Contributor Author

Aye... I had a crack at running the tests locally to try fix that but it felt rather unclear to me :( Might need a git bisect on mypy?

@sobolevn
Copy link
Member

I am pretty sure it is python/mypy#11143

@@ -19,16 +19,16 @@ class CheckMessage:
def is_silenced(self) -> bool: ...

class Debug(CheckMessage):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def __init__(self, msg: str, hint: Optional[str] = ..., obj: Any = ..., id: Optional[str] = ...) -> None: ...
Copy link
Member

Choose a reason for hiding this comment

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

@sobolevn sobolevn merged commit 9ba4a55 into typeddjango:master Aug 26, 2022
@adamchainz adamchainz deleted the check_subclasses branch August 26, 2022 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants