-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
added hashability requirement to set/frozenset typevar #11854
Closed
Closed
Conversation
This file contains 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
This comment has been minimized.
This comment has been minimized.
Blocker: |
Diff from mypy_primer, showing the effect of this PR on open source code: pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/v1/typing.py:558: error: Value of type variable "_H" of "set" cannot be "type[Any] | str | ForwardRef" [type-var]
+ pydantic/v1/utils.py:86: error: Type argument "type[Any]" of "set" must be a subtype of "Hashable" [type-var]
+ pydantic/v1/utils.py:109: error: Type argument "type[Any]" of "set" must be a subtype of "Hashable" [type-var]
+ pydantic/_internal/_utils.py:28: error: Type argument "type[Any]" of "set" must be a subtype of "Hashable" [type-var]
+ pydantic/_internal/_utils.py:51: error: Type argument "type[Any]" of "set" must be a subtype of "Hashable" [type-var]
manticore (https://github.com/trailofbits/manticore)
+ tests/other/test_smtlibv2.py:243: error: Type argument "type[Any]" of "set" must be a subtype of "Hashable" [type-var]
+ tests/other/test_smtlibv2.py:244: error: Value of type variable "_H2" of "union" of "set" cannot be "Any | type[Any]" [type-var]
+ tests/other/test_smtlibv2.py:245: error: Value of type variable "_H2" of "union" of "set" cannot be "type[Any]" [type-var]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/computation/expr.py:182: error: Value of type variable "_H_co" of "frozenset" cannot be "type[AST]" [type-var]
+ pandas/core/arraylike.py:308: error: Value of type variable "_H" of "set" cannot be "type[Any]" [type-var]
pandera (https://github.com/pandera-dev/pandera)
+ pandera/typing/__init__.py:53: error: Type argument "type[Any]" of "set" must be a subtype of "Hashable" [type-var]
+ pandera/typing/__init__.py:54: error: Type argument "type[Any]" of "set" must be a subtype of "Hashable" [type-var]
+ pandera/typing/__init__.py:55: error: Type argument "type[Any]" of "set" must be a subtype of "Hashable" [type-var]
sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/addnodes.py:300:15: error: Type argument "type[desc_sig_element]" of "set" must be a subtype of "Hashable" [type-var]
+ sphinx/util/docutils.py:42:19: error: Type argument "type[Element]" of "set" must be a subtype of "Hashable" [type-var]
hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
+ src/hydra_zen/typing/_implementations.py:229: error: Type argument "SupportedPrimitive" of "frozenset" must be a subtype of "Hashable" [type-var]
+ src/hydra_zen/typing/_builds_overloads.py:53: error: Type argument "SupportedPrimitive" of "frozenset" must be a subtype of "Hashable" [type-var]
+ src/hydra_zen/structured_configs/_implementations.py:218: error: Type argument "SupportedPrimitive" of "frozenset" must be a subtype of "Hashable" [type-var]
+ src/hydra_zen/structured_configs/_implementations.py:3151: error: Value of type variable "_H" of "set" cannot be "str | type[NOTHING]" [type-var]
+ src/hydra_zen/structured_configs/_make_config.py:37: error: Type argument "SupportedPrimitive" of "frozenset" must be a subtype of "Hashable" [type-var]
+ tests/annotations/mypy_checks.py:34: error: Type argument "SupportedPrimitive" of "frozenset" must be a subtype of "Hashable" [type-var]
trio (https://github.com/python-trio/trio)
+ src/trio/_core/_run.py:356: error: Type argument "Task" of "set" must be a subtype of "Hashable" [type-var]
+ src/trio/_core/_run.py:389: error: Type argument "Task" of "frozenset" must be a subtype of "Hashable" [type-var]
+ src/trio/_core/_run.py:390: error: Value of type variable "_H_co" of "frozenset" cannot be "Task" [type-var]
+ src/trio/_core/_run.py:902: error: Value of type variable "_H" of "set" cannot be "Task" [type-var]
+ src/trio/_core/_run.py:1062: error: Type argument "Task" of "set" must be a subtype of "Hashable" [type-var]
+ src/trio/_core/_run.py:1073: error: Type argument "Task" of "frozenset" must be a subtype of "Hashable" [type-var]
+ src/trio/_core/_run.py:1076: error: Value of type variable "_H_co" of "frozenset" cannot be "Task" [type-var]
+ src/trio/_core/_run.py:1596: error: Type argument "Task" of "set" must be a subtype of "Hashable" [type-var]
+ src/trio/_core/_run.py:1596: error: Argument 1 to "Factory" has incompatible type "Type[Set[Any]]"; expected "Callable[[], Set[Task]]" [arg-type]
+ src/trio/_sync.py:63: error: Type argument "Task" of "set" must be a subtype of "Hashable" [type-var]
+ src/trio/_sync.py:218: error: Type argument "Union[Task, object]" of "set" must be a subtype of "Hashable" [type-var]
+ src/trio/_channel.py:153: error: Type argument "Task" of "set" must be a subtype of "Hashable" [type-var]
+ src/trio/_channel.py:153: error: Argument 1 to "Factory" has incompatible type "Type[Set[Any]]"; expected "Callable[[], Set[Task]]" [arg-type]
+ src/trio/_channel.py:293: error: Type argument "Task" of "set" must be a subtype of "Hashable" [type-var]
+ src/trio/_channel.py:293: error: Argument 1 to "Factory" has incompatible type "Type[Set[Any]]"; expected "Callable[[], Set[Task]]" [arg-type]
+ src/trio/_core/_tests/test_run.py:1558: error: Value of type variable "_H_co" of "frozenset" cannot be "Task" [type-var]
+ src/trio/_core/_tests/test_run.py:1560: error: Value of type variable "_H_co" of "frozenset" cannot be "Task" [type-var]
CPython (Argument Clinic) (https://github.com/python/cpython)
+ Tools/clinic/libclinic/converters.py:17: error: Type argument "type[object]" of "set" must be a subtype of "Hashable" [type-var]
+ Tools/clinic/libclinic/converters.py:17: error: Value of type variable "_H" of "set" cannot be "type[object]" [type-var]
+ Tools/clinic/libclinic/converters.py:26: error: Type argument "type[object]" of "set" must be a subtype of "Hashable" [type-var]
+ Tools/clinic/libclinic/converters.py:732: error: Type argument "type[object]" of "frozenset" must be a subtype of "Hashable" [type-var]
+ Tools/clinic/libclinic/converters.py:736: error: Type argument "type[object]" of "frozenset" must be a subtype of "Hashable" [type-var]
+ Tools/clinic/libclinic/converters.py:737: error: Value of type variable "_H_co" of "frozenset" cannot be "type[object]" [type-var]
psycopg (https://github.com/psycopg/psycopg)
+ tests/test_adapt.py:418: error: "Hashable" has no attribute "__name__" [attr-defined]
+ tests/test_adapt.py:419: error: "Hashable" has no attribute "__name__" [attr-defined]
spark (https://github.com/apache/spark)
+ python/pyspark/core/rdd.py:2325: error: Value of type variable "_H" of "set" cannot be "S" [type-var]
+ python/pyspark/pandas/frame.py:11631: error: Value of type variable "_H" of "set" cannot be "type[Any]" [type-var]
+ python/pyspark/pandas/indexes/base.py:590: error: Value of type variable "_H" of "set" cannot be "type[Any]" [type-var]
graphql-core (https://github.com/graphql-python/graphql-core)
+ src/graphql/execution/incremental_publisher.py:332: error: Type argument "AsyncIterator[Any]" of "set" must be a subtype of "Hashable" [type-var]
+ src/graphql/execution/execute.py:390: error: Type argument "AsyncIterator[Any]" of "set" must be a subtype of "Hashable" [type-var]
jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1202: error: Value of type variable "_H_co" of "frozenset" cannot be "Union[str, Type[Extension]]" [type-var]
flake8-pyi (https://github.com/PyCQA/flake8-pyi)
+ pyi.py:1420: error: Type argument "type[object]" of "set" must be a subtype of "Hashable" [type-var]
jax (https://github.com/google/jax)
+ jax/_src/effects.py:92: error: Type argument "type[Effect]" of "set" must be a subtype of "Hashable" [type-var]
+ jax/_src/api_util.py:718: error: Type argument "type[Any]" of "set" must be a subtype of "Hashable" [type-var]
+ jax/_src/checkify.py:1069: error: Type argument "type[JaxException]" of "frozenset" must be a subtype of "Hashable" [type-var]
check-jsonschema (https://github.com/python-jsonschema/check-jsonschema)
+ src/check_jsonschema/parsers/__init__.py:12: error: Type argument "type[Exception]" of "set" must be a subtype of "Hashable" [type-var]
koda-validate (https://github.com/keithasaurus/koda-validate)
+ koda_validate/coerce.py:15: error: Type argument "type[Any]" of "set" must be a subtype of "Hashable" [type-var]
+ koda_validate/coerce.py:38: error: Value of type variable "_H" of "set" cannot be "type[Any]" [type-var]
+ koda_validate/errors.py:30: error: Type argument "type[Any]" of "set" must be a subtype of "Hashable" [type-var]
|
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.
Previous attempts were deferred because they caused a lot of noise in 3rd party libraries. But they often attempted to also add the hashability requirement to mapping types such as
dict
.This patch only affects the built-in
set
andfrozenset
to keep the amount of possible conflicts minimal.Partial fix for #9571
Related: microsoft/pyright#7824
The standard mypy test suite only reports 6 errors for
requests-oauthlib
, all other libraries pass.