-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Sync typeshed #17724
Merged
Merged
Sync typeshed #17724
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
Source commit: python/typeshed@661fe27
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.
This comment has been minimized.
This comment has been minimized.
Diff from mypy_primer, showing the effect of this PR on open source code: pydantic (https://github.com/pydantic/pydantic)
+ pydantic/v1/json.py:80: error: Argument 1 to "asdict" has incompatible type "DataclassInstance | type[DataclassInstance]"; expected "DataclassInstance" [arg-type]
- pydantic/v1/json.py:80: error: No overload variant of "asdict" matches argument type "type[DataclassInstance]" [call-overload]
- pydantic/v1/json.py:80: note: Possible overload variants:
- pydantic/v1/json.py:80: note: def asdict(obj: DataclassInstance) -> dict[str, Any]
- pydantic/v1/json.py:80: note: def [_T] asdict(obj: DataclassInstance, *, dict_factory: Callable[[list[tuple[str, Any]]], _T]) -> _T
pip (https://github.com/pypa/pip)
+ src/pip/_internal/network/lazy_wheel.py:162: error: Unused "type: ignore" comment [unused-ignore]
urllib3 (https://github.com/urllib3/urllib3)
+ test/test_ssltransport.py:451: error: Unused "type: ignore" comment [unused-ignore]
+ test/test_ssltransport.py:451: error: Argument 1 to "write" of "IO" has incompatible type "bytes"; expected "str" [arg-type]
+ test/test_ssltransport.py:451: note: Error code "arg-type" not covered by "type: ignore" comment
koda-validate (https://github.com/keithasaurus/koda-validate)
+ koda_validate/typehints.py:119: error: Argument 1 to "DataclassValidator" has incompatible type "DataclassInstance | type[DataclassInstance]"; expected "type[Any]" [arg-type]
+ koda_validate/signature.py:82: error: Argument 1 to "DataclassValidator" has incompatible type "DataclassInstance | type[DataclassInstance]"; expected "type[Any]" [arg-type]
+ koda_validate/signature.py:82: error: Argument 1 to "dataclass_no_coerce" has incompatible type "DataclassInstance | type[DataclassInstance]"; expected "type[DataclassInstance]" [arg-type]
scrapy (https://github.com/scrapy/scrapy)
+ scrapy/commands/check.py:18: error: Unused "type: ignore" comment [unused-ignore]
rich (https://github.com/Textualize/rich)
- rich/progress.py:179: error: Definition of "writelines" in base class "IOBase" is incompatible with definition in base class "IO" [misc]
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/_io/pprint.py:114: error: Unused "type: ignore" comment [unused-ignore]
+ src/_pytest/_io/pprint.py:116: error: "DataclassInstance" has no attribute "__dataclass_params__" [attr-defined]
+ src/_pytest/_io/pprint.py:122: error: Unused "type: ignore" comment [unused-ignore]
hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- src/hydra_zen/structured_configs/_implementations.py:1130: note: def [R, P`2103] builds(cls, type[BuildsWithSig[type[R], P]], /, *, zen_partial: Literal[False] | None = ..., populate_full_signature: Literal[True], zen_wrappers: Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None | Sequence[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None] = ..., zen_meta: Mapping[str, SupportedPrimitive] | None = ..., hydra_recursive: bool | None = ..., hydra_convert: Literal['none', 'partial', 'all', 'object'] | None = ..., hydra_defaults: list[str | DataClass_ | type[DataClass_] | Mapping[str, str | Sequence[str] | None]] | None = ..., dataclass_name: str | None = ..., builds_bases: tuple[()] = ..., zen_dataclass: DataclassOptions | None = ..., frozen: bool = ..., zen_convert: ZenConvert | None = ...) -> type[BuildsWithSig[type[R], P]]
+ src/hydra_zen/structured_configs/_implementations.py:1130: note: def [R, P`2109] builds(cls, type[BuildsWithSig[type[R], P]], /, *, zen_partial: Literal[False] | None = ..., populate_full_signature: Literal[True], zen_wrappers: Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None | Sequence[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None] = ..., zen_meta: Mapping[str, SupportedPrimitive] | None = ..., hydra_recursive: bool | None = ..., hydra_convert: Literal['none', 'partial', 'all', 'object'] | None = ..., hydra_defaults: list[str | DataClass_ | type[DataClass_] | Mapping[str, str | Sequence[str] | None]] | None = ..., dataclass_name: str | None = ..., builds_bases: tuple[()] = ..., zen_dataclass: DataclassOptions | None = ..., frozen: bool = ..., zen_convert: ZenConvert | None = ...) -> type[BuildsWithSig[type[R], P]]
- src/hydra_zen/structured_configs/_implementations.py:1130: note: def [P`2105, R] builds(cls, Callable[P, R], /, *, zen_partial: Literal[False] | None = ..., populate_full_signature: Literal[True], zen_wrappers: Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None | Sequence[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None] = ..., zen_meta: Mapping[str, SupportedPrimitive] | None = ..., hydra_recursive: bool | None = ..., hydra_convert: Literal['none', 'partial', 'all', 'object'] | None = ..., hydra_defaults: list[str | DataClass_ | type[DataClass_] | Mapping[str, str | Sequence[str] | None]] | None = ..., dataclass_name: str | None = ..., builds_bases: tuple[()] = ..., zen_dataclass: DataclassOptions | None = ..., frozen: bool = ..., zen_convert: ZenConvert | None = ...) -> type[BuildsWithSig[type[R], P]]
+ src/hydra_zen/structured_configs/_implementations.py:1130: note: def [P`2111, R] builds(cls, Callable[P, R], /, *, zen_partial: Literal[False] | None = ..., populate_full_signature: Literal[True], zen_wrappers: Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None | Sequence[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None] = ..., zen_meta: Mapping[str, SupportedPrimitive] | None = ..., hydra_recursive: bool | None = ..., hydra_convert: Literal['none', 'partial', 'all', 'object'] | None = ..., hydra_defaults: list[str | DataClass_ | type[DataClass_] | Mapping[str, str | Sequence[str] | None]] | None = ..., dataclass_name: str | None = ..., builds_bases: tuple[()] = ..., zen_dataclass: DataclassOptions | None = ..., frozen: bool = ..., zen_convert: ZenConvert | None = ...) -> type[BuildsWithSig[type[R], P]]
... (truncated 8 lines) ...
core (https://github.com/home-assistant/core)
+ homeassistant/util/frozen_dataclass_compat.py:114: error: Argument 1 to "__new__" of "object" has incompatible type "DataclassInstance | type[DataclassInstance]"; expected "type[DataclassInstance]" [arg-type]
cwltool (https://github.com/common-workflow-language/cwltool)
+ cwltool/executors.py: note: In member "run_jobs" of class "SingleJobExecutor":
+ cwltool/executors.py:251:34: error: Argument "file" to "print" has incompatible type "IO[bytes] | TextIO | IO[str] | None"; expected "SupportsWrite[str] | None" [arg-type]
mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/platform/windows.py:98: error: Argument 1 to "read" has incompatible type "BufferedIOBase"; expected "IO[bytes]" [arg-type]
+ mitmproxy/platform/windows.py:103: error: Argument 1 to "read" has incompatible type "BufferedIOBase"; expected "IO[bytes]" [arg-type]
+ mitmproxy/platform/windows.py:112: error: Argument 2 to "write" has incompatible type "BufferedIOBase"; expected "IO[bytes]" [arg-type]
werkzeug (https://github.com/pallets/werkzeug)
- tests/test_wrappers.py:1216: error: No overload variant of "ZipFile" matches argument types "ResponseStream", "str" [call-overload]
- tests/test_wrappers.py:1216: note: Possible overload variants:
- tests/test_wrappers.py:1216: note: def __init__(self, file: str | PathLike[str] | IO[bytes], mode: Literal['r'] = ..., compression: int = ..., allowZip64: bool = ..., compresslevel: int | None = ..., *, strict_timestamps: bool = ..., metadata_encoding: str | None) -> ZipFile
- tests/test_wrappers.py:1216: note: def __init__(self, file: str | PathLike[str] | IO[bytes], mode: Literal['r', 'w', 'x', 'a'] = ..., compression: int = ..., allowZip64: bool = ..., compresslevel: int | None = ..., *, strict_timestamps: bool = ..., metadata_encoding: None = ...) -> ZipFile
xarray-dataclasses (https://github.com/astropenguin/xarray-dataclasses)
- xarray_dataclasses/typing.py:300: error: Unused "type: ignore" comment [unused-ignore]
|
Mypy primer analysis |
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.
The automatic sync failed due to a merge conflict.
Source commit:
python/typeshed@661fe27