-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Make several fields read-only for type
, staticmethod
and classmethod
#7423
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
Conversation
This comment has been minimized.
This comment has been minimized.
2 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com>
Diff from mypy_primer, showing the effect of this PR on open source code: pandera (https://github.com/pandera-dev/pandera)
+ pandera/checks.py:74: error: Argument 1 to "ChainMap" has incompatible type "MappingProxyType[str, Any]"; expected "MutableMapping[str, Callable[..., Any]]" [arg-type]
+ pandera/model.py:362: error: Need type annotation for "attrs" (hint: "attrs: Dict[<type>, <type>] = ...") [var-annotated]
pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/class_validators.py:332: error: Need type annotation for "all_attributes" [var-annotated]
+ pydantic/class_validators.py:332: error: Argument 1 to "ChainMap" has incompatible type "*List[MappingProxyType[str, Any]]"; expected "MutableMapping[<nothing>, <nothing>]" [arg-type]
|
Unfortunate. I think this has more to do with the stub for @property
def __dict__(self) -> dict[str, Any] for What do you think, @BvB93? |
In my opinion this is more of a problem with While the discussion on whether |
I suppose this was discussed in depth in:
and the decision then was that this kind of mypy_primer hit was acceptable. |
All of these are read-only at runtime.