Make several fields read-only for type, staticmethod and classmethod#7423
Make several fields read-only for type, staticmethod and classmethod#7423JelleZijlstra merged 4 commits intopython:masterfrom
type, staticmethod and classmethod#7423Conversation
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 <[email protected]>
|
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.