Repository navigation
GH-16791: Make Sequence.__getitem__(slice) return Self - #16792
Open
loic-simon wants to merge 1 commit into
Open
loic-simon wants to merge 1 commit into
loic-simon wants to merge 1 commit into
Conversation
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/web_routedef.py:151:6: error: Signature of "__getitem__" incompatible with supertype "typing.Sequence" [override]
+ aiohttp/web_routedef.py:151:6: note: Superclass:
+ aiohttp/web_routedef.py:151:6: note: @overload
+ aiohttp/web_routedef.py:151:6: note: def __getitem__(self, int, /) -> AbstractRouteDef
+ aiohttp/web_routedef.py:151:6: note: @overload
+ aiohttp/web_routedef.py:151:6: note: def __getitem__(self, slice[int | None, int | None, int | None], /) -> RouteTableDef
+ aiohttp/web_routedef.py:151:6: note: Subclass:
+ aiohttp/web_routedef.py:151:6: note: @overload
+ aiohttp/web_routedef.py:151:6: note: def __getitem__(self, int, /) -> AbstractRouteDef
+ aiohttp/web_routedef.py:151:6: note: @overload
+ aiohttp/web_routedef.py:151:6: note: def __getitem__(self, slice[int | None, int | None, int | None], /) -> list[AbstractRouteDef]
operator (https://github.com/canonical/operator)
- ops/framework.py:1383: note: def __getitem__(self, slice[int | None, int | None, int | None], /) -> Sequence[Any]
+ ops/framework.py:1383: note: def __getitem__(self, slice[int | None, int | None, int | None], /) -> StoredList
kopf (https://github.com/nolar/kopf)
+ kopf/_cogs/structs/diffs.py:89: error: Signature of "__getitem__" incompatible with supertype "typing.Sequence" [override]
+ kopf/_cogs/structs/diffs.py:89: note: Superclass:
+ kopf/_cogs/structs/diffs.py:89: note: @overload
+ kopf/_cogs/structs/diffs.py:89: note: def __getitem__(self, int, /) -> DiffItem
+ kopf/_cogs/structs/diffs.py:89: note: @overload
+ kopf/_cogs/structs/diffs.py:89: note: def __getitem__(self, slice[int | None, int | None, int | None], /) -> Diff
+ kopf/_cogs/structs/diffs.py:89: note: Subclass:
+ kopf/_cogs/structs/diffs.py:89: note: @overload
+ kopf/_cogs/structs/diffs.py:89: note: def __getitem__(self, int, /) -> DiffItem
+ kopf/_cogs/structs/diffs.py:89: note: @overload
+ kopf/_cogs/structs/diffs.py:89: note: def __getitem__(self, slice[Any, Any, Any], /) -> Sequence[DiffItem]
django-stubs (https://github.com/typeddjango/django-stubs)
+ django-stubs/core/paginator.pyi:76: error: Signature of "__getitem__" incompatible with supertype "typing.Sequence" [override]
+ django-stubs/core/paginator.pyi:76: note: Superclass:
+ django-stubs/core/paginator.pyi:76: note: @overload
+ django-stubs/core/paginator.pyi:76: note: def __getitem__(self, int, /) -> _T
+ django-stubs/core/paginator.pyi:76: note: @overload
+ django-stubs/core/paginator.pyi:76: note: def __getitem__(self, slice[int | None, int | None, int | None], /) -> Page[_T]
+ django-stubs/core/paginator.pyi:76: note: Subclass:
+ django-stubs/core/paginator.pyi:76: note: @overload
+ django-stubs/core/paginator.pyi:76: note: def __getitem__(self, int, /) -> _T
+ django-stubs/core/paginator.pyi:76: note: @overload
+ django-stubs/core/paginator.pyi:76: note: def __getitem__(self, slice[Any, Any, Any], /) -> Sequence[_T]
discord.py (https://github.com/Rapptz/discord.py)
+ discord/utils.py:253: error: Signature of "__getitem__" incompatible with supertype "typing.Sequence" [override]
+ discord/utils.py:253: note: Superclass:
+ discord/utils.py:253: note: @overload
+ discord/utils.py:253: note: def __getitem__(self, int, /) -> T_co
+ discord/utils.py:253: note: @overload
+ discord/utils.py:253: note: def __getitem__(self, slice[int | None, int | None, int | None], /) -> SequenceProxy[T_co]
+ discord/utils.py:253: note: Subclass:
+ discord/utils.py:253: note: @overload
+ discord/utils.py:253: note: def __getitem__(self, SupportsIndex, /) -> T_co
+ discord/utils.py:253: note: @overload
+ discord/utils.py:253: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[T_co]
schemathesis (https://github.com/schemathesis/schemathesis)
+ src/schemathesis/grpc/loaders.py:19: note: ... from here:
cwltool (https://github.com/common-workflow-language/cwltool)
+ tests/test_provenance.py:14: note: In module imported here:
+ mypy-stubs/rdflib/namespace/__init__.pyi: note: In member "__getitem__" of class "Namespace":
+ mypy-stubs/rdflib/namespace/__init__.pyi:38:5: error: Signature of "__getitem__" incompatible with supertype "typing.Sequence" [override]
+ mypy-stubs/rdflib/namespace/__init__.pyi:38:5: note: Superclass:
+ mypy-stubs/rdflib/namespace/__init__.pyi:38:5: note: @overload
+ mypy-stubs/rdflib/namespace/__init__.pyi:38:5: note: def __getitem__(self, int, /) -> str
+ mypy-stubs/rdflib/namespace/__init__.pyi:38:5: note: @overload
+ mypy-stubs/rdflib/namespace/__init__.pyi:38:5: note: def __getitem__(self, slice[int | None, int | None, int | None], /) -> Namespace
+ mypy-stubs/rdflib/namespace/__init__.pyi:38:5: note: Subclass:
+ mypy-stubs/rdflib/namespace/__init__.pyi:38:5: note: def __getitem__(self, Any, /) -> URIRef
+ mypy-stubs/rdflib/graph.pyi:6: note: In module imported here,
+ .../projects/_cwltool_venv/lib/python3.13/site-packages/schema_salad/utils.py:9: note: ... from here,
+ cwltool/cwlprov/writablebagfile.py:18: note: ... from here:
+ mypy-stubs/rdflib/query.pyi: note: In member "__getitem__" of class "ResultRow":
+ mypy-stubs/rdflib/query.pyi:12:6: error: Signature of "__getitem__" incompatible with supertype "typing.Sequence" [override]
+ mypy-stubs/rdflib/query.pyi:12:6: note: Superclass:
+ mypy-stubs/rdflib/query.pyi:12:6: note: @overload
+ mypy-stubs/rdflib/query.pyi:12:6: note: def __getitem__(self, int, /) -> Identifier
+ mypy-stubs/rdflib/query.pyi:12:6: note: @overload
+ mypy-stubs/rdflib/query.pyi:12:6: note: def __getitem__(self, slice[int | None, int | None, int | None], /) -> ResultRow
+ mypy-stubs/rdflib/query.pyi:12:6: note: Subclass:
+ mypy-stubs/rdflib/query.pyi:12:6: note: @overload
+ mypy-stubs/rdflib/query.pyi:12:6: note: def __getitem__(self, str, /) -> Identifier
+ mypy-stubs/rdflib/query.pyi:12:6: note: @overload
+ mypy-stubs/rdflib/query.pyi:12:6: note: def __getitem__(self, SupportsIndex, /) -> Identifier
+ mypy-stubs/rdflib/query.pyi:12:6: note: @overload
+ mypy-stubs/rdflib/query.pyi:12:6: note: def __getitem__(self, slice[Any, Any, Any], /) -> tuple[Identifier, ...]
schema_salad (https://github.com/common-workflow-language/schema_salad)
+ mypy-stubs/rdflib/graph.pyi:6: note: In module imported here,
+ src/schema_salad/tests/test_misc.py:1: note: ... from here:
+ mypy-stubs/rdflib/query.pyi: note: In member "__getitem__" of class "ResultRow":
+ mypy-stubs/rdflib/query.pyi:12:6: error: Signature of "__getitem__" incompatible with supertype "typing.Sequence" [override]
+ mypy-stubs/rdflib/query.pyi:12:6: note: Superclass:
+ mypy-stubs/rdflib/query.pyi:12:6: note: @overload
+ mypy-stubs/rdflib/query.pyi:12:6: note: def __getitem__(self, int, /) -> Identifier
+ mypy-stubs/rdflib/query.pyi:12:6: note: @overload
+ mypy-stubs/rdflib/query.pyi:12:6: note: def __getitem__(self, slice[int | None, int | None, int | None], /) -> ResultRow
+ mypy-stubs/rdflib/query.pyi:12:6: note: Subclass:
+ mypy-stubs/rdflib/query.pyi:12:6: note: @overload
+ mypy-stubs/rdflib/query.pyi:12:6: note: def __getitem__(self, str, /) -> Identifier
+ mypy-stubs/rdflib/query.pyi:12:6: note: @overload
+ mypy-stubs/rdflib/query.pyi:12:6: note: def __getitem__(self, SupportsIndex, /) -> Identifier
+ mypy-stubs/rdflib/query.pyi:12:6: note: @overload
+ mypy-stubs/rdflib/query.pyi:12:6: note: def __getitem__(self, slice[Any, Any, Any], /) -> tuple[Identifier, ...]
+ src/schema_salad/jsonld_context.py:8: note: In module imported here:
+ mypy-stubs/rdflib/namespace/__init__.pyi: note: In member "__getitem__" of class "Namespace":
+ mypy-stubs/rdflib/namespace/__init__.pyi:38:5: error: Signature of "__getitem__" incompatible with supertype "typing.Sequence" [override]
+ mypy-stubs/rdflib/namespace/__init__.pyi:38:5: note: Superclass:
+ mypy-stubs/rdflib/namespace/__init__.pyi:38:5: note: @overload
+ mypy-stubs/rdflib/namespace/__init__.pyi:38:5: note: def __getitem__(self, int, /) -> str
+ mypy-stubs/rdflib/namespace/__init__.pyi:38:5: note: @overload
+ mypy-stubs/rdflib/namespace/__init__.pyi:38:5: note: def __getitem__(self, slice[int | None, int | None, int | None], /) -> Namespace
+ mypy-stubs/rdflib/namespace/__init__.pyi:38:5: note: Subclass:
+ mypy-stubs/rdflib/namespace/__init__.pyi:38:5: note: def __getitem__(self, Any, /) -> URIRef
pytest-autoprofile (https://gitlab.com/TTsangSC/pytest-autoprofile)
+ src/pytest_autoprofile/_multiprocessing.py:398: error: Signature of "__getitem__" incompatible with supertype "typing.Sequence" [override]
+ src/pytest_autoprofile/_multiprocessing.py:398: note: Superclass:
+ src/pytest_autoprofile/_multiprocessing.py:398: note: @overload
+ src/pytest_autoprofile/_multiprocessing.py:398: note: def __getitem__(self, int, /) -> Any
+ src/pytest_autoprofile/_multiprocessing.py:398: note: @overload
+ src/pytest_autoprofile/_multiprocessing.py:398: note: def __getitem__(self, slice[int | None, int | None, int | None], /) -> _TaskResult
+ src/pytest_autoprofile/_multiprocessing.py:398: note: Subclass:
+ src/pytest_autoprofile/_multiprocessing.py:398: note: @overload
+ src/pytest_autoprofile/_multiprocessing.py:398: note: def __getitem__(self, int, /) -> int | tuple[Literal[True], Any] | tuple[Literal[False], Exception]
+ src/pytest_autoprofile/_multiprocessing.py:398: note: @overload
+ src/pytest_autoprofile/_multiprocessing.py:398: note: def __getitem__(self, slice[Any, Any, Any], /) -> tuple[int | tuple[Literal[True], Any] | tuple[Literal[False], Exception], ...]
more-itertools (https://github.com/more-itertools/more-itertools)
+ more_itertools/more.pyi:628: error: Signature of "__getitem__" incompatible with supertype "typing.Sequence" [override]
+ more_itertools/more.pyi:628: note: Superclass:
+ more_itertools/more.pyi:628: note: @overload
+ more_itertools/more.pyi:628: note: def __getitem__(self, int, /) -> _T_co
+ more_itertools/more.pyi:628: note: @overload
+ more_itertools/more.pyi:628: note: def __getitem__(self, slice[int | None, int | None, int | None], /) -> SequenceView[_T_co]
+ more_itertools/more.pyi:628: note: Subclass:
+ more_itertools/more.pyi:628: note: @overload
+ more_itertools/more.pyi:628: note: def __getitem__(self, int, /) -> _T_co
+ more_itertools/more.pyi:628: note: @overload
+ more_itertools/more.pyi:628: note: def __getitem__(self, slice[Any, Any, Any], /) -> Sequence[_T_co]
meson (https://github.com/mesonbuild/meson)
+ mesonbuild/arglist.py:157:6: error: Signature of "__getitem__" incompatible with supertype "typing.Sequence" [override]
+ mesonbuild/arglist.py:157:6: note: Superclass:
+ mesonbuild/arglist.py:157:6: note: @overload
+ mesonbuild/arglist.py:157:6: note: def __getitem__(self, int, /) -> str
+ mesonbuild/arglist.py:157:6: note: @overload
+ mesonbuild/arglist.py:157:6: note: def __getitem__(self, slice[int | None, int | None, int | None], /) -> CompilerArgs
+ mesonbuild/arglist.py:157:6: note: Subclass:
+ mesonbuild/arglist.py:157:6: note: @overload
+ mesonbuild/arglist.py:157:6: note: def __getitem__(self, int, /) -> str
+ mesonbuild/arglist.py:157:6: note: @overload
+ mesonbuild/arglist.py:157:6: note: def __getitem__(self, slice[Any, Any, Any], /) -> MutableSequence[str]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/datastructures/accept.py:52: error: Signature of "__getitem__" incompatible with supertype "typing.Sequence" [override]
+ src/werkzeug/datastructures/accept.py:52: note: Superclass:
+ src/werkzeug/datastructures/accept.py:52: note: @overload
+ src/werkzeug/datastructures/accept.py:52: note: def __getitem__(self, int, /) -> tuple[str, float]
+ src/werkzeug/datastructures/accept.py:52: note: @overload
+ src/werkzeug/datastructures/accept.py:52: note: def __getitem__(self, slice[int | None, int | None, int | None], /) -> Accept
+ src/werkzeug/datastructures/accept.py:52: note: Subclass:
+ src/werkzeug/datastructures/accept.py:52: note: @overload
+ src/werkzeug/datastructures/accept.py:52: note: def __getitem__(self, str, /) -> float
+ src/werkzeug/datastructures/accept.py:52: note: @overload
+ src/werkzeug/datastructures/accept.py:52: note: def __getitem__(self, SupportsIndex, /) -> tuple[str, float]
+ src/werkzeug/datastructures/accept.py:52: note: @overload
+ src/werkzeug/datastructures/accept.py:52: note: def __getitem__(self, slice[Any, Any, Any], /) -> tuple[tuple[str, float]]
|
This comment was marked as outdated.
This comment was marked as outdated.
This branch has not been deployed
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
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.
Exploratory PR for #16791