-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
Mypybot/sync typeshed #14719
Merged
Merged
Mypybot/sync typeshed #14719
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@75cd302
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)
Since the plugin provides superior type checking: python#13987 (comment)
Diff from mypy_primer, showing the effect of this PR on open source code: pandas (https://github.com/pandas-dev/pandas)
+ pandas/_libs/tslibs/timestamps.pyi:138: error: Return type "datetime" of "strptime" incompatible with return type "Timestamp" in supertype "datetime" [override]
porcupine (https://github.com/Akuli/porcupine)
- porcupine/utils.py:408: note: def asdict(obj: _DataclassInstance) -> Dict[str, Any]
+ porcupine/utils.py:408: note: def asdict(obj: DataclassInstance) -> Dict[str, Any]
- porcupine/utils.py:408: note: def [_T] asdict(obj: _DataclassInstance, *, dict_factory: Callable[[List[Tuple[str, Any]]], _T]) -> _T
+ porcupine/utils.py:408: note: def [_T] asdict(obj: DataclassInstance, *, dict_factory: Callable[[List[Tuple[str, Any]]], _T]) -> _T
steam.py (https://github.com/Gobot1234/steam.py)
- steam/chat.py:401: note: def [Self] __new__(cls: Type[Self], str, Tuple[type, ...], Dict[str, Any], /, **kwds: Any) -> Self
+ steam/chat.py:401: note: def [_typeshed.Self] __new__(cls: Type[_typeshed.Self], str, Tuple[type, ...], Dict[str, Any], /, **kwds: Any) -> _typeshed.Self
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ pandas-stubs/_libs/tslibs/timestamps.pyi:151: error: Return type "datetime" of "strptime" incompatible with return type "Timestamp" in supertype "datetime" [override]
isort (https://github.com/pycqa/isort)
+ isort/api.py:196: error: No overload variant of "compile" matches argument types "str", "str", "str", "int", "int" [call-overload]
+ isort/api.py:196: note: Possible overload variants:
+ isort/api.py:196: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, flags: Literal[0], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> CodeType
+ isort/api.py:196: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, *, dont_inherit: bool = ..., optimize: int = ..., _feature_version: int = ...) -> CodeType
+ isort/api.py:196: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, flags: Literal[1024], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> AST
+ isort/api.py:196: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, flags: int, dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> Any
+ isort/api.py:223: error: No overload variant of "compile" matches argument types "str", "str", "str", "int", "int" [call-overload]
+ isort/api.py:223: note: Possible overload variants:
+ isort/api.py:223: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, flags: Literal[0], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> CodeType
+ isort/api.py:223: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, *, dont_inherit: bool = ..., optimize: int = ..., _feature_version: int = ...) -> CodeType
+ isort/api.py:223: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, flags: Literal[1024], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> AST
+ isort/api.py:223: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, flags: int, dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> Any
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/pydantic.py:161: note: def [Self] __new__(cls: Type[Self], str, Tuple[type, ...], Dict[str, Any], /, **kwds: Any) -> Self
+ src/prefect/utilities/pydantic.py:161: note: def [_typeshed.Self] __new__(cls: Type[_typeshed.Self], str, Tuple[type, ...], Dict[str, Any], /, **kwds: Any) -> _typeshed.Self
- src/prefect/utilities/pydantic.py:163: note: def [Self] __new__(cls: Type[Self], str, Tuple[type, ...], Dict[str, Any], /, **kwds: Any) -> Self
+ src/prefect/utilities/pydantic.py:163: note: def [_typeshed.Self] __new__(cls: Type[_typeshed.Self], str, Tuple[type, ...], Dict[str, Any], /, **kwds: Any) -> _typeshed.Self
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/runtime/scriptrunner/script_runner.py: note: In member "_run_script" of class "ScriptRunner":
+ lib/streamlit/runtime/scriptrunner/script_runner.py:495:20: error: No overload variant of "compile" matches argument types "Any", "str", "str", "int", "int", "int" [call-overload]
+ lib/streamlit/runtime/scriptrunner/script_runner.py:495:20: note: Possible overload variants:
+ lib/streamlit/runtime/scriptrunner/script_runner.py:495:20: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, flags: Literal[0], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> CodeType
+ lib/streamlit/runtime/scriptrunner/script_runner.py:495:20: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, *, dont_inherit: bool = ..., optimize: int = ..., _feature_version: int = ...) -> CodeType
+ lib/streamlit/runtime/scriptrunner/script_runner.py:495:20: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, flags: Literal[1024], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> AST
+ lib/streamlit/runtime/scriptrunner/script_runner.py:495:20: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, flags: int, dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> Any
hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- src/hydra_zen/structured_configs/_implementations.py:1862: error: Incompatible types in assignment (expression has type "Union[Type[_DataclassInstance], Type[Any], Callable[P, R], Callable[..., Any], DataClass_]", variable has type overloaded function) [assignment]
+ src/hydra_zen/structured_configs/_implementations.py:1862: error: Incompatible types in assignment (expression has type "Union[Type[DataclassInstance], Type[Any], Callable[P, R], Callable[..., Any], DataClass_]", variable has type overloaded function) [assignment]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ bson/son.py: note: In member "__new__" of class "SON":
+ bson/son.py:69: error: Value of type variable "Self" of "__new__" of "dict" cannot be "SON[_Key, _Value]" [type-var]
|
pandas, pandas-stubs: python/typeshed#9706 |
Thank you! |
hauntsaninja
added a commit
that referenced
this pull request
Feb 17, 2023
#14719 fixed some merge conflicts
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.
Sync latest typeshed via the sync script.
The cherry-picks with the first and second reversions were not clean, but the merges were not very complicated.