Add TypeGuards to builtins Methods#15467
Closed
George-Ogden wants to merge 4 commits intopython:mainfrom
Closed
Conversation
This comment has been minimized.
This comment has been minimized.
This reverts commit 68c0e1d.
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: schema_salad (https://github.com/common-workflow-language/schema_salad)
+ schema_salad/jsonld_context.py: note: In function "pred":
+ schema_salad/jsonld_context.py:53:31: error: Subclass of "str" and "MutableMapping[Any, Any]" cannot exist: would have incompatible method signatures [unreachable]
+ schema_salad/jsonld_context.py:54:21: error: Statement is unreachable [unreachable]
+ schema_salad/schema.py: note: In function "get_anon_name":
+ schema_salad/schema.py:433:27: error: Subclass of "str" and "Mapping[Any, Any]" cannot exist: would have incompatible method signatures [unreachable]
+ schema_salad/schema.py:434:17: error: Statement is unreachable [unreachable]
xarray (https://github.com/pydata/xarray)
+ .../projects/_xarray_venv/lib/python3.13/site-packages/pandas-stubs/io/formats/style.pyi:17: note: ... from here,
+ .../projects/_xarray_venv/lib/python3.13/site-packages/pandas-stubs/core/frame.pyi:176: note: ... from here,
+ .../projects/_xarray_venv/lib/python3.13/site-packages/pandas-stubs/_typing.pyi:36: note: ... from here,
+ xarray/core/extension_array.py:27: note: ... from here:
sympy (https://github.com/sympy/sympy)
+ sympy/diffgeom/diffgeom.py:2261: error: Definition of "__contains__" in base class "_deprecated_container" is incompatible with definition in base class "list" [misc]
urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/_collections.py:196: error: Signature of "__contains__" incompatible with supertype "builtins.set" [override]
+ src/urllib3/_collections.py:196: note: Superclass:
+ src/urllib3/_collections.py:196: note: def __contains__(self, object, /) -> TypeGuard[tuple[str, str]]
+ src/urllib3/_collections.py:196: note: Subclass:
+ src/urllib3/_collections.py:196: note: def __contains__(self, object, /) -> bool
mkdocs (https://github.com/mkdocs/mkdocs)
+ mkdocs/utils/templates.py:47: error: Subclass of "ExtraScriptValue" and "str" cannot exist: would have incompatible method signatures [unreachable]
django-stubs (https://github.com/typeddjango/django-stubs)
+ django-stubs/test/utils.pyi:36: error: Signature of "__contains__" incompatible with supertype "builtins.list" [override]
+ django-stubs/test/utils.pyi:36: note: Superclass:
+ django-stubs/test/utils.pyi:36: note: def __contains__(self, object, /) -> TypeGuard[dict[str, Any]]
+ django-stubs/test/utils.pyi:36: note: Subclass:
+ django-stubs/test/utils.pyi:36: note: def __contains__(self, object, /) -> bool
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Start with equality of common classes to see changes in mypy_primer