-
-
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
Sync typeshed #18057
Merged
Merged
Sync typeshed #18057
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@61ba4de
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.
Diff from mypy_primer, showing the effect of this PR on open source code: operator (https://github.com/canonical/operator)
- ops/framework.py:1304: note: def __getitem__(self, slice, /) -> MutableSequence[Any]
+ ops/framework.py:1304: note: def __getitem__(self, slice[Any, Any, Any], /) -> MutableSequence[Any]
- ops/framework.py:1304: note: def __getitem__(self, slice, /) -> Sequence[Any]
+ ops/framework.py:1304: note: def __getitem__(self, slice[Any, Any, Any], /) -> Sequence[Any]
- ops/framework.py:1307: note: def __setitem__(self, slice, Iterable[Any], /) -> None
+ ops/framework.py:1307: note: def __setitem__(self, slice[Any, Any, Any], Iterable[Any], /) -> None
- ops/framework.py:1311: note: def __delitem__(self, slice, /) -> None
+ ops/framework.py:1311: note: def __delitem__(self, slice[Any, Any, Any], /) -> None
psycopg (https://github.com/psycopg/psycopg)
+ tests/types/test_datetime.py:785: error: Unused "type: ignore" comment [unused-ignore]
+ tests/types/test_datetime.py:807: error: Unused "type: ignore" comment [unused-ignore]
manticore (https://github.com/trailofbits/manticore)
- tests/wasm/json2mc.py:103: note: def __getitem__(self, slice, /) -> list[Any]
+ tests/wasm/json2mc.py:103: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[Any]
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/annotations.py:41: note: def __getitem__(self, slice, /) -> tuple[Never, ...]
+ src/prefect/utilities/annotations.py:41: note: def __getitem__(self, slice[Any, Any, Any], /) -> tuple[Never, ...]
- src/prefect/utilities/annotations.py:41: note: def __getitem__(self, slice, /) -> Sequence[Never]
+ src/prefect/utilities/annotations.py:41: note: def __getitem__(self, slice[Any, Any, Any], /) -> Sequence[Never]
- src/prefect/cli/cloud/__init__.py:326: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice" [index]
+ src/prefect/cli/cloud/__init__.py:326: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
- src/prefect/cli/deploy.py:1127: note: def __setitem__(self, slice, Iterable[dict[Any, Any]], /) -> None
+ src/prefect/cli/deploy.py:1127: note: def __setitem__(self, slice[Any, Any, Any], Iterable[dict[Any, Any]], /) -> None
- src/prefect/cli/deploy.py:1153: note: def __setitem__(self, slice, Iterable[dict[Any, Any]], /) -> None
+ src/prefect/cli/deploy.py:1153: note: def __setitem__(self, slice[Any, Any, Any], Iterable[dict[Any, Any]], /) -> None
- src/prefect/cli/deploy.py:1161: note: def __setitem__(self, slice, Iterable[dict[Any, Any]], /) -> None
+ src/prefect/cli/deploy.py:1161: note: def __setitem__(self, slice[Any, Any, Any], Iterable[dict[Any, Any]], /) -> None
- src/prefect/cli/deploy.py:1178: note: def __getitem__(self, slice, /) -> list[dict[Any, Any]]
+ src/prefect/cli/deploy.py:1178: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[dict[Any, Any]]
pywin32 (https://github.com/mhammond/pywin32)
- setup.py:929:22: error: Unsupported left operand type for + ("None") [operator]
- setup.py:929:22: note: Left operand is of type "Optional[List[str]]"
streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/elements/lib/column_config_utils_test.py:385:30: error: Invalid index type "str" for "str"; expected type "Union[SupportsIndex, slice]" [index]
+ lib/tests/streamlit/elements/lib/column_config_utils_test.py:385:30: error: Invalid index type "str" for "str"; expected type "Union[SupportsIndex, slice[Any, Any, Any]]" [index]
- lib/tests/streamlit/runtime/state/query_params_test.py:264:37: note: def __getitem__(self, slice, /) -> Tuple[Any, ...]
+ lib/tests/streamlit/runtime/state/query_params_test.py:264:37: note: def __getitem__(self, slice[Any, Any, Any], /) -> Tuple[Any, ...]
colour (https://github.com/colour-science/colour)
- colour/continuous/signal.py:843: error: No overload variant of "__call__" of "_ComparisonOpLE" matches argument type "slice" [call-overload]
+ colour/continuous/signal.py:843: error: No overload variant of "__call__" of "_ComparisonOpLE" matches argument type "slice[Any, Any, Any]" [call-overload]
- colour/continuous/signal.py:844: error: No overload variant of "__call__" of "_ComparisonOpGE" matches argument type "slice" [call-overload]
+ colour/continuous/signal.py:844: error: No overload variant of "__call__" of "_ComparisonOpGE" matches argument type "slice[Any, Any, Any]" [call-overload]
pytest (https://github.com/pytest-dev/pytest)
+ testing/io/test_terminalwriter.py:82: error: Incompatible types in assignment (expression has type "StringIO", variable has type "TextIOWrapper[_WrappedBuffer]") [assignment]
speedrun.com_global_scoreboard_webapp (https://github.com/Avasam/speedrun.com_global_scoreboard_webapp)
- backend/api/tournament_scheduler_api.py:327: note: def __getitem__(self, slice, /) -> list[Any]
+ backend/api/tournament_scheduler_api.py:327: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[Any]
- backend/api/tournament_scheduler_api.py:331: note: def __getitem__(self, slice, /) -> list[Any]
+ backend/api/tournament_scheduler_api.py:331: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[Any]
- backend/api/tournament_scheduler_api.py:335: note: def __getitem__(self, slice, /) -> list[Any]
+ backend/api/tournament_scheduler_api.py:335: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[Any]
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ tests/test_frame.py:224: error: Expression is of type "Any", not "DataFrame" [assert-type]
+ tests/test_frame.py:225: error: Expression is of type "Any", not "DataFrame" [assert-type]
materialize (https://github.com/MaterializeInc/materialize)
+ misc/python/materialize/mzbuild.py:811: error: Incompatible types in assignment (expression has type "BufferedRandom", variable has type "BufferedReader") [assignment]
discord.py (https://github.com/Rapptz/discord.py)
- discord/http.py:233: note: def __setitem__(self, slice, Iterable[Embed], /) -> None
+ discord/http.py:233: note: def __setitem__(self, slice[Any, Any, Any], Iterable[Embed], /) -> None
ibis (https://github.com/ibis-project/ibis)
- ibis/selectors.py:678: error: Incompatible types in assignment (expression has type "Slice", variable has type "str | int | slice | Iterable[int | str]") [assignment]
+ ibis/selectors.py:678: error: Incompatible types in assignment (expression has type "Slice", variable has type "str | int | slice[Any, Any, Any] | Iterable[int | str]") [assignment]
- ibis/selectors.py:679: error: Argument 1 to "ColumnIndex" has incompatible type "int | slice | Iterable[int | str]"; expected "str | int | Slice | tuple[int | str, ...]" [arg-type]
+ ibis/selectors.py:679: error: Argument 1 to "ColumnIndex" has incompatible type "int | slice[Any, Any, Any] | Iterable[int | str]"; expected "str | int | Slice | tuple[int | str, ...]" [arg-type]
- ibis/expr/types/numeric.py:1223: error: Argument 1 to "cases" of "Value" has incompatible type "*enumerate[str]"; expected "tuple[Value, Value]" [arg-type]
pyinstrument (https://github.com/joerick/pyinstrument)
- pyinstrument/vendor/decorator.py:279: error: Module "contextlib" has no attribute "GeneratorContextManager"; maybe "_GeneratorContextManager", "_AsyncGeneratorContextManager", or "AbstractContextManager"? [attr-defined]
+ pyinstrument/vendor/decorator.py:279: error: Module "contextlib" has no attribute "GeneratorContextManager"; maybe "_GeneratorContextManager", "_GeneratorContextManagerBase", or "_AsyncGeneratorContextManager"? [attr-defined]
werkzeug (https://github.com/pallets/werkzeug)
- tests/test_wrappers.py:522: note: def __setitem__(self, slice, Iterable[tuple[str, str]], /) -> None
+ tests/test_wrappers.py:522: note: def __setitem__(self, slice[Any, Any, Any], Iterable[tuple[str, str]], /) -> None
- tests/test_wrappers.py:563: note: def __setitem__(self, slice, Iterable[tuple[str, str]], /) -> None
+ tests/test_wrappers.py:563: note: def __setitem__(self, slice[Any, Any, Any], Iterable[tuple[str, str]], /) -> None
|
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@61ba4de