-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Sync typeshed #19194
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
Merged
Merged
Sync typeshed #19194
Conversation
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
Source commit: python/typeshed@5a3c495
This is allegedly causing large performance problems, see 13821 typeshed/8231 had zero hits on mypy_primer, so it's not the worst thing to undo. Patching this in typeshed also feels weird, since there's a more general soundness issue. If a typevar has a bound or constraint, we might not want to solve it to a Literal. If we can confirm the performance regression or fix the unsoundness within mypy, I might pursue upstreaming this in typeshed. (Reminder: add this to the sync_typeshed script once merged)
… checking: python#13987 (comment) A manual cherry-pick of e437cdf.
Closed
This comment has been minimized.
This comment has been minimized.
Mypy primer hits
|
Diff from mypy_primer, showing the effect of this PR on open source code: pip (https://github.com/pypa/pip): 1.11x faster (52.1s -> 47.0s in single noisy sample)
pyp (https://github.com/hauntsaninja/pyp): 1.55x faster (19.2s -> 12.3s in single noisy sample)
antidote (https://github.com/Finistere/antidote): 1.20x slower (73.7s -> 88.6s in single noisy sample)
prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/utilities/callables.py:655: error: Incompatible return value type (got "Union[str, bytes, int, float, complex, ellipsis, None]", expected "Optional[str]") [return-value]
+ src/prefect/utilities/_ast.py:104: error: Dict entry 0 has incompatible type "str": "Union[str, bytes, int, float, complex, ellipsis, None]"; expected "str": "str" [dict-item]
ibis (https://github.com/ibis-project/ibis)
+ ibis/common/annotations.py:450: note: def update(self, SupportsKeysAndGetItem[Any, Any], /) -> None
- ibis/common/annotations.py:450: note: def update(self, SupportsKeysAndGetItem[Any, Any], /, **kwargs: Any) -> None
+ ibis/common/annotations.py:450: note: def update(self, SupportsKeysAndGetItem[str, Any], /, **kwargs: Any) -> None
+ ibis/common/annotations.py:450: note: def update(self, Iterable[tuple[Any, Any]], /) -> None
- ibis/common/annotations.py:450: note: def update(self, Iterable[tuple[Any, Any]], /, **kwargs: Any) -> None
+ ibis/common/annotations.py:450: note: def update(self, Iterable[tuple[str, Any]], /, **kwargs: Any) -> None
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ bson/son.py:146: error: Unused "type: ignore" comment [unused-ignore]
materialize (https://github.com/MaterializeInc/materialize): 1.05x slower (143.9s -> 151.5s in single noisy sample)
mypy (https://github.com/python/mypy)
+ mypy/fastparse.py:2063: error: Statement is unreachable [unreachable]
+ mypy/fastparse.py:2063: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-unreachable for more info
pydantic (https://github.com/pydantic/pydantic)
+ pydantic/v1/dataclasses.py:214: error: Incompatible types in assignment (expression has type "type[Any]", variable has type "DataclassProxy") [assignment]
- pydantic/v1/dataclasses.py:214: error: No overload variant of "dataclass" matches argument types "type[Any]", "bool", "bool", "bool", "bool", "bool", "bool", "bool" [call-overload]
- pydantic/v1/dataclasses.py:214: note: Possible overload variants:
- pydantic/v1/dataclasses.py:214: note: def dataclass(None, /) -> Callable[[type[_T]], type[_T]]
- pydantic/v1/dataclasses.py:214: note: def [_T] dataclass(type[_T], /) -> type[_T]
- pydantic/v1/dataclasses.py:214: note: def dataclass(*, init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., unsafe_hash: bool = ..., frozen: bool = ..., match_args: bool = ..., kw_only: bool = ..., slots: bool = ..., weakref_slot: bool = ...) -> Callable[[type[_T]], type[_T]]
+ pydantic/dataclasses.py:257: error: Unused "type: ignore" comment [unused-ignore]
operator (https://github.com/canonical/operator)
+ ops/model.py:1960: note: def update(self, SupportsKeysAndGetItem[str, str], /) -> None
+ ops/model.py:1960: note: @overload
+ ops/model.py:1960: note: @overload
+ ops/model.py:1960: note: def update(self, Iterable[tuple[str, str]], /) -> None
cibuildwheel (https://github.com/pypa/cibuildwheel)
+ cibuildwheel/projectfiles.py:73: error: Incompatible types in assignment (expression has type "str | bytes | int | float | complex | EllipsisType | None", variable has type "str | None") [assignment]
meson (https://github.com/mesonbuild/meson)
+ mesonbuild/options.py:1153:9: error: No overload variant of "update" of "MutableMapping" matches argument type "dict[str, UserBooleanOption | UserComboOption | UserFeatureOption | UserIntegerOption | UserStdOption | UserStringArrayOption | UserStringOption | UserUmaskOption]" [call-overload]
+ mesonbuild/options.py:1153:9: note: Possible overload variants:
+ mesonbuild/options.py:1153:9: note: def update(self, SupportsKeysAndGetItem[OptionKey, UserBooleanOption | UserComboOption | UserFeatureOption | UserIntegerOption | UserStdOption | UserStringArrayOption | UserStringOption | UserUmaskOption], /) -> None
+ mesonbuild/options.py:1153:9: note: def update(self, Iterable[tuple[OptionKey, UserBooleanOption | UserComboOption | UserFeatureOption | UserIntegerOption | UserStdOption | UserStringArrayOption | UserStringOption | UserUmaskOption]], /) -> None
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/datastructures/mixins.py:309: error: No overload variant of "update" of "MutableMapping" matches argument type "dict[str, V]" [call-overload]
+ src/werkzeug/datastructures/mixins.py:309: note: Possible overload variants:
+ src/werkzeug/datastructures/mixins.py:309: note: def update(self, SupportsKeysAndGetItem[K, V], /) -> None
+ src/werkzeug/datastructures/mixins.py:309: note: def update(self, Iterable[tuple[K, V]], /) -> None
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("str" and "bytes") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("str" and "int") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("str" and "float") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("str" and "complex") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("str" and "None") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("str" and "ellipsis") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("bytes" and "str") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("bytes" and "int") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("bytes" and "float") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("bytes" and "complex") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("bytes" and "None") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("bytes" and "ellipsis") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("int" and "str") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("int" and "bytes") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("int" and "None") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("int" and "ellipsis") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("float" and "str") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("float" and "bytes") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("float" and "None") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("float" and "ellipsis") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("complex" and "str") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("complex" and "bytes") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("complex" and "None") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("complex" and "ellipsis") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported left operand type for + ("None") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("None" and "int") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("None" and "float") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("None" and "complex") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported left operand type for + ("ellipsis") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("ellipsis" and "int") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("ellipsis" and "float") [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("ellipsis" and "complex") [operator]
+ src/werkzeug/routing/rules.py:779: note: Both left and right operands are unions
aioredis (https://github.com/aio-libs/aioredis)
- aioredis/client.py:146: note: def update(self, SupportsKeysAndGetItem[Any, Any], /, **kwargs: Any) -> None
+ aioredis/client.py:146: note: def update(self, SupportsKeysAndGetItem[Any, Any], /) -> None
+ aioredis/client.py:146: note: def update(self, SupportsKeysAndGetItem[str, Any], /, **kwargs: Any) -> None
+ aioredis/client.py:146: note: @overload
+ aioredis/client.py:146: note: def update(self, Iterable[tuple[Any, Any]], /) -> None
+ aioredis/client.py:146: note: @overload
- aioredis/client.py:146: note: def update(self, Iterable[tuple[Any, Any]], /, **kwargs: Any) -> None
+ aioredis/client.py:146: note: def update(self, Iterable[tuple[str, Any]], /, **kwargs: Any) -> None
discord.py (https://github.com/Rapptz/discord.py)
+ discord/client.py:733: note: def update(self, SupportsKeysAndGetItem[str, int | None], /) -> None
+ discord/client.py:733: note: def update(self, Iterable[tuple[str, int | None]], /) -> None
+ discord/client.py:759: note: def update(self, SupportsKeysAndGetItem[str, int | None], /) -> None
+ discord/client.py:759: note: def update(self, Iterable[tuple[str, int | None]], /) -> None
- ...:1010: note: "update" of "TypedDict" defined here
+ ...:1014: note: "update" of "TypedDict" defined here
- ...:1010: note: "update" of "TypedDict" defined here
+ ...:1014: note: "update" of "TypedDict" defined here
|
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.
Source commit:
python/typeshed@5a3c495