Make slice generic
Mainly doing this out of curiosity to see the primer hits.
EDIT: Would close #8647.
Diff from mypy_primer, showing the effect of this PR on open source code:
vision (https://github.com/pytorch/vision)
+ torchvision/datasets/video_utils.py:94: error: Name "_StartT" is not defined [name-defined]
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice, /) -> tuple[Never, ...]
+ src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> tuple[Never, ...]
- src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice, /) -> Sequence[Never]
+ src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> Sequence[Never]
+ src/prefect/_vendor/starlette/datastructures.py:94: error: Name "_StartT" is not defined [name-defined]
- src/prefect/cli/deploy.py:1032: note: def __setitem__(self, slice, Iterable[dict[Any, Any]], /) -> None
+ src/prefect/cli/deploy.py:1032: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[dict[Any, Any]], /) -> None
- src/prefect/cli/deploy.py:1058: note: def __setitem__(self, slice, Iterable[dict[Any, Any]], /) -> None
+ src/prefect/cli/deploy.py:1058: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[dict[Any, Any]], /) -> None
- src/prefect/cli/deploy.py:1066: note: def __setitem__(self, slice, Iterable[dict[Any, Any]], /) -> None
+ src/prefect/cli/deploy.py:1066: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[dict[Any, Any]], /) -> None
- src/prefect/cli/deploy.py:1081: note: def __getitem__(self, slice, /) -> list[dict[Any, Any]]
+ src/prefect/cli/deploy.py:1081: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> list[dict[Any, Any]]
Expression (https://github.com/cognitedata/Expression)
+ expression/collections/block.py:94: error: Name "_StartT" is not defined [name-defined]
+ expression/collections/array.py:94: error: Name "_StartT" is not defined [name-defined]
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[int, _StartT?, int | None], /) -> list[Any]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/_typing.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/array_algos/transforms.py:41: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/array_algos/transforms.py:41: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/_libs/lib.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexers/utils.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/groupby/indexing.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/arrays/arrow/accessors.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/computation/expr.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/algorithms.py:1387: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1387: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1387: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1387: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1398: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1398: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1402: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1402: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1402: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1402: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/arrays/datetimelike.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/io/pytables.py:4877: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/html.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/series.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexing.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexing.py:2611: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/frame.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/internals/managers.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/internals/blocks.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/multi.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/interval.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/datetimelike.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/datetimelike.py:331: error: Argument 1 to "slice" has incompatible type "ndarray[Any, dtype[signedinteger[Any]]]"; expected "int" [arg-type]
+ pandas/core/indexes/base.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/groupby/groupby.py:5268: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/_libs/internals.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/groupby/ops.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/_testing/asserters.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/_libs/index.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/tests/extension/date/array.py:94: error: Name "_StartT" is not defined [name-defined]
kornia (https://github.com/kornia/kornia)
+ kornia/feature/adalam/ransac.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/contrib/models/sam/architecture/mask_decoder.py:91: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ kornia/geometry/vector.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/quaternion.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/boxes.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/so3.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/so2.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/se3.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/se2.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/keypoints.py:94: error: Name "_StartT" is not defined [name-defined]
tornado (https://github.com/tornadoweb/tornado)
+ tornado/template.py:94: error: Name "_StartT" is not defined [name-defined]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/web_routedef.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ aiohttp/web_request.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ aiohttp/web_request.py:612:22: error: Argument 1 to "slice" has incompatible type "Any | None"; expected "int" [arg-type]
+ aiohttp/web_fileresponse.py:255:36: error: If condition is always false [redundant-expr]
+ aiohttp/web_fileresponse.py:255:36: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-redundant-expr for more info
sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/util/_pathlib.py: note: In member "__getitem__" of class "_StrPath":
+ sphinx/util/_pathlib.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/builders/html/_assets.py: note: In member "__getitem__" of class "_CascadingStyleSheet":
+ sphinx/builders/html/_assets.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/builders/html/_assets.py: note: In member "__getitem__" of class "_JavaScript":
+ sphinx/builders/html/_assets.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/locale/__init__.py: note: In member "__getitem__" of class "_TranslationProxy":
+ sphinx/locale/__init__.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/builders/__init__.py:11: note: In module imported here:
+ sphinx/config.py: note: In member "__getitem__" of class "_Opt":
+ sphinx/config.py:94:36: error: Name "_StartT" is not defined [name-defined]
rich (https://github.com/Textualize/rich)
+ rich/containers.py:94: error: Name "_StartT" is not defined [name-defined]
+ rich/text.py:94: error: Name "_StartT" is not defined [name-defined]
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/_code/source.py:94: error: Name "_StartT" is not defined [name-defined]
+ src/_pytest/_code/code.py:94: error: Name "_StartT" is not defined [name-defined]
spack (https://github.com/spack/spack)
+ lib/spack/llnl/path.py:94: error: Name "_StartT" is not defined [name-defined]
more-itertools (https://github.com/more-itertools/more-itertools)
+ more_itertools/more.pyi:94: error: Name "_StartT" is not defined [name-defined]
psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/types/multirange.py:94: error: Name "_StartT" is not defined [name-defined]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/datastructures/mixins.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ src/werkzeug/datastructures/headers.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ src/werkzeug/datastructures/accept.pyi:94: error: Name "_StartT" is not defined [name-defined]
PyGithub (https://github.com/PyGithub/PyGithub)
+ github/PaginatedList.py:94: error: Name "_StartT" is not defined [name-defined]
starlette (https://github.com/encode/starlette)
+ starlette/datastructures.py:94: error: Name "_StartT" is not defined [name-defined]
kopf (https://github.com/nolar/kopf)
+ kopf/_cogs/structs/diffs.py:94: error: Name "_StartT" is not defined [name-defined]
spark (https://github.com/apache/spark)
+ python/pyspark/ml/linalg/__init__.py:94: error: Name "_StartT" is not defined [name-defined]
+ python/pyspark/mllib/linalg/__init__.py:94: error: Name "_StartT" is not defined [name-defined]
+ python/pyspark/pandas/indexing.py:94: error: Name "_StartT" is not defined [name-defined]
+ python/pyspark/pandas/indexing.py:1034: error: Incompatible types in assignment (expression has type "list[Any]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1035: error: Value of type "int" is not indexable [index]
+ python/pyspark/pandas/indexing.py:1035: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1092: error: Incompatible types in assignment (expression has type "tuple[int]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1093: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1103: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/namespace.py:94: error: Name "_StartT" is not defined [name-defined]
operator (https://github.com/canonical/operator)
- ops/framework.py:1284: note: def __getitem__(self, slice, /) -> MutableSequence[Any]
+ ops/framework.py:1284: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> MutableSequence[Any]
- ops/framework.py:1284: note: def __getitem__(self, slice, /) -> Sequence[Any]
+ ops/framework.py:1284: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> Sequence[Any]
- ops/framework.py:1287: note: def __setitem__(self, slice, Iterable[Any], /) -> None
+ ops/framework.py:1287: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[Any], /) -> None
- ops/framework.py:1291: note: def __delitem__(self, slice, /) -> None
+ ops/framework.py:1291: note: def __delitem__(self, slice[int, _StartT?, int | None], /) -> None
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ pandas-stubs/_typing.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/strings.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/series.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/frame.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/indexes/range.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/indexes/interval.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/indexes/base.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/groupby/groupby.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/groupby/generic.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/arrays/datetimelike.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/arrays/base.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ tests/test_frame.py:1928: error: Expression is of type "tuple[Index[int], slice[Any, Any, Any]]", not "tuple[Index[int], slice[int, _StartT?, int | None]]" [assert-type]
nionutils (https://github.com/nion-software/nionutils)
+ nion/utils/Geometry.py:94: error: Name "_StartT" is not defined [name-defined]
streamlit (https://github.com/streamlit/streamlit)
+ lib/tests/streamlit/runtime/caching/hashing_test.py:31: note: ... from here:
+ lib/streamlit/runtime/caching/__init__.py:20: note: ... from here:
+ lib/streamlit/testing/v1/element_tree.py: note: In function "__getitem__":
+ lib/streamlit/testing/v1/element_tree.py:94:36: error: Name "_StartT" is not defined [name-defined]
jinja (https://github.com/pallets/jinja)
+ src/jinja2/nodes.py:94: error: Name "_StartT" is not defined [name-defined]
+ src/jinja2/nodes.py:893: error: Argument 1 to "slice" has incompatible type "Any | None"; expected "int" [arg-type]
ibis (https://github.com/ibis-project/ibis)
+ ibis/util.py:94: error: Name "_StartT" is not defined [name-defined]
- ibis/util.py:654: error: Incompatible types in assignment (expression has type "Value", variable has type "int | None") [assignment]
+ ibis/util.py:643: error: Unsupported operand types for + ("IntegerScalar" and "int") [operator]
- ibis/util.py:655: error: Incompatible return value type (got "tuple[int | None, Any | int]", expected "tuple[int | IntegerScalar, int | IntegerScalar]") [return-value]
+ ibis/util.py:655: error: Incompatible return value type (got "tuple[int | None, int]", expected "tuple[int | IntegerScalar, int | IntegerScalar]") [return-value]
+ ibis/selectors.py:94: error: Name "_StartT" is not defined [name-defined]
- ibis/selectors.py:646: error: Item "slice" of "slice | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
+ ibis/selectors.py:646: error: Item "slice[int, _StartT?, int | None]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
- ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "start" [union-attr]
+ ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "start" [union-attr]
- ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "stop" [union-attr]
+ ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "stop" [union-attr]
- ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/expr/types/strings.py:94: error: Name "_StartT" is not defined [name-defined]
+ ibis/expr/types/arrays.py:94: error: Name "_StartT" is not defined [name-defined]
+ ibis/expr/types/arrays.py:145: error: Argument 2 to "ArraySlice" has incompatible type "int"; expected "Value[Integer, Any]" [arg-type]
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[int, _StartT?, int | None], /) -> 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[int, _StartT?, int | None], /) -> 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[int, _StartT?, int | None], /) -> list[Any]
jax (https://github.com/google/jax)
+ jax/_src/core.py:1874: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/fft.py:92: error: Argument 1 to "map" has incompatible type "type[slice[Any, Any, Any]]"; expected "Callable[[int], slice[Never, int, Never]]" [arg-type]
+ jax/_src/numpy/lax_numpy.py:365: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/lax_numpy.py:699: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/lax_numpy.py:699: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1980: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1981: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1985: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/cursor.py:94: error: Name "_StartT" is not defined [name-defined]
discord.py (https://github.com/Rapptz/discord.py)
+ discord/utils.py:94: error: Name "_StartT" is not defined [name-defined]
- discord/http.py:228: note: def __setitem__(self, slice, Iterable[Embed], /) -> None
+ discord/http.py:228: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[Embed], /) -> None
schema_salad (https://github.com/common-workflow-language/schema_salad)
+ schema_salad/tests/test_misc.py:3: note: In module imported here:
+ mypy-stubs/rdflib/graph.pyi: note: In member "__getitem__" of class "Graph":
+ mypy-stubs/rdflib/graph.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
+ mypy-stubs/rdflib/graph.pyi:15: note: In module imported here,
+ schema_salad/tests/test_misc.py:3: note: ... from here:
+ mypy-stubs/rdflib/query.pyi: note: In function "__getitem__":
+ mypy-stubs/rdflib/query.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
cwltool (https://github.com/common-workflow-language/cwltool)
+ note: In module imported here,
+ cwltool/cwlprov/writablebagfile.py:16: note: ... from here:
+ mypy-stubs/rdflib/graph.pyi: note: In member "__getitem__" of class "Graph":
+ mypy-stubs/rdflib/graph.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
+ cwltool/cwlrdf.py:6: note: In module imported here:
+ mypy-stubs/rdflib/query.pyi: note: In function "__getitem__":
+ mypy-stubs/rdflib/query.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
+ note: ... from here,
+ note: ... from here,
+ note: ... from here,
+ cwltool/software_requirements.py:32: note: ... from here:
bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/sphinxext/bokeh_color.py:45: note: In module imported here:
+ src/bokeh/core/serialization.py: note: In member "_encode_slice" of class "Serializer":
+ src/bokeh/core/serialization.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ src/bokeh/core/serialization.py: note: In member "_decode_slice" of class "Deserializer":
+ src/bokeh/core/serialization.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ src/bokeh/core/serialization.py: note: At top level:
cc @cdce8p I think the primer hits suggest a mypy bug where it looks up "_StartT" in the wrong scope.
cc @cdce8p I think the primer hits suggest a mypy bug where it looks up "_StartT" in the wrong scope.
Recursive TypeVar defaults was one of the things that didn't make it into 1.9.0 unfortunately. I did do some work on it already, but that isn't released yet: https://github.com/python/mypy/pull/16878. Don't know if it's enough for slice yet though.
If you're interested, maybe that's also something for @AlexWaygood, a few weeks back I created a custom repo to upload dev releases of mypy to PyPI under the mypy-dev project name. They always track a mypy commit upstream and are great to test / use the lasted version (even in production if you feel like it). mypy --version still works as expected. I originally created it as it was unclear when 1.9.0 would actually be released. In the past the release frequency was also a bit more unpredictable.
https://github.com/cdce8p/mypy-dev https://github.com/cdce8p/mypy-dev/releases
I just assumed my attempt at implementation was wrong and gave up. Should this be reopened, then?
Thanks @cdce8p, I forgot that PR didn't make it into 1.9. Hopefully we'll have another release soon. Your mypy-dev project is interesting; maybe that's even something we could do on mypy itself. For example, we could have a weekly cron job uploading alpha releases.
@Sachaa-Thanasius I think we may be able to merge this PR after mypy 1.10 is released (when that will happen, I don't know). You can leave it open in the meantime and mark it as deferred. With some hackery it may be possible to point typeshed's CI at the mypy master branch so we can test earlier whether everything works as expected.
Understood. Should slice be changed in the runtime cpython as well to support __class_getitem__ via GenericAlias, or is this purely meant to be a typeshed thing? Not something I considered when originally opening this, but now that this actually has a chance of going somewhere . . .
Also, sidenote: The pyright errors specifically for slice.stop and and the first overload of slice.__new__ (with text like the following) are the result of a bug that was fixed earlier today, I think:
Type parameter "_StopT" has a default type that refers to one or more type variables that are out of scope
Type variable "_StartT" is not in scope
Diff from mypy_primer, showing the effect of this PR on open source code:
vision (https://github.com/pytorch/vision)
+ torchvision/datasets/video_utils.py:94: error: Name "_StartT" is not defined [name-defined]
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice, /) -> tuple[Never, ...]
+ src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> tuple[Never, ...]
- src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice, /) -> Sequence[Never]
+ src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> Sequence[Never]
+ src/prefect/_vendor/starlette/datastructures.py:94: error: Name "_StartT" is not defined [name-defined]
- src/prefect/cli/deploy.py:1032: note: def __setitem__(self, slice, Iterable[dict[Any, Any]], /) -> None
+ src/prefect/cli/deploy.py:1032: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[dict[Any, Any]], /) -> None
- src/prefect/cli/deploy.py:1058: note: def __setitem__(self, slice, Iterable[dict[Any, Any]], /) -> None
+ src/prefect/cli/deploy.py:1058: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[dict[Any, Any]], /) -> None
- src/prefect/cli/deploy.py:1066: note: def __setitem__(self, slice, Iterable[dict[Any, Any]], /) -> None
+ src/prefect/cli/deploy.py:1066: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[dict[Any, Any]], /) -> None
- src/prefect/cli/deploy.py:1081: note: def __getitem__(self, slice, /) -> list[dict[Any, Any]]
+ src/prefect/cli/deploy.py:1081: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> list[dict[Any, Any]]
Expression (https://github.com/cognitedata/Expression)
+ expression/collections/block.py:94: error: Name "_StartT" is not defined [name-defined]
+ expression/collections/array.py:94: error: Name "_StartT" is not defined [name-defined]
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[int, _StartT?, int | None], /) -> list[Any]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/_typing.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/array_algos/transforms.py:41: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/array_algos/transforms.py:41: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/_libs/lib.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexers/utils.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/groupby/indexing.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/arrays/arrow/accessors.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/computation/expr.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/algorithms.py:1387: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1387: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1387: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1387: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1398: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1398: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1402: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1402: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1402: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1402: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/arrays/datetimelike.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/io/pytables.py:4877: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/html.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/series.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexing.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexing.py:2611: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/frame.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/internals/managers.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/internals/blocks.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/multi.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/interval.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/datetimelike.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/datetimelike.py:331: error: Argument 1 to "slice" has incompatible type "ndarray[Any, dtype[signedinteger[Any]]]"; expected "int" [arg-type]
+ pandas/core/indexes/base.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/groupby/groupby.py:5268: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/_libs/internals.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/groupby/ops.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/_testing/asserters.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/_libs/index.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/tests/extension/date/array.py:94: error: Name "_StartT" is not defined [name-defined]
kornia (https://github.com/kornia/kornia)
+ kornia/feature/adalam/ransac.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/contrib/models/sam/architecture/mask_decoder.py:92: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ kornia/geometry/vector.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/quaternion.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/boxes.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/so3.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/so2.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/se3.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/se2.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/keypoints.py:94: error: Name "_StartT" is not defined [name-defined]
tornado (https://github.com/tornadoweb/tornado)
+ tornado/template.py:94: error: Name "_StartT" is not defined [name-defined]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/web_routedef.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ aiohttp/web_request.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ aiohttp/web_request.py:612:22: error: Argument 1 to "slice" has incompatible type "Any | None"; expected "int" [arg-type]
+ aiohttp/web_fileresponse.py:255:36: error: If condition is always false [redundant-expr]
+ aiohttp/web_fileresponse.py:255:36: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-redundant-expr for more info
sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/util/_pathlib.py: note: In member "__getitem__" of class "_StrPath":
+ sphinx/util/_pathlib.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/builders/html/_assets.py: note: In member "__getitem__" of class "_CascadingStyleSheet":
+ sphinx/builders/html/_assets.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/builders/html/_assets.py: note: In member "__getitem__" of class "_JavaScript":
+ sphinx/builders/html/_assets.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/locale/__init__.py: note: In member "__getitem__" of class "_TranslationProxy":
+ sphinx/locale/__init__.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/builders/__init__.py:11: note: In module imported here:
+ sphinx/config.py: note: In member "__getitem__" of class "_Opt":
+ sphinx/config.py:94:36: error: Name "_StartT" is not defined [name-defined]
rich (https://github.com/Textualize/rich)
+ rich/containers.py:94: error: Name "_StartT" is not defined [name-defined]
+ rich/text.py:94: error: Name "_StartT" is not defined [name-defined]
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/_code/source.py:94: error: Name "_StartT" is not defined [name-defined]
+ src/_pytest/_code/code.py:94: error: Name "_StartT" is not defined [name-defined]
spack (https://github.com/spack/spack)
+ lib/spack/llnl/path.py:94: error: Name "_StartT" is not defined [name-defined]
more-itertools (https://github.com/more-itertools/more-itertools)
+ more_itertools/more.pyi:94: error: Name "_StartT" is not defined [name-defined]
psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/types/multirange.py:94: error: Name "_StartT" is not defined [name-defined]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/datastructures/mixins.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ src/werkzeug/datastructures/headers.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ src/werkzeug/datastructures/accept.pyi:94: error: Name "_StartT" is not defined [name-defined]
PyGithub (https://github.com/PyGithub/PyGithub)
+ github/PaginatedList.py:94: error: Name "_StartT" is not defined [name-defined]
starlette (https://github.com/encode/starlette)
+ starlette/datastructures.py:94: error: Name "_StartT" is not defined [name-defined]
kopf (https://github.com/nolar/kopf)
+ kopf/_cogs/structs/diffs.py:94: error: Name "_StartT" is not defined [name-defined]
spark (https://github.com/apache/spark)
+ python/pyspark/ml/linalg/__init__.py:94: error: Name "_StartT" is not defined [name-defined]
+ python/pyspark/mllib/linalg/__init__.py:94: error: Name "_StartT" is not defined [name-defined]
+ python/pyspark/pandas/indexing.py:94: error: Name "_StartT" is not defined [name-defined]
+ python/pyspark/pandas/indexing.py:1034: error: Incompatible types in assignment (expression has type "list[Any]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1035: error: Value of type "int" is not indexable [index]
+ python/pyspark/pandas/indexing.py:1035: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1092: error: Incompatible types in assignment (expression has type "tuple[int]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1093: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1103: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/namespace.py:94: error: Name "_StartT" is not defined [name-defined]
operator (https://github.com/canonical/operator)
- ops/framework.py:1284: note: def __getitem__(self, slice, /) -> MutableSequence[Any]
+ ops/framework.py:1284: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> MutableSequence[Any]
- ops/framework.py:1284: note: def __getitem__(self, slice, /) -> Sequence[Any]
+ ops/framework.py:1284: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> Sequence[Any]
- ops/framework.py:1287: note: def __setitem__(self, slice, Iterable[Any], /) -> None
+ ops/framework.py:1287: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[Any], /) -> None
- ops/framework.py:1291: note: def __delitem__(self, slice, /) -> None
+ ops/framework.py:1291: note: def __delitem__(self, slice[int, _StartT?, int | None], /) -> None
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ pandas-stubs/_typing.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/strings.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/series.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/frame.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/indexes/range.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/indexes/interval.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/indexes/base.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/groupby/groupby.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/groupby/generic.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/arrays/datetimelike.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/arrays/base.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ tests/test_frame.py:1928: error: Expression is of type "tuple[Index[int], slice[Any, Any, Any]]", not "tuple[Index[int], slice[int, _StartT?, int | None]]" [assert-type]
nionutils (https://github.com/nion-software/nionutils)
+ nion/utils/Geometry.py:94: error: Name "_StartT" is not defined [name-defined]
streamlit (https://github.com/streamlit/streamlit)
+ lib/tests/streamlit/runtime/caching/hashing_test.py:31: note: ... from here:
+ lib/streamlit/runtime/caching/__init__.py:20: note: ... from here:
+ lib/streamlit/testing/v1/element_tree.py: note: In function "__getitem__":
+ lib/streamlit/testing/v1/element_tree.py:94:36: error: Name "_StartT" is not defined [name-defined]
ibis (https://github.com/ibis-project/ibis)
+ ibis/util.py:94: error: Name "_StartT" is not defined [name-defined]
- ibis/util.py:654: error: Incompatible types in assignment (expression has type "Value", variable has type "int | None") [assignment]
+ ibis/util.py:643: error: Unsupported operand types for + ("IntegerScalar" and "int") [operator]
- ibis/util.py:655: error: Incompatible return value type (got "tuple[int | None, Any | int]", expected "tuple[int | IntegerScalar, int | IntegerScalar]") [return-value]
+ ibis/util.py:655: error: Incompatible return value type (got "tuple[int | None, int]", expected "tuple[int | IntegerScalar, int | IntegerScalar]") [return-value]
+ ibis/selectors.py:94: error: Name "_StartT" is not defined [name-defined]
- ibis/selectors.py:646: error: Item "slice" of "slice | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
+ ibis/selectors.py:646: error: Item "slice[int, _StartT?, int | None]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
- ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "start" [union-attr]
+ ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "start" [union-attr]
- ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "stop" [union-attr]
+ ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "stop" [union-attr]
- ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/expr/types/strings.py:94: error: Name "_StartT" is not defined [name-defined]
+ ibis/expr/types/arrays.py:94: error: Name "_StartT" is not defined [name-defined]
+ ibis/expr/types/arrays.py:145: error: Argument 2 to "ArraySlice" has incompatible type "int"; expected "Value[Integer, Any]" [arg-type]
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[int, _StartT?, int | None], /) -> 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[int, _StartT?, int | None], /) -> 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[int, _StartT?, int | None], /) -> list[Any]
jinja (https://github.com/pallets/jinja)
+ src/jinja2/nodes.py:94: error: Name "_StartT" is not defined [name-defined]
+ src/jinja2/nodes.py:893: error: Argument 1 to "slice" has incompatible type "Any | None"; expected "int" [arg-type]
jax (https://github.com/google/jax)
+ jax/_src/core.py:1874: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/fft.py:92: error: Argument 1 to "map" has incompatible type "type[slice[Any, Any, Any]]"; expected "Callable[[int], slice[Never, int, Never]]" [arg-type]
+ jax/_src/numpy/lax_numpy.py:365: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/lax_numpy.py:699: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/lax_numpy.py:699: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1980: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1981: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1985: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
discord.py (https://github.com/Rapptz/discord.py)
+ discord/utils.py:94: error: Name "_StartT" is not defined [name-defined]
- discord/http.py:228: note: def __setitem__(self, slice, Iterable[Embed], /) -> None
+ discord/http.py:228: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[Embed], /) -> None
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/cursor.py:94: error: Name "_StartT" is not defined [name-defined]
cwltool (https://github.com/common-workflow-language/cwltool)
+ note: In module imported here,
+ cwltool/cwlprov/writablebagfile.py:16: note: ... from here:
+ mypy-stubs/rdflib/graph.pyi: note: In member "__getitem__" of class "Graph":
+ mypy-stubs/rdflib/graph.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
+ cwltool/cwlrdf.py:6: note: In module imported here:
+ mypy-stubs/rdflib/query.pyi: note: In function "__getitem__":
+ mypy-stubs/rdflib/query.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
+ note: ... from here,
+ note: ... from here,
+ note: ... from here,
+ cwltool/software_requirements.py:32: note: ... from here:
schema_salad (https://github.com/common-workflow-language/schema_salad)
+ schema_salad/tests/test_misc.py:3: note: In module imported here:
+ mypy-stubs/rdflib/graph.pyi: note: In member "__getitem__" of class "Graph":
+ mypy-stubs/rdflib/graph.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
+ mypy-stubs/rdflib/graph.pyi:15: note: In module imported here,
+ schema_salad/tests/test_misc.py:3: note: ... from here:
+ mypy-stubs/rdflib/query.pyi: note: In function "__getitem__":
+ mypy-stubs/rdflib/query.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/sphinxext/bokeh_color.py:45: note: In module imported here:
+ src/bokeh/core/serialization.py: note: In member "_encode_slice" of class "Serializer":
+ src/bokeh/core/serialization.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ src/bokeh/core/serialization.py: note: In member "_decode_slice" of class "Deserializer":
+ src/bokeh/core/serialization.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ src/bokeh/core/serialization.py: note: At top level:
With some hackery it may be possible to point typeshed's CI at the mypy master branch so we can test earlier whether everything works as expected.
@Sachaa-Thanasius You could try to replace the mypy version listed in requirements-tests.txt.
https://github.com/python/typeshed/blob/5c75292f26aec8e6348a17d32077f408a1337988/requirements-tests.txt#L8
-mypy==1.9.0
+mypy-dev==1.10.0a2
That release tracks https://github.com/python/mypy/commit/b013cc016a3e3c8c7caa6a27bdf7b5e22998dd41 which was commited fairly recently to mypy master (5 days ago).
Update: Seems like the mypy primer doesn't work for it, unfortunately.
Diff from mypy_primer, showing the effect of this PR on open source code:
vision (https://github.com/pytorch/vision)
+ torchvision/datasets/video_utils.py:94: error: Name "_StartT" is not defined [name-defined]
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice, /) -> tuple[Never, ...]
+ src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> tuple[Never, ...]
- src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice, /) -> Sequence[Never]
+ src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> Sequence[Never]
+ src/prefect/_vendor/starlette/datastructures.py:94: error: Name "_StartT" is not defined [name-defined]
- src/prefect/cli/deploy.py:1032: note: def __setitem__(self, slice, Iterable[dict[Any, Any]], /) -> None
+ src/prefect/cli/deploy.py:1032: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[dict[Any, Any]], /) -> None
- src/prefect/cli/deploy.py:1058: note: def __setitem__(self, slice, Iterable[dict[Any, Any]], /) -> None
+ src/prefect/cli/deploy.py:1058: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[dict[Any, Any]], /) -> None
- src/prefect/cli/deploy.py:1066: note: def __setitem__(self, slice, Iterable[dict[Any, Any]], /) -> None
+ src/prefect/cli/deploy.py:1066: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[dict[Any, Any]], /) -> None
- src/prefect/cli/deploy.py:1081: note: def __getitem__(self, slice, /) -> list[dict[Any, Any]]
+ src/prefect/cli/deploy.py:1081: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> list[dict[Any, Any]]
Expression (https://github.com/cognitedata/Expression)
+ expression/collections/block.py:94: error: Name "_StartT" is not defined [name-defined]
+ expression/collections/array.py:94: error: Name "_StartT" is not defined [name-defined]
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[int, _StartT?, int | None], /) -> list[Any]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/_typing.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/array_algos/transforms.py:41: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/array_algos/transforms.py:41: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/_libs/lib.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexers/utils.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/groupby/indexing.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/arrays/arrow/accessors.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/computation/expr.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/algorithms.py:1387: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1387: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1387: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1387: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1398: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1398: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1402: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1402: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1402: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1402: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/arrays/datetimelike.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/io/pytables.py:4877: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/html.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/series.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexing.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexing.py:2611: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/frame.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/internals/managers.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/internals/blocks.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/multi.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/interval.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/datetimelike.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/datetimelike.py:331: error: Argument 1 to "slice" has incompatible type "ndarray[Any, dtype[signedinteger[Any]]]"; expected "int" [arg-type]
+ pandas/core/indexes/base.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/groupby/groupby.py:5268: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/_libs/internals.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/groupby/ops.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/_testing/asserters.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/_libs/index.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/tests/extension/date/array.py:94: error: Name "_StartT" is not defined [name-defined]
kornia (https://github.com/kornia/kornia)
+ kornia/feature/adalam/ransac.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/contrib/models/sam/architecture/mask_decoder.py:92: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ kornia/geometry/vector.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/quaternion.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/boxes.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/so3.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/so2.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/se3.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/se2.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/keypoints.py:94: error: Name "_StartT" is not defined [name-defined]
tornado (https://github.com/tornadoweb/tornado)
+ tornado/template.py:94: error: Name "_StartT" is not defined [name-defined]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/web_routedef.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ aiohttp/web_request.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ aiohttp/web_request.py:612:22: error: Argument 1 to "slice" has incompatible type "Any | None"; expected "int" [arg-type]
+ aiohttp/web_fileresponse.py:255:36: error: If condition is always false [redundant-expr]
+ aiohttp/web_fileresponse.py:255:36: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-redundant-expr for more info
sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/util/_pathlib.py: note: In member "__getitem__" of class "_StrPath":
+ sphinx/util/_pathlib.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/builders/html/_assets.py: note: In member "__getitem__" of class "_CascadingStyleSheet":
+ sphinx/builders/html/_assets.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/builders/html/_assets.py: note: In member "__getitem__" of class "_JavaScript":
+ sphinx/builders/html/_assets.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/locale/__init__.py: note: In member "__getitem__" of class "_TranslationProxy":
+ sphinx/locale/__init__.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/builders/__init__.py:11: note: In module imported here:
+ sphinx/config.py: note: In member "__getitem__" of class "_Opt":
+ sphinx/config.py:94:36: error: Name "_StartT" is not defined [name-defined]
rich (https://github.com/Textualize/rich)
+ rich/containers.py:94: error: Name "_StartT" is not defined [name-defined]
+ rich/text.py:94: error: Name "_StartT" is not defined [name-defined]
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/_code/source.py:94: error: Name "_StartT" is not defined [name-defined]
+ src/_pytest/_code/code.py:94: error: Name "_StartT" is not defined [name-defined]
spack (https://github.com/spack/spack)
+ lib/spack/llnl/path.py:94: error: Name "_StartT" is not defined [name-defined]
more-itertools (https://github.com/more-itertools/more-itertools)
+ more_itertools/more.pyi:94: error: Name "_StartT" is not defined [name-defined]
psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/types/multirange.py:94: error: Name "_StartT" is not defined [name-defined]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/datastructures/mixins.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ src/werkzeug/datastructures/headers.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ src/werkzeug/datastructures/accept.pyi:94: error: Name "_StartT" is not defined [name-defined]
PyGithub (https://github.com/PyGithub/PyGithub)
+ github/PaginatedList.py:94: error: Name "_StartT" is not defined [name-defined]
kopf (https://github.com/nolar/kopf)
+ kopf/_cogs/structs/diffs.py:94: error: Name "_StartT" is not defined [name-defined]
starlette (https://github.com/encode/starlette)
+ starlette/datastructures.py:94: error: Name "_StartT" is not defined [name-defined]
spark (https://github.com/apache/spark)
+ python/pyspark/ml/linalg/__init__.py:94: error: Name "_StartT" is not defined [name-defined]
+ python/pyspark/mllib/linalg/__init__.py:94: error: Name "_StartT" is not defined [name-defined]
+ python/pyspark/pandas/indexing.py:94: error: Name "_StartT" is not defined [name-defined]
+ python/pyspark/pandas/indexing.py:1034: error: Incompatible types in assignment (expression has type "list[Any]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1035: error: Value of type "int" is not indexable [index]
+ python/pyspark/pandas/indexing.py:1035: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1092: error: Incompatible types in assignment (expression has type "tuple[int]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1093: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1103: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/namespace.py:94: error: Name "_StartT" is not defined [name-defined]
operator (https://github.com/canonical/operator)
- ops/framework.py:1284: note: def __getitem__(self, slice, /) -> MutableSequence[Any]
+ ops/framework.py:1284: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> MutableSequence[Any]
- ops/framework.py:1284: note: def __getitem__(self, slice, /) -> Sequence[Any]
+ ops/framework.py:1284: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> Sequence[Any]
- ops/framework.py:1287: note: def __setitem__(self, slice, Iterable[Any], /) -> None
+ ops/framework.py:1287: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[Any], /) -> None
- ops/framework.py:1291: note: def __delitem__(self, slice, /) -> None
+ ops/framework.py:1291: note: def __delitem__(self, slice[int, _StartT?, int | None], /) -> None
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ pandas-stubs/_typing.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/strings.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/series.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/frame.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/indexes/range.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/indexes/interval.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/indexes/base.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/groupby/groupby.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/groupby/generic.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/arrays/datetimelike.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/arrays/base.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ tests/test_frame.py:1946: error: Expression is of type "tuple[Index[int], slice[Any, Any, Any]]", not "tuple[Index[int], slice[int, _StartT?, int | None]]" [assert-type]
nionutils (https://github.com/nion-software/nionutils)
+ nion/utils/Geometry.py:94: error: Name "_StartT" is not defined [name-defined]
streamlit (https://github.com/streamlit/streamlit)
+ lib/tests/streamlit/runtime/caching/hashing_test.py:31: note: ... from here:
+ lib/streamlit/runtime/caching/__init__.py:20: note: ... from here:
+ lib/streamlit/testing/v1/element_tree.py: note: In function "__getitem__":
+ lib/streamlit/testing/v1/element_tree.py:94:36: error: Name "_StartT" is not defined [name-defined]
jinja (https://github.com/pallets/jinja)
+ src/jinja2/nodes.py:94: error: Name "_StartT" is not defined [name-defined]
+ src/jinja2/nodes.py:893: error: Argument 1 to "slice" has incompatible type "Any | None"; expected "int" [arg-type]
ibis (https://github.com/ibis-project/ibis)
+ ibis/util.py:94: error: Name "_StartT" is not defined [name-defined]
- ibis/util.py:654: error: Incompatible types in assignment (expression has type "Value", variable has type "int | None") [assignment]
+ ibis/util.py:643: error: Unsupported operand types for + ("IntegerScalar" and "int") [operator]
- ibis/util.py:655: error: Incompatible return value type (got "tuple[int | None, Any | int]", expected "tuple[int | IntegerScalar, int | IntegerScalar]") [return-value]
+ ibis/util.py:655: error: Incompatible return value type (got "tuple[int | None, int]", expected "tuple[int | IntegerScalar, int | IntegerScalar]") [return-value]
+ ibis/selectors.py:94: error: Name "_StartT" is not defined [name-defined]
- ibis/selectors.py:646: error: Item "slice" of "slice | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
+ ibis/selectors.py:646: error: Item "slice[int, _StartT?, int | None]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
- ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "start" [union-attr]
+ ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "start" [union-attr]
- ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "stop" [union-attr]
+ ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "stop" [union-attr]
- ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/expr/types/strings.py:94: error: Name "_StartT" is not defined [name-defined]
+ ibis/expr/types/arrays.py:94: error: Name "_StartT" is not defined [name-defined]
+ ibis/expr/types/arrays.py:145: error: Argument 2 to "ArraySlice" has incompatible type "int"; expected "Value[Integer, Any]" [arg-type]
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[int, _StartT?, int | None], /) -> 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[int, _StartT?, int | None], /) -> 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[int, _StartT?, int | None], /) -> list[Any]
jax (https://github.com/google/jax)
+ jax/_src/core.py:1874: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/fft.py:92: error: Argument 1 to "map" has incompatible type "type[slice[Any, Any, Any]]"; expected "Callable[[int], slice[Never, int, Never]]" [arg-type]
+ jax/_src/numpy/lax_numpy.py:365: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/lax_numpy.py:699: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/lax_numpy.py:699: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1980: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1981: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1985: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/cursor.py:94: error: Name "_StartT" is not defined [name-defined]
discord.py (https://github.com/Rapptz/discord.py)
+ discord/utils.py:94: error: Name "_StartT" is not defined [name-defined]
- discord/http.py:228: note: def __setitem__(self, slice, Iterable[Embed], /) -> None
+ discord/http.py:228: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[Embed], /) -> None
schema_salad (https://github.com/common-workflow-language/schema_salad)
+ schema_salad/tests/test_misc.py:3: note: In module imported here:
+ mypy-stubs/rdflib/graph.pyi: note: In member "__getitem__" of class "Graph":
+ mypy-stubs/rdflib/graph.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
+ mypy-stubs/rdflib/graph.pyi:15: note: In module imported here,
+ schema_salad/tests/test_misc.py:3: note: ... from here:
+ mypy-stubs/rdflib/query.pyi: note: In function "__getitem__":
+ mypy-stubs/rdflib/query.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
cwltool (https://github.com/common-workflow-language/cwltool)
+ note: In module imported here,
+ cwltool/cwlprov/writablebagfile.py:16: note: ... from here:
+ mypy-stubs/rdflib/graph.pyi: note: In member "__getitem__" of class "Graph":
+ mypy-stubs/rdflib/graph.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
+ cwltool/cwlrdf.py:6: note: In module imported here:
+ mypy-stubs/rdflib/query.pyi: note: In function "__getitem__":
+ mypy-stubs/rdflib/query.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
+ note: ... from here,
+ note: ... from here,
+ note: ... from here,
+ cwltool/software_requirements.py:32: note: ... from here:
bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/sphinxext/bokeh_color.py:45: note: In module imported here:
+ src/bokeh/core/serialization.py: note: In member "_encode_slice" of class "Serializer":
+ src/bokeh/core/serialization.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ src/bokeh/core/serialization.py: note: In member "_decode_slice" of class "Deserializer":
+ src/bokeh/core/serialization.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ src/bokeh/core/serialization.py: note: At top level:
Diff from mypy_primer, showing the effect of this PR on open source code:
vision (https://github.com/pytorch/vision)
+ torchvision/datasets/video_utils.py:94: error: Name "_StartT" is not defined [name-defined]
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice, /) -> tuple[Never, ...]
+ src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> tuple[Never, ...]
- src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice, /) -> Sequence[Never]
+ src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> Sequence[Never]
+ src/prefect/_vendor/starlette/datastructures.py:94: error: Name "_StartT" is not defined [name-defined]
- src/prefect/cli/cloud/__init__.py:491: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice" [index]
+ src/prefect/cli/cloud/__init__.py:491: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[int, _StartT?, int | None]" [index]
- src/prefect/cli/cloud/__init__.py:659: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice" [index]
+ src/prefect/cli/cloud/__init__.py:659: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[int, _StartT?, int | None]" [index]
- src/prefect/cli/deploy.py:1032: note: def __setitem__(self, slice, Iterable[dict[Any, Any]], /) -> None
+ src/prefect/cli/deploy.py:1032: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[dict[Any, Any]], /) -> None
- src/prefect/cli/deploy.py:1058: note: def __setitem__(self, slice, Iterable[dict[Any, Any]], /) -> None
+ src/prefect/cli/deploy.py:1058: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[dict[Any, Any]], /) -> None
- src/prefect/cli/deploy.py:1066: note: def __setitem__(self, slice, Iterable[dict[Any, Any]], /) -> None
+ src/prefect/cli/deploy.py:1066: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[dict[Any, Any]], /) -> None
- src/prefect/cli/deploy.py:1081: note: def __getitem__(self, slice, /) -> list[dict[Any, Any]]
+ src/prefect/cli/deploy.py:1081: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> list[dict[Any, Any]]
Expression (https://github.com/cognitedata/Expression)
+ expression/collections/block.py:94: error: Name "_StartT" is not defined [name-defined]
+ expression/collections/array.py:94: error: Name "_StartT" is not defined [name-defined]
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[int, _StartT?, int | None], /) -> list[Any]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/_typing.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/array_algos/transforms.py:41: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/array_algos/transforms.py:41: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/_libs/lib.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexers/utils.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/groupby/indexing.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/arrays/arrow/accessors.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/computation/expr.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/algorithms.py:1387: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1387: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1387: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1387: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1398: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1398: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1402: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1402: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1402: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1402: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/arrays/datetimelike.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/io/pytables.py:4877: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/html.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/series.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexing.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexing.py:2611: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/frame.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/internals/managers.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/internals/blocks.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/multi.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/interval.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/datetimelike.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/datetimelike.py:331: error: Argument 1 to "slice" has incompatible type "ndarray[Any, dtype[signedinteger[Any]]]"; expected "int" [arg-type]
+ pandas/core/indexes/base.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/groupby/groupby.py:5268: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/_libs/internals.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/groupby/ops.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/_testing/asserters.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/_libs/index.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/tests/extension/date/array.py:94: error: Name "_StartT" is not defined [name-defined]
kornia (https://github.com/kornia/kornia)
+ kornia/feature/adalam/ransac.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/contrib/models/sam/architecture/mask_decoder.py:92: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ kornia/geometry/vector.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/quaternion.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/boxes.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/so3.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/so2.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/se3.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/se2.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/keypoints.py:94: error: Name "_StartT" is not defined [name-defined]
tornado (https://github.com/tornadoweb/tornado)
+ tornado/template.py:94: error: Name "_StartT" is not defined [name-defined]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/web_routedef.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ aiohttp/web_request.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ aiohttp/web_request.py:612:22: error: Argument 1 to "slice" has incompatible type "Any | None"; expected "int" [arg-type]
+ aiohttp/web_fileresponse.py:255:36: error: If condition is always false [redundant-expr]
+ aiohttp/web_fileresponse.py:255:36: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-redundant-expr for more info
sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/util/_pathlib.py: note: In member "__getitem__" of class "_StrPath":
+ sphinx/util/_pathlib.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/builders/html/_assets.py: note: In member "__getitem__" of class "_CascadingStyleSheet":
+ sphinx/builders/html/_assets.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/builders/html/_assets.py: note: In member "__getitem__" of class "_JavaScript":
+ sphinx/builders/html/_assets.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/locale/__init__.py: note: In member "__getitem__" of class "_TranslationProxy":
+ sphinx/locale/__init__.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/builders/__init__.py:11: note: In module imported here:
+ sphinx/config.py: note: In member "__getitem__" of class "_Opt":
+ sphinx/config.py:94:36: error: Name "_StartT" is not defined [name-defined]
rich (https://github.com/Textualize/rich)
+ rich/containers.py:94: error: Name "_StartT" is not defined [name-defined]
+ rich/text.py:94: error: Name "_StartT" is not defined [name-defined]
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/_code/source.py:94: error: Name "_StartT" is not defined [name-defined]
+ src/_pytest/_code/code.py:94: error: Name "_StartT" is not defined [name-defined]
spack (https://github.com/spack/spack)
+ lib/spack/llnl/path.py:94: error: Name "_StartT" is not defined [name-defined]
more-itertools (https://github.com/more-itertools/more-itertools)
+ more_itertools/more.pyi:94: error: Name "_StartT" is not defined [name-defined]
psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/types/multirange.py:94: error: Name "_StartT" is not defined [name-defined]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/datastructures/mixins.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ src/werkzeug/datastructures/headers.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ src/werkzeug/datastructures/accept.pyi:94: error: Name "_StartT" is not defined [name-defined]
PyGithub (https://github.com/PyGithub/PyGithub)
+ github/PaginatedList.py:94: error: Name "_StartT" is not defined [name-defined]
starlette (https://github.com/encode/starlette)
+ starlette/datastructures.py:94: error: Name "_StartT" is not defined [name-defined]
kopf (https://github.com/nolar/kopf)
+ kopf/_cogs/structs/diffs.py:94: error: Name "_StartT" is not defined [name-defined]
spark (https://github.com/apache/spark)
+ python/pyspark/ml/linalg/__init__.py:94: error: Name "_StartT" is not defined [name-defined]
+ python/pyspark/mllib/linalg/__init__.py:94: error: Name "_StartT" is not defined [name-defined]
+ python/pyspark/pandas/indexing.py:94: error: Name "_StartT" is not defined [name-defined]
+ python/pyspark/pandas/indexing.py:1034: error: Incompatible types in assignment (expression has type "list[Any]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1035: error: Value of type "int" is not indexable [index]
+ python/pyspark/pandas/indexing.py:1035: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1092: error: Incompatible types in assignment (expression has type "tuple[int]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1093: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1103: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/namespace.py:94: error: Name "_StartT" is not defined [name-defined]
operator (https://github.com/canonical/operator)
- ops/framework.py:1284: note: def __getitem__(self, slice, /) -> MutableSequence[Any]
+ ops/framework.py:1284: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> MutableSequence[Any]
- ops/framework.py:1284: note: def __getitem__(self, slice, /) -> Sequence[Any]
+ ops/framework.py:1284: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> Sequence[Any]
- ops/framework.py:1287: note: def __setitem__(self, slice, Iterable[Any], /) -> None
+ ops/framework.py:1287: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[Any], /) -> None
- ops/framework.py:1291: note: def __delitem__(self, slice, /) -> None
+ ops/framework.py:1291: note: def __delitem__(self, slice[int, _StartT?, int | None], /) -> None
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ pandas-stubs/_typing.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/strings.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/series.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/frame.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/indexes/range.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/indexes/interval.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/indexes/base.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/groupby/groupby.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/groupby/generic.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/arrays/datetimelike.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/arrays/base.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ tests/test_frame.py:1946: error: Expression is of type "tuple[Index[int], slice[Any, Any, Any]]", not "tuple[Index[int], slice[int, _StartT?, int | None]]" [assert-type]
nionutils (https://github.com/nion-software/nionutils)
+ nion/utils/Geometry.py:94: error: Name "_StartT" is not defined [name-defined]
streamlit (https://github.com/streamlit/streamlit)
+ lib/tests/streamlit/runtime/caching/hashing_test.py:31: note: ... from here:
+ lib/streamlit/runtime/caching/__init__.py:20: note: ... from here:
+ lib/streamlit/testing/v1/element_tree.py: note: In function "__getitem__":
+ lib/streamlit/testing/v1/element_tree.py:94:36: error: Name "_StartT" is not defined [name-defined]
jinja (https://github.com/pallets/jinja)
+ src/jinja2/nodes.py:94: error: Name "_StartT" is not defined [name-defined]
+ src/jinja2/nodes.py:893: error: Argument 1 to "slice" has incompatible type "Any | None"; expected "int" [arg-type]
ibis (https://github.com/ibis-project/ibis)
+ ibis/util.py:94: error: Name "_StartT" is not defined [name-defined]
- ibis/util.py:654: error: Incompatible types in assignment (expression has type "Value", variable has type "int | None") [assignment]
+ ibis/util.py:643: error: Unsupported operand types for + ("IntegerScalar" and "int") [operator]
- ibis/util.py:655: error: Incompatible return value type (got "tuple[int | None, Any | int]", expected "tuple[int | IntegerScalar, int | IntegerScalar]") [return-value]
+ ibis/util.py:655: error: Incompatible return value type (got "tuple[int | None, int]", expected "tuple[int | IntegerScalar, int | IntegerScalar]") [return-value]
+ ibis/selectors.py:94: error: Name "_StartT" is not defined [name-defined]
- ibis/selectors.py:646: error: Item "slice" of "slice | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
+ ibis/selectors.py:646: error: Item "slice[int, _StartT?, int | None]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
- ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "start" [union-attr]
+ ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "start" [union-attr]
- ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "stop" [union-attr]
+ ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "stop" [union-attr]
- ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/expr/types/strings.py:94: error: Name "_StartT" is not defined [name-defined]
+ ibis/expr/types/arrays.py:94: error: Name "_StartT" is not defined [name-defined]
+ ibis/expr/types/arrays.py:145: error: Argument 2 to "ArraySlice" has incompatible type "int"; expected "Value[Integer, Any]" [arg-type]
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[int, _StartT?, int | None], /) -> 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[int, _StartT?, int | None], /) -> 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[int, _StartT?, int | None], /) -> list[Any]
jax (https://github.com/google/jax)
+ jax/_src/core.py:1878: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/fft.py:92: error: Argument 1 to "map" has incompatible type "type[slice[Any, Any, Any]]"; expected "Callable[[int], slice[Never, int, Never]]" [arg-type]
+ jax/_src/numpy/lax_numpy.py:365: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/lax_numpy.py:699: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/lax_numpy.py:699: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1980: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1981: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1985: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
discord.py (https://github.com/Rapptz/discord.py)
+ discord/utils.py:94: error: Name "_StartT" is not defined [name-defined]
- discord/http.py:228: note: def __setitem__(self, slice, Iterable[Embed], /) -> None
+ discord/http.py:228: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[Embed], /) -> None
cwltool (https://github.com/common-workflow-language/cwltool)
+ note: In module imported here,
+ cwltool/cwlprov/writablebagfile.py:16: note: ... from here:
+ mypy-stubs/rdflib/graph.pyi: note: In member "__getitem__" of class "Graph":
+ mypy-stubs/rdflib/graph.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
+ cwltool/cwlrdf.py:6: note: In module imported here:
+ mypy-stubs/rdflib/query.pyi: note: In function "__getitem__":
+ mypy-stubs/rdflib/query.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
+ note: ... from here,
+ note: ... from here,
+ note: ... from here,
+ cwltool/software_requirements.py:32: note: ... from here:
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/cursor.py:94: error: Name "_StartT" is not defined [name-defined]
schema_salad (https://github.com/common-workflow-language/schema_salad)
+ schema_salad/tests/test_misc.py:3: note: In module imported here:
+ mypy-stubs/rdflib/graph.pyi: note: In member "__getitem__" of class "Graph":
+ mypy-stubs/rdflib/graph.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
+ mypy-stubs/rdflib/graph.pyi:15: note: In module imported here,
+ schema_salad/tests/test_misc.py:3: note: ... from here:
+ mypy-stubs/rdflib/query.pyi: note: In function "__getitem__":
+ mypy-stubs/rdflib/query.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/sphinxext/bokeh_color.py:45: note: In module imported here:
+ src/bokeh/core/serialization.py: note: In member "_encode_slice" of class "Serializer":
+ src/bokeh/core/serialization.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ src/bokeh/core/serialization.py: note: In member "_decode_slice" of class "Deserializer":
+ src/bokeh/core/serialization.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ src/bokeh/core/serialization.py: note: At top level:
Diff from mypy_primer, showing the effect of this PR on open source code:
vision (https://github.com/pytorch/vision)
+ torchvision/datasets/video_utils.py:94: error: Name "_StartT" is not defined [name-defined]
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice, /) -> tuple[Never, ...]
+ src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> tuple[Never, ...]
- src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice, /) -> Sequence[Never]
+ src/prefect/utilities/annotations.py:48: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> Sequence[Never]
+ src/prefect/_vendor/starlette/datastructures.py:94: error: Name "_StartT" is not defined [name-defined]
- src/prefect/cli/cloud/__init__.py:491: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice" [index]
+ src/prefect/cli/cloud/__init__.py:491: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[int, _StartT?, int | None]" [index]
- src/prefect/cli/cloud/__init__.py:659: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice" [index]
+ src/prefect/cli/cloud/__init__.py:659: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[int, _StartT?, int | None]" [index]
- src/prefect/cli/deploy.py:1039: note: def __setitem__(self, slice, Iterable[dict[Any, Any]], /) -> None
+ src/prefect/cli/deploy.py:1039: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[dict[Any, Any]], /) -> None
- src/prefect/cli/deploy.py:1065: note: def __setitem__(self, slice, Iterable[dict[Any, Any]], /) -> None
+ src/prefect/cli/deploy.py:1065: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[dict[Any, Any]], /) -> None
- src/prefect/cli/deploy.py:1073: note: def __setitem__(self, slice, Iterable[dict[Any, Any]], /) -> None
+ src/prefect/cli/deploy.py:1073: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[dict[Any, Any]], /) -> None
- src/prefect/cli/deploy.py:1088: note: def __getitem__(self, slice, /) -> list[dict[Any, Any]]
+ src/prefect/cli/deploy.py:1088: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> list[dict[Any, Any]]
Expression (https://github.com/cognitedata/Expression)
+ expression/collections/block.py:94: error: Name "_StartT" is not defined [name-defined]
+ expression/collections/array.py:94: error: Name "_StartT" is not defined [name-defined]
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[int, _StartT?, int | None], /) -> list[Any]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/_typing.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/array_algos/transforms.py:41: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/array_algos/transforms.py:41: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/_libs/lib.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexers/utils.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/groupby/indexing.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/arrays/arrow/accessors.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/computation/expr.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/algorithms.py:1371: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1371: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1371: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1371: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1382: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1382: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1386: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1386: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1386: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1386: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/arrays/datetimelike.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/io/pytables.py:4877: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/html.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/series.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexing.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexing.py:2611: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/frame.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/internals/managers.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/internals/blocks.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/multi.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/interval.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/datetimelike.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/indexes/datetimelike.py:331: error: Argument 1 to "slice" has incompatible type "ndarray[Any, dtype[signedinteger[Any]]]"; expected "int" [arg-type]
+ pandas/core/indexes/base.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/groupby/groupby.py:5269: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/_libs/internals.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/core/groupby/ops.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/_testing/asserters.py:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/_libs/index.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas/tests/extension/date/array.py:94: error: Name "_StartT" is not defined [name-defined]
kornia (https://github.com/kornia/kornia)
+ kornia/feature/adalam/ransac.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/contrib/models/sam/architecture/mask_decoder.py:92: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ kornia/geometry/vector.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/quaternion.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/boxes.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/so3.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/so2.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/se3.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/liegroup/se2.py:94: error: Name "_StartT" is not defined [name-defined]
+ kornia/geometry/keypoints.py:94: error: Name "_StartT" is not defined [name-defined]
tornado (https://github.com/tornadoweb/tornado)
+ tornado/template.py:94: error: Name "_StartT" is not defined [name-defined]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/web_routedef.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ aiohttp/web_request.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ aiohttp/web_request.py:612:22: error: Argument 1 to "slice" has incompatible type "Any | None"; expected "int" [arg-type]
+ aiohttp/web_fileresponse.py:255:36: error: If condition is always false [redundant-expr]
+ aiohttp/web_fileresponse.py:255:36: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-redundant-expr for more info
sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/util/_pathlib.py: note: In member "__getitem__" of class "_StrPath":
+ sphinx/util/_pathlib.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/builders/html/_assets.py: note: In member "__getitem__" of class "_CascadingStyleSheet":
+ sphinx/builders/html/_assets.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/builders/html/_assets.py: note: In member "__getitem__" of class "_JavaScript":
+ sphinx/builders/html/_assets.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/locale/__init__.py: note: In member "__getitem__" of class "_TranslationProxy":
+ sphinx/locale/__init__.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ sphinx/builders/__init__.py:11: note: In module imported here:
+ sphinx/config.py: note: In member "__getitem__" of class "_Opt":
+ sphinx/config.py:94:36: error: Name "_StartT" is not defined [name-defined]
rich (https://github.com/Textualize/rich)
+ rich/containers.py:94: error: Name "_StartT" is not defined [name-defined]
+ rich/text.py:94: error: Name "_StartT" is not defined [name-defined]
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/_code/source.py:94: error: Name "_StartT" is not defined [name-defined]
+ src/_pytest/_code/code.py:94: error: Name "_StartT" is not defined [name-defined]
spack (https://github.com/spack/spack)
+ lib/spack/llnl/path.py:94: error: Name "_StartT" is not defined [name-defined]
more-itertools (https://github.com/more-itertools/more-itertools)
+ more_itertools/more.pyi:94: error: Name "_StartT" is not defined [name-defined]
psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/types/multirange.py:94: error: Name "_StartT" is not defined [name-defined]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/datastructures/mixins.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ src/werkzeug/datastructures/headers.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ src/werkzeug/datastructures/accept.pyi:94: error: Name "_StartT" is not defined [name-defined]
PyGithub (https://github.com/PyGithub/PyGithub)
+ github/PaginatedList.py:94: error: Name "_StartT" is not defined [name-defined]
starlette (https://github.com/encode/starlette)
+ starlette/datastructures.py:94: error: Name "_StartT" is not defined [name-defined]
kopf (https://github.com/nolar/kopf)
+ kopf/_cogs/structs/diffs.py:94: error: Name "_StartT" is not defined [name-defined]
spark (https://github.com/apache/spark)
+ python/pyspark/ml/linalg/__init__.py:94: error: Name "_StartT" is not defined [name-defined]
+ python/pyspark/mllib/linalg/__init__.py:94: error: Name "_StartT" is not defined [name-defined]
+ python/pyspark/pandas/indexing.py:94: error: Name "_StartT" is not defined [name-defined]
+ python/pyspark/pandas/indexing.py:1034: error: Incompatible types in assignment (expression has type "list[Any]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1035: error: Value of type "int" is not indexable [index]
+ python/pyspark/pandas/indexing.py:1035: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1092: error: Incompatible types in assignment (expression has type "tuple[int]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1093: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1103: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/namespace.py:94: error: Name "_StartT" is not defined [name-defined]
operator (https://github.com/canonical/operator)
- ops/framework.py:1281: note: def __getitem__(self, slice, /) -> MutableSequence[Any]
+ ops/framework.py:1281: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> MutableSequence[Any]
- ops/framework.py:1281: note: def __getitem__(self, slice, /) -> Sequence[Any]
+ ops/framework.py:1281: note: def __getitem__(self, slice[int, _StartT?, int | None], /) -> Sequence[Any]
- ops/framework.py:1284: note: def __setitem__(self, slice, Iterable[Any], /) -> None
+ ops/framework.py:1284: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[Any], /) -> None
- ops/framework.py:1288: note: def __delitem__(self, slice, /) -> None
+ ops/framework.py:1288: note: def __delitem__(self, slice[int, _StartT?, int | None], /) -> None
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ pandas-stubs/_typing.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/strings.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/series.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/frame.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/indexes/range.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/indexes/interval.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/indexes/base.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/groupby/groupby.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/groupby/generic.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/arrays/datetimelike.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ pandas-stubs/core/arrays/base.pyi:94: error: Name "_StartT" is not defined [name-defined]
+ tests/test_frame.py:1946: error: Expression is of type "tuple[Index[int], slice[Any, Any, Any]]", not "tuple[Index[int], slice[int, _StartT?, int | None]]" [assert-type]
nionutils (https://github.com/nion-software/nionutils)
+ nion/utils/Geometry.py:94: error: Name "_StartT" is not defined [name-defined]
streamlit (https://github.com/streamlit/streamlit)
+ lib/tests/streamlit/runtime/caching/hashing_test.py:31: note: ... from here:
+ lib/streamlit/runtime/caching/__init__.py:20: note: ... from here:
+ lib/streamlit/testing/v1/element_tree.py: note: In function "__getitem__":
+ lib/streamlit/testing/v1/element_tree.py:94:36: error: Name "_StartT" is not defined [name-defined]
jinja (https://github.com/pallets/jinja)
+ src/jinja2/nodes.py:94: error: Name "_StartT" is not defined [name-defined]
+ src/jinja2/nodes.py:893: error: Argument 1 to "slice" has incompatible type "Any | None"; expected "int" [arg-type]
ibis (https://github.com/ibis-project/ibis)
+ ibis/util.py:94: error: Name "_StartT" is not defined [name-defined]
- ibis/util.py:602: error: Incompatible types in assignment (expression has type "Value", variable has type "int | None") [assignment]
+ ibis/util.py:591: error: Unsupported operand types for + ("IntegerScalar" and "int") [operator]
- ibis/util.py:603: error: Incompatible return value type (got "tuple[int | None, Any | int]", expected "tuple[int | IntegerScalar, int | IntegerScalar]") [return-value]
+ ibis/util.py:603: error: Incompatible return value type (got "tuple[int | None, int]", expected "tuple[int | IntegerScalar, int | IntegerScalar]") [return-value]
+ ibis/selectors.py:94: error: Name "_StartT" is not defined [name-defined]
- ibis/selectors.py:646: error: Item "slice" of "slice | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
+ ibis/selectors.py:646: error: Item "slice[int, _StartT?, int | None]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
- ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "start" [union-attr]
+ ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "start" [union-attr]
- ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "stop" [union-attr]
+ ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "stop" [union-attr]
- ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice[int, _StartT?, int | None] | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/expr/types/strings.py:94: error: Name "_StartT" is not defined [name-defined]
+ ibis/expr/types/arrays.py:94: error: Name "_StartT" is not defined [name-defined]
+ ibis/expr/types/arrays.py:145: error: Argument 2 to "ArraySlice" has incompatible type "int"; expected "Value[Integer, Any]" [arg-type]
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[int, _StartT?, int | None], /) -> 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[int, _StartT?, int | None], /) -> 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[int, _StartT?, int | None], /) -> list[Any]
jax (https://github.com/google/jax)
+ jax/_src/core.py:1878: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/fft.py:92: error: Argument 1 to "map" has incompatible type "type[slice[Any, Any, Any]]"; expected "Callable[[int], slice[Never, int, Never]]" [arg-type]
+ jax/_src/numpy/lax_numpy.py:365: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/lax_numpy.py:699: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/lax_numpy.py:699: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1980: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1981: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1985: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
discord.py (https://github.com/Rapptz/discord.py)
+ discord/utils.py:94: error: Name "_StartT" is not defined [name-defined]
- discord/http.py:228: note: def __setitem__(self, slice, Iterable[Embed], /) -> None
+ discord/http.py:228: note: def __setitem__(self, slice[int, _StartT?, int | None], Iterable[Embed], /) -> None
cwltool (https://github.com/common-workflow-language/cwltool)
+ note: In module imported here,
+ cwltool/cwlprov/writablebagfile.py:16: note: ... from here:
+ mypy-stubs/rdflib/graph.pyi: note: In member "__getitem__" of class "Graph":
+ mypy-stubs/rdflib/graph.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
+ cwltool/cwlrdf.py:6: note: In module imported here:
+ mypy-stubs/rdflib/query.pyi: note: In function "__getitem__":
+ mypy-stubs/rdflib/query.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
+ note: ... from here,
+ note: ... from here,
+ note: ... from here,
+ cwltool/software_requirements.py:32: note: ... from here:
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/cursor.py:94: error: Name "_StartT" is not defined [name-defined]
schema_salad (https://github.com/common-workflow-language/schema_salad)
+ schema_salad/tests/test_misc.py:3: note: In module imported here:
+ mypy-stubs/rdflib/graph.pyi: note: In member "__getitem__" of class "Graph":
+ mypy-stubs/rdflib/graph.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
+ mypy-stubs/rdflib/graph.pyi:15: note: In module imported here,
+ schema_salad/tests/test_misc.py:3: note: ... from here:
+ mypy-stubs/rdflib/query.pyi: note: In function "__getitem__":
+ mypy-stubs/rdflib/query.pyi:94:36: error: Name "_StartT" is not defined [name-defined]
bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/sphinxext/bokeh_color.py:45: note: In module imported here:
+ src/bokeh/core/serialization.py: note: In member "_encode_slice" of class "Serializer":
+ src/bokeh/core/serialization.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ src/bokeh/core/serialization.py: note: In member "_decode_slice" of class "Deserializer":
+ src/bokeh/core/serialization.py:94:36: error: Name "_StartT" is not defined [name-defined]
+ src/bokeh/core/serialization.py: note: At top level:
Diff from mypy_primer, showing the effect of this PR on open source code:
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[int, int, int | None], /) -> list[Any]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/array_algos/transforms.py:41: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/array_algos/transforms.py:41: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1368: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1368: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1368: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1368: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1379: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1379: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1383: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1383: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1383: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1383: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/arrays/arrow/array.py:618: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/pytables.py:4950: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/pytables.py:4950: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/indexing.py:1427: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/indexing.py:2598: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/indexing.py:2598: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/window/rolling.py:1148: error: Argument 1 to "tuple" has incompatible type "list[slice[int, None, int | None]]"; expected "Iterable[ndarray[Any, dtype[integer[Any]]] | ndarray[Any, dtype[bool_]]]" [arg-type]
+ pandas/core/internals/managers.py:1118: error: Argument 1 to "iget" of "Block" has incompatible type "tuple[slice[int, None, int | None], int]"; expected "int | tuple[int, int] | tuple[slice[int, int, int | None], int]" [arg-type]
+ pandas/core/internals/managers.py:1929: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/internals/blocks.py:2050: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/indexes/datetimelike.py:331: error: Argument 1 to "slice" has incompatible type "ndarray[Any, dtype[signedinteger[Any]]]"; expected "int" [arg-type]
+ pandas/core/indexes/datetimelike.py:331: error: Argument 2 to "slice" has incompatible type "ndarray[Any, dtype[signedinteger[Any]]]"; expected "int" [arg-type]
+ pandas/core/groupby/groupby.py:5274: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/groupby/groupby.py:5315: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/formats/style_render.py:1205: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/formats/style.py:1751: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/formats/style.py:3532: error: Argument 1 to "non_reducing_slice" has incompatible type "slice[int, None, int | None] | slice[int, int, int | None] | Sequence[Any] | Index"; expected "slice[int, int, int | None] | Sequence[Any] | Index" [arg-type]
kornia (https://github.com/kornia/kornia)
+ kornia/contrib/models/sam/architecture/mask_decoder.py:92: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/web_request.py:612:22: error: Argument 1 to "slice" has incompatible type "Any | None"; expected "int" [arg-type]
+ aiohttp/web_request.py:612:29: error: Argument 2 to "slice" has incompatible type "Any | None"; expected "int" [arg-type]
+ aiohttp/web_fileresponse.py:255:36: error: If condition is always true [redundant-expr]
+ aiohttp/web_fileresponse.py:255:36: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-redundant-expr for more info
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[int, int, int | None], 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[int, int, int | None], Iterable[tuple[str, str]], /) -> None
spark (https://github.com/apache/spark)
+ python/pyspark/pandas/indexing.py:1034: error: Incompatible types in assignment (expression has type "list[Any]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1035: error: Value of type "int" is not indexable [index]
+ python/pyspark/pandas/indexing.py:1035: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1037: error: Incompatible types in assignment (expression has type "list[Any]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1038: error: Value of type "int" is not indexable [index]
+ python/pyspark/pandas/indexing.py:1038: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1092: error: Incompatible types in assignment (expression has type "tuple[int]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1093: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1098: error: Incompatible types in assignment (expression has type "tuple[int]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1099: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1103: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
operator (https://github.com/canonical/operator)
- ops/framework.py:1280: note: def __getitem__(self, slice, /) -> MutableSequence[Any]
+ ops/framework.py:1280: note: def __getitem__(self, slice[int, int, int | None], /) -> MutableSequence[Any]
- ops/framework.py:1280: note: def __getitem__(self, slice, /) -> Sequence[Any]
+ ops/framework.py:1280: note: def __getitem__(self, slice[int, int, int | None], /) -> Sequence[Any]
- ops/framework.py:1283: note: def __setitem__(self, slice, Iterable[Any], /) -> None
+ ops/framework.py:1283: note: def __setitem__(self, slice[int, int, int | None], Iterable[Any], /) -> None
- ops/framework.py:1287: note: def __delitem__(self, slice, /) -> None
+ ops/framework.py:1287: note: def __delitem__(self, slice[int, int, int | None], /) -> None
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ tests/test_frame.py:2039: error: Expression is of type "tuple[Index[int], slice[Any, Any, Any]]", not "tuple[Index[int], slice[int, int, int | None]]" [assert-type]
jinja (https://github.com/pallets/jinja)
+ src/jinja2/nodes.py:895: error: Argument 1 to "slice" has incompatible type "Optional[Any]"; expected "int" [arg-type]
+ src/jinja2/nodes.py:895: error: Argument 2 to "slice" has incompatible type "Optional[Any]"; expected "int" [arg-type]
ibis (https://github.com/ibis-project/ibis)
+ ibis/util.py:587: error: Unsupported operand types for + ("IntegerScalar" and "int") [operator]
+ ibis/util.py:591: error: Unsupported operand types for + ("IntegerScalar" and "int") [operator]
- ibis/util.py:602: error: Incompatible types in assignment (expression has type "Value", variable has type "int | None") [assignment]
+ ibis/util.py:602: error: Incompatible types in assignment (expression has type "Value", variable has type "int") [assignment]
- ibis/util.py:603: error: Incompatible return value type (got "tuple[int | None, Any | int]", expected "tuple[int | IntegerScalar, int | IntegerScalar]") [return-value]
+ ibis/util.py:602: error: Unsupported operand types for - ("int" and "IntegerScalar") [operator]
- ibis/selectors.py:646: error: Item "slice" of "slice | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
+ ibis/selectors.py:646: error: Item "slice[int, int, int | None]" of "slice[int, int, int | None] | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
- ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "start" [union-attr]
+ ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice[int, int, int | None] | Iterable[int | str]" has no attribute "start" [union-attr]
- ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "stop" [union-attr]
+ ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice[int, int, int | None] | Iterable[int | str]" has no attribute "stop" [union-attr]
- ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice[int, int, int | None] | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/expr/types/strings.py:109: error: Argument 2 to "StringSlice" has incompatible type "int"; expected "Value[Integer, Any] | None" [arg-type]
+ ibis/expr/types/strings.py:109: error: Argument 3 to "StringSlice" has incompatible type "int"; expected "Value[Integer, Any] | None" [arg-type]
+ ibis/expr/types/arrays.py:145: error: Argument 2 to "ArraySlice" has incompatible type "int"; expected "Value[Integer, Any]" [arg-type]
+ ibis/expr/types/arrays.py:145: error: Argument 3 to "ArraySlice" has incompatible type "int"; expected "Value[Integer, Any] | None" [arg-type]
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[int, int, int | None], /) -> 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[int, int, int | None], /) -> 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[int, int, int | None], /) -> list[Any]
jax (https://github.com/google/jax)
+ jax/_src/op_shardings.py:90: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/sharding_specs.py:77: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/sharding_impls.py:452: error: Dict entry 0 has incompatible type Device?: "tuple[slice[int, None, int | None], ...]"; expected Device?: "tuple[slice[int, int, int | None], ...]" [dict-item]
+ jax/_src/core.py:1948: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/state/indexing.py:83: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/array.py:700: error: Argument 1 has incompatible type "tuple[slice[int, None, int | None], ...]"; expected "tuple[slice[int, int, int | None], ...] | None" [arg-type]
+ jax/_src/numpy/fft.py:92: error: Argument 1 to "map" has incompatible type "type[slice[Any, Any, Any]]"; expected "Callable[[int], slice[Never, int, Never]]" [arg-type]
+ jax/_src/numpy/lax_numpy.py:368: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/lax_numpy.py:702: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/lax_numpy.py:702: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1980: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1981: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1985: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
discord.py (https://github.com/Rapptz/discord.py)
- discord/http.py:228: note: def __setitem__(self, slice, Iterable[Embed], /) -> None
+ discord/http.py:228: note: def __setitem__(self, slice[int, int, int | None], Iterable[Embed], /) -> None
streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/runtime/state/query_params_test.py:242:37: note: def __getitem__(self, slice, /) -> Tuple[Any, ...]
+ lib/tests/streamlit/runtime/state/query_params_test.py:242:37: note: def __getitem__(self, slice[int, int, Optional[int]], /) -> Tuple[Any, ...]
Well, that's far more promising than before. Still not sure if this needs to be reflected in cpython by adding a __class_getitem__ to slice.
I've removed the Deferred label. I've just looked at spark primer output. The problem is on their side, since they reuse the start variable for different types.
The error that pyright is hitting is that the usage of itertools.starmap doesn't resolve the types of slice.
# Truncated setup.
from collections.abc import Iterator, Sequence
from itertools import combinations, repeat, starmap
from operator import getitem
from typing import TypeVar, cast
_T = TypeVar("_T")
# Actual function
def subslices(seq: Sequence[_T]) -> Iterator[Sequence[_T]]:
slices = starmap(slice, combinations(range(len(seq) + 1), 2))
reveal_type(slices) # Type of "slices" is "starmap[slice[_StartT@slice, _StopT@slice, _StepT@slice]]"
# Adding this cast removes the error on the final line:
# slices = cast(starmap[slice[int, int, int | None]], slices)
# And using a generator instead of starmap removes the error on the final line as well:
# slices = (slice(*args) for args in combinations(range(len(seq) + 1), 2))
return map(getitem, repeat(seq), slices) # Long error.
Full playground example here to recreate the conditions of the error.
Might be more of a deficiency in the typing of starmap (or something else with pyright’s analysis) than anything with slice. Not sure how to fix it though.
I might be missing something obvious but it is not clear to me why the type of stop has to default to the type of start. At runtime start is None if it is not passed to the constructor:
$ cat t.py
from typing_extensions import reveal_type
s = slice(10)
reveal_type(s)
reveal_type(s.start)
reveal_type(s.stop)
reveal_type(s.step)
$ python t.py
Runtime type is 'slice'
Runtime type is 'NoneType'
Runtime type is 'int'
Runtime type is 'NoneType'
Similarly, the type of step should default to None.
So I would expect the definitions of the type variables to be:
_StartT = TypeVar("_StartT", default=None)
_StopT = TypeVar("_StopT", default=int)
_StepT = TypeVar("_StepT", default=None)
I won’t lie; I just copy-pasted the example implementation from PEP 696 without much thought, since this PR wasn’t originally opened with the intention of being merged. Haven’t double-checked since. Definitely will take another look though.
Diff from mypy_primer, showing the effect of this PR on open source code:
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[int, int, int | None], /) -> list[Any]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/array_algos/transforms.py:41: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/array_algos/transforms.py:41: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1368: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1368: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1368: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1368: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1379: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1379: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1383: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1383: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1383: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1383: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/arrays/arrow/array.py:620: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/pytables.py:4951: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/pytables.py:4951: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/indexing.py:1427: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/indexing.py:2598: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/indexing.py:2598: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/window/rolling.py:1148: error: Argument 1 to "tuple" has incompatible type "list[slice[int, None, int | None]]"; expected "Iterable[ndarray[Any, dtype[integer[Any]]] | ndarray[Any, dtype[bool_]]]" [arg-type]
+ pandas/core/internals/managers.py:1118: error: Argument 1 to "iget" of "Block" has incompatible type "tuple[slice[int, None, int | None], int]"; expected "int | tuple[int, int] | tuple[slice[int, int, int | None], int]" [arg-type]
+ pandas/core/internals/managers.py:1929: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/internals/blocks.py:2050: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/indexes/datetimelike.py:331: error: Argument 1 to "slice" has incompatible type "ndarray[Any, dtype[signedinteger[Any]]]"; expected "int" [arg-type]
+ pandas/core/indexes/datetimelike.py:331: error: Argument 2 to "slice" has incompatible type "ndarray[Any, dtype[signedinteger[Any]]]"; expected "int" [arg-type]
+ pandas/core/groupby/groupby.py:5271: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/groupby/groupby.py:5312: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/formats/style_render.py:1205: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/formats/style.py:1751: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/formats/style.py:3532: error: Argument 1 to "non_reducing_slice" has incompatible type "slice[int, None, int | None] | slice[int, int, int | None] | Sequence[Any] | Index"; expected "slice[int, int, int | None] | Sequence[Any] | Index" [arg-type]
kornia (https://github.com/kornia/kornia)
+ kornia/contrib/models/sam/architecture/mask_decoder.py:92: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/web_request.py:612:22: error: Argument 1 to "slice" has incompatible type "Any | None"; expected "int" [arg-type]
+ aiohttp/web_request.py:612:29: error: Argument 2 to "slice" has incompatible type "Any | None"; expected "int" [arg-type]
+ aiohttp/web_fileresponse.py:255:36: error: If condition is always true [redundant-expr]
+ aiohttp/web_fileresponse.py:255:36: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-redundant-expr for more info
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[int, int, int | None], 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[int, int, int | None], Iterable[tuple[str, str]], /) -> None
spark (https://github.com/apache/spark)
+ python/pyspark/pandas/indexing.py:1034: error: Incompatible types in assignment (expression has type "list[Any]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1035: error: Value of type "int" is not indexable [index]
+ python/pyspark/pandas/indexing.py:1035: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1037: error: Incompatible types in assignment (expression has type "list[Any]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1038: error: Value of type "int" is not indexable [index]
+ python/pyspark/pandas/indexing.py:1038: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1092: error: Incompatible types in assignment (expression has type "tuple[int]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1093: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1098: error: Incompatible types in assignment (expression has type "tuple[int]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1099: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1103: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
operator (https://github.com/canonical/operator)
- ops/framework.py:1280: note: def __getitem__(self, slice, /) -> MutableSequence[Any]
+ ops/framework.py:1280: note: def __getitem__(self, slice[int, int, int | None], /) -> MutableSequence[Any]
- ops/framework.py:1280: note: def __getitem__(self, slice, /) -> Sequence[Any]
+ ops/framework.py:1280: note: def __getitem__(self, slice[int, int, int | None], /) -> Sequence[Any]
- ops/framework.py:1283: note: def __setitem__(self, slice, Iterable[Any], /) -> None
+ ops/framework.py:1283: note: def __setitem__(self, slice[int, int, int | None], Iterable[Any], /) -> None
- ops/framework.py:1287: note: def __delitem__(self, slice, /) -> None
+ ops/framework.py:1287: note: def __delitem__(self, slice[int, int, int | None], /) -> None
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ tests/test_frame.py:2039: error: Expression is of type "tuple[Index[int], slice[Any, Any, Any]]", not "tuple[Index[int], slice[int, int, int | None]]" [assert-type]
ibis (https://github.com/ibis-project/ibis)
+ ibis/util.py:587: error: Unsupported operand types for + ("IntegerScalar" and "int") [operator]
+ ibis/util.py:591: error: Unsupported operand types for + ("IntegerScalar" and "int") [operator]
- ibis/util.py:602: error: Incompatible types in assignment (expression has type "Value", variable has type "int | None") [assignment]
+ ibis/util.py:602: error: Incompatible types in assignment (expression has type "Value", variable has type "int") [assignment]
- ibis/util.py:603: error: Incompatible return value type (got "tuple[int | None, Any | int]", expected "tuple[int | IntegerScalar, int | IntegerScalar]") [return-value]
+ ibis/util.py:602: error: Unsupported operand types for - ("int" and "IntegerScalar") [operator]
- ibis/selectors.py:646: error: Item "slice" of "slice | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
+ ibis/selectors.py:646: error: Item "slice[int, int, int | None]" of "slice[int, int, int | None] | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
- ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "start" [union-attr]
+ ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice[int, int, int | None] | Iterable[int | str]" has no attribute "start" [union-attr]
- ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "stop" [union-attr]
+ ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice[int, int, int | None] | Iterable[int | str]" has no attribute "stop" [union-attr]
- ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice[int, int, int | None] | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/expr/types/strings.py:109: error: Argument 2 to "StringSlice" has incompatible type "int"; expected "Value[Integer, Any] | None" [arg-type]
+ ibis/expr/types/strings.py:109: error: Argument 3 to "StringSlice" has incompatible type "int"; expected "Value[Integer, Any] | None" [arg-type]
+ ibis/expr/types/arrays.py:145: error: Argument 2 to "ArraySlice" has incompatible type "int"; expected "Value[Integer, Any]" [arg-type]
+ ibis/expr/types/arrays.py:145: error: Argument 3 to "ArraySlice" has incompatible type "int"; expected "Value[Integer, Any] | None" [arg-type]
jax (https://github.com/google/jax)
+ jax/_src/op_shardings.py:90: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/sharding_specs.py:77: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/sharding_impls.py:452: error: Dict entry 0 has incompatible type Device?: "tuple[slice[int, None, int | None], ...]"; expected Device?: "tuple[slice[int, int, int | None], ...]" [dict-item]
+ jax/_src/core.py:1964: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/state/indexing.py:83: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/array.py:684: error: Argument 1 has incompatible type "tuple[slice[int, None, int | None], ...]"; expected "tuple[slice[int, int, int | None], ...] | None" [arg-type]
+ jax/_src/numpy/fft.py:92: error: Argument 1 to "map" has incompatible type "type[slice[Any, Any, Any]]"; expected "Callable[[int], slice[Never, int, Never]]" [arg-type]
+ jax/_src/numpy/lax_numpy.py:379: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/lax_numpy.py:814: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/lax_numpy.py:814: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1980: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1981: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1985: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
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[int, int, int | None], /) -> 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[int, int, int | None], /) -> 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[int, int, int | None], /) -> list[Any]
jinja (https://github.com/pallets/jinja)
+ src/jinja2/nodes.py:895: error: Argument 1 to "slice" has incompatible type "Optional[Any]"; expected "int" [arg-type]
+ src/jinja2/nodes.py:895: error: Argument 2 to "slice" has incompatible type "Optional[Any]"; expected "int" [arg-type]
discord.py (https://github.com/Rapptz/discord.py)
- discord/http.py:228: note: def __setitem__(self, slice, Iterable[Embed], /) -> None
+ discord/http.py:228: note: def __setitem__(self, slice[int, int, int | None], Iterable[Embed], /) -> None
streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/runtime/state/query_params_test.py:242:37: note: def __getitem__(self, slice, /) -> Tuple[Any, ...]
+ lib/tests/streamlit/runtime/state/query_params_test.py:242:37: note: def __getitem__(self, slice[int, int, Optional[int]], /) -> Tuple[Any, ...]
Diff from mypy_primer, showing the effect of this PR on open source code:
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[int, int, int | None], /) -> list[Any]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/array_algos/transforms.py:41: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/array_algos/transforms.py:41: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1370: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1370: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1370: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1370: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1381: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1381: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1385: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1385: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1385: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1385: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/arrays/arrow/array.py:620: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/pytables.py:4952: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/pytables.py:4952: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/indexing.py:1424: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/indexing.py:2594: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/indexing.py:2594: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/window/rolling.py:1145: error: Argument 1 to "tuple" has incompatible type "list[slice[int, None, int | None]]"; expected "Iterable[ndarray[Any, dtype[integer[Any]]] | ndarray[Any, dtype[bool_]]]" [arg-type]
+ pandas/core/internals/managers.py:1118: error: Argument 1 to "iget" of "Block" has incompatible type "tuple[slice[int, None, int | None], int]"; expected "int | tuple[int, int] | tuple[slice[int, int, int | None], int]" [arg-type]
+ pandas/core/internals/managers.py:1929: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/internals/blocks.py:2052: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/indexes/datetimelike.py:331: error: Argument 1 to "slice" has incompatible type "ndarray[Any, dtype[signedinteger[Any]]]"; expected "int" [arg-type]
+ pandas/core/indexes/datetimelike.py:331: error: Argument 2 to "slice" has incompatible type "ndarray[Any, dtype[signedinteger[Any]]]"; expected "int" [arg-type]
+ pandas/core/groupby/groupby.py:5288: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/groupby/groupby.py:5329: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/formats/style_render.py:1205: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/formats/style.py:1751: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/formats/style.py:3532: error: Argument 1 to "non_reducing_slice" has incompatible type "slice[int, None, int | None] | slice[int, int, int | None] | Sequence[Any] | Index"; expected "slice[int, int, int | None] | Sequence[Any] | Index" [arg-type]
kornia (https://github.com/kornia/kornia)
+ kornia/contrib/models/sam/architecture/mask_decoder.py:92: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/web_request.py:612:22: error: Argument 1 to "slice" has incompatible type "Any | None"; expected "int" [arg-type]
+ aiohttp/web_request.py:612:29: error: Argument 2 to "slice" has incompatible type "Any | None"; expected "int" [arg-type]
+ aiohttp/web_fileresponse.py:255:36: error: If condition is always true [redundant-expr]
+ aiohttp/web_fileresponse.py:255:36: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-redundant-expr for more info
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[int, int, int | None], 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[int, int, int | None], Iterable[tuple[str, str]], /) -> None
spark (https://github.com/apache/spark)
+ python/pyspark/pandas/indexing.py:1030: error: Incompatible types in assignment (expression has type "list[Any]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1031: error: Value of type "int" is not indexable [index]
+ python/pyspark/pandas/indexing.py:1031: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1033: error: Incompatible types in assignment (expression has type "list[Any]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1034: error: Value of type "int" is not indexable [index]
+ python/pyspark/pandas/indexing.py:1034: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1088: error: Incompatible types in assignment (expression has type "tuple[int]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1089: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1094: error: Incompatible types in assignment (expression has type "tuple[int]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1095: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1099: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
operator (https://github.com/canonical/operator)
- ops/framework.py:1291: note: def __getitem__(self, slice, /) -> MutableSequence[Any]
+ ops/framework.py:1291: note: def __getitem__(self, slice[int, int, int | None], /) -> MutableSequence[Any]
- ops/framework.py:1291: note: def __getitem__(self, slice, /) -> Sequence[Any]
+ ops/framework.py:1291: note: def __getitem__(self, slice[int, int, int | None], /) -> Sequence[Any]
- ops/framework.py:1294: note: def __setitem__(self, slice, Iterable[Any], /) -> None
+ ops/framework.py:1294: note: def __setitem__(self, slice[int, int, int | None], Iterable[Any], /) -> None
- ops/framework.py:1298: note: def __delitem__(self, slice, /) -> None
+ ops/framework.py:1298: note: def __delitem__(self, slice[int, int, int | None], /) -> None
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ tests/test_frame.py:2055: error: Expression is of type "tuple[Index[int], slice[Any, Any, Any]]", not "tuple[Index[int], slice[int, int, int | None]]" [assert-type]
jinja (https://github.com/pallets/jinja)
+ src/jinja2/nodes.py:895: error: Argument 1 to "slice" has incompatible type "Optional[Any]"; expected "int" [arg-type]
+ src/jinja2/nodes.py:895: error: Argument 2 to "slice" has incompatible type "Optional[Any]"; expected "int" [arg-type]
ibis (https://github.com/ibis-project/ibis)
+ ibis/util.py:591: error: Unsupported operand types for + ("IntegerScalar" and "int") [operator]
+ ibis/util.py:595: error: Unsupported operand types for + ("IntegerScalar" and "int") [operator]
- ibis/util.py:606: error: Incompatible types in assignment (expression has type "Value", variable has type "int | None") [assignment]
+ ibis/util.py:606: error: Incompatible types in assignment (expression has type "Value", variable has type "int") [assignment]
- ibis/util.py:607: error: Incompatible return value type (got "tuple[int | None, Any | int]", expected "tuple[int | IntegerScalar, int | IntegerScalar]") [return-value]
+ ibis/util.py:606: error: Unsupported operand types for - ("int" and "IntegerScalar") [operator]
- ibis/selectors.py:646: error: Item "slice" of "slice | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
+ ibis/selectors.py:646: error: Item "slice[int, int, int | None]" of "slice[int, int, int | None] | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
- ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "start" [union-attr]
+ ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice[int, int, int | None] | Iterable[int | str]" has no attribute "start" [union-attr]
- ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "stop" [union-attr]
+ ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice[int, int, int | None] | Iterable[int | str]" has no attribute "stop" [union-attr]
- ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice[int, int, int | None] | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/expr/types/strings.py:109: error: Argument 2 to "StringSlice" has incompatible type "int"; expected "Value[Integer, Any] | None" [arg-type]
+ ibis/expr/types/strings.py:109: error: Argument 3 to "StringSlice" has incompatible type "int"; expected "Value[Integer, Any] | None" [arg-type]
+ ibis/expr/types/arrays.py:145: error: Argument 2 to "ArraySlice" has incompatible type "int"; expected "Value[Integer, Any]" [arg-type]
+ ibis/expr/types/arrays.py:145: error: Argument 3 to "ArraySlice" has incompatible type "int"; expected "Value[Integer, Any] | None" [arg-type]
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[int, int, int | None], /) -> 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[int, int, int | None], /) -> 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[int, int, int | None], /) -> list[Any]
jax (https://github.com/google/jax)
+ jax/_src/op_shardings.py:90: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/sharding_specs.py:77: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/sharding_impls.py:439: error: Dict entry 0 has incompatible type Device?: "tuple[slice[int, None, int | None], ...]"; expected Device?: "tuple[slice[int, int, int | None], ...]" [dict-item]
+ jax/_src/core.py:1956: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/state/indexing.py:83: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/array.py:690: error: Argument 1 has incompatible type "tuple[slice[int, None, int | None], ...]"; expected "tuple[slice[int, int, int | None], ...] | None" [arg-type]
+ jax/_src/numpy/fft.py:92: error: Argument 1 to "map" has incompatible type "type[slice[Any, Any, Any]]"; expected "Callable[[int], slice[Never, int, Never]]" [arg-type]
+ jax/_src/numpy/lax_numpy.py:379: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/lax_numpy.py:814: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/lax_numpy.py:814: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1980: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1981: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1985: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
discord.py (https://github.com/Rapptz/discord.py)
- discord/http.py:231: note: def __setitem__(self, slice, Iterable[Embed], /) -> None
+ discord/http.py:231: note: def __setitem__(self, slice[int, int, int | None], Iterable[Embed], /) -> None
streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/elements/lib/column_config_utils_test.py:382:30: error: Invalid index type "str" for "Union[ColumnConfig, None, str]"; expected type "Union[SupportsIndex, slice]" [index]
+ lib/tests/streamlit/elements/lib/column_config_utils_test.py:382:30: error: Invalid index type "str" for "Union[ColumnConfig, None, str]"; expected type "Union[SupportsIndex, slice[int, int, Optional[int]]]" [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[int, int, Optional[int]], /) -> Tuple[Any, ...]
Diff from mypy_primer, showing the effect of this PR on open source code:
vision (https://github.com/pytorch/vision)
+ torchvision/prototype/utils/_internal.py:126: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
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[None, int, None], /) -> list[Any]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/array_algos/transforms.py:41: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/array_algos/transforms.py:43: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1370: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1370: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1370: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1381: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1381: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1381: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1385: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1385: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1385: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/pytables.py:4952: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/indexing.py:1424: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/indexing.py:2594: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/window/rolling.py:1145: error: Argument 1 to "tuple" has incompatible type "list[slice[int, None, None]]"; expected "Iterable[ndarray[Any, dtype[integer[Any]]] | ndarray[Any, dtype[bool_]]]" [arg-type]
+ pandas/core/internals/managers.py:259: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/internals/managers.py:894: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/internals/managers.py:913: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/internals/managers.py:961: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/internals/managers.py:1118: error: Argument 1 to "iget" of "Block" has incompatible type "tuple[slice[None, None, None], int]"; expected "int | tuple[int, int] | tuple[slice[None, int, None], int]" [arg-type]
+ pandas/core/internals/managers.py:1121: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/internals/managers.py:1154: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/internals/managers.py:1166: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/internals/managers.py:1495: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/internals/managers.py:1929: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/internals/managers.py:1992: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/internals/managers.py:2099: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/internals/managers.py:2113: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/internals/construction.py:311: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/internals/blocks.py:399: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/internals/blocks.py:2052: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/indexes/datetimelike.py:331: error: Argument 1 to "slice" has incompatible type "ndarray[Any, dtype[signedinteger[Any]]]"; expected "None" [arg-type]
+ pandas/core/indexes/datetimelike.py:331: error: Argument 2 to "slice" has incompatible type "ndarray[Any, dtype[signedinteger[Any]]]"; expected "int" [arg-type]
+ pandas/core/indexes/datetimelike.py:609: error: Invalid index type "slice[int, int, None]" for "ExtensionArray | ndarray[Any, Any]"; expected type "slice[None, int, None] | list[int] | ndarray[Any, Any]" [index]
+ pandas/core/indexes/datetimelike.py:609: error: Invalid index type "slice[int, int, None]" for "ExtensionArray | ndarray[Any, Any]"; expected type "slice[None, int, None] | EllipsisType | SupportsIndex | _SupportsArray[dtype[bool_ | integer[Any]]] | _NestedSequence[_SupportsArray[dtype[bool_ | integer[Any]]]] | bool | int | _NestedSequence[bool | int] | tuple[slice[None, int, None] | EllipsisType | _SupportsArray[dtype[bool_ | integer[Any]]] | _NestedSequence[_SupportsArray[dtype[bool_ | integer[Any]]]] | bool | int | _NestedSequence[bool | int] | SupportsIndex | None, ...] | None" [index]
+ pandas/core/indexes/base.py:6541: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/indexes/base.py:6541: error: Argument 3 to "slice" has incompatible type "int | None"; expected "None" [arg-type]
+ pandas/core/groupby/groupby.py:5329: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/groupby/groupby.py:5329: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/formats/style_render.py:1205: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/formats/style.py:1751: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/io/formats/style.py:3532: error: Argument 1 to "non_reducing_slice" has incompatible type "slice[None, None, None] | slice[None, int, None] | Sequence[Any] | Index"; expected "slice[None, int, None] | Sequence[Any] | Index" [arg-type]
kornia (https://github.com/kornia/kornia)
+ kornia/contrib/models/sam/architecture/mask_decoder.py:92: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/web_request.py:612:29: error: Argument 2 to "slice" has incompatible type "Any | None"; expected "int" [arg-type]
+ aiohttp/web_request.py:612:34: error: Argument 3 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ aiohttp/web_fileresponse.py:238:16: error: Left operand of "or" is always false [redundant-expr]
+ aiohttp/web_fileresponse.py:238:16: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-redundant-expr for more info
+ aiohttp/web_fileresponse.py:239:20: error: Unsupported operand types for > ("int" and "None") [operator]
+ aiohttp/web_fileresponse.py:239:20: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-operator for more info
+ aiohttp/web_fileresponse.py:255:36: error: If condition is always true [redundant-expr]
+ aiohttp/web_fileresponse.py:255:81: error: Unsupported operand types for - ("int" and "None") [operator]
+ aiohttp/web_fileresponse.py:258:20: error: Unsupported operand types for <= ("int" and "None") [operator]
tornado (https://github.com/tornadoweb/tornado)
+ tornado/template.py:828: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ tornado/template.py:828: error: Argument 3 to "slice" has incompatible type "int"; expected "None" [arg-type]
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[None, int, None], 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[None, int, None], Iterable[tuple[str, str]], /) -> None
spark (https://github.com/apache/spark)
+ python/pyspark/pandas/indexing.py:1033: error: Incompatible types in assignment (expression has type "list[Any]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1034: error: Value of type "int" is not indexable [index]
+ python/pyspark/pandas/indexing.py:1034: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1094: error: Incompatible types in assignment (expression has type "tuple[int]", variable has type "int") [assignment]
+ python/pyspark/pandas/indexing.py:1095: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
+ python/pyspark/pandas/indexing.py:1099: error: Argument 1 to "len" has incompatible type "int"; expected "Sized" [arg-type]
operator (https://github.com/canonical/operator)
- ops/framework.py:1291: note: def __getitem__(self, slice, /) -> MutableSequence[Any]
+ ops/framework.py:1291: note: def __getitem__(self, slice[None, int, None], /) -> MutableSequence[Any]
- ops/framework.py:1291: note: def __getitem__(self, slice, /) -> Sequence[Any]
+ ops/framework.py:1291: note: def __getitem__(self, slice[None, int, None], /) -> Sequence[Any]
- ops/framework.py:1294: note: def __setitem__(self, slice, Iterable[Any], /) -> None
+ ops/framework.py:1294: note: def __setitem__(self, slice[None, int, None], Iterable[Any], /) -> None
- ops/framework.py:1298: note: def __delitem__(self, slice, /) -> None
+ ops/framework.py:1298: note: def __delitem__(self, slice[None, int, None], /) -> None
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ tests/test_styler.py:223: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ tests/test_frame.py:2055: error: Expression is of type "tuple[Index[int], slice[Any, Any, Any]]", not "tuple[Index[int], slice[None, int, None]]" [assert-type]
ibis (https://github.com/ibis-project/ibis)
+ ibis/util.py:591: error: Unsupported operand types for + ("IntegerScalar" and "int") [operator]
- ibis/util.py:606: error: Incompatible types in assignment (expression has type "Value", variable has type "int | None") [assignment]
- ibis/util.py:607: error: Incompatible return value type (got "tuple[int | None, Any | int]", expected "tuple[int | IntegerScalar, int | IntegerScalar]") [return-value]
- ibis/selectors.py:646: error: Item "slice" of "slice | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
+ ibis/selectors.py:646: error: Item "slice[None, int, None]" of "slice[None, int, None] | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
- ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "start" [union-attr]
+ ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice[None, int, None] | Iterable[int | str]" has no attribute "start" [union-attr]
- ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "stop" [union-attr]
+ ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice[None, int, None] | Iterable[int | str]" has no attribute "stop" [union-attr]
- ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice[None, int, None] | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/expr/types/strings.py:109: error: Argument 3 to "StringSlice" has incompatible type "int"; expected "Value[Integer, Any] | None" [arg-type]
+ ibis/expr/types/arrays.py:145: error: Argument 2 to "ArraySlice" has incompatible type "int"; expected "Value[Integer, Any]" [arg-type]
+ ibis/expr/types/arrays.py:145: error: Argument 3 to "ArraySlice" has incompatible type "int"; expected "Value[Integer, Any] | None" [arg-type]
jinja (https://github.com/pallets/jinja)
+ src/jinja2/nodes.py:895: error: Argument 2 to "slice" has incompatible type "Optional[Any]"; expected "int" [arg-type]
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[None, int, None], /) -> 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[None, int, None], /) -> 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[None, int, None], /) -> list[Any]
jax (https://github.com/google/jax)
+ jax/_src/op_shardings.py:90: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/op_shardings.py:94: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/_src/sharding_specs.py:77: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/sharding_impls.py:439: error: Dict entry 0 has incompatible type Device?: "tuple[slice[None, None, None], ...]"; expected Device?: "tuple[slice[None, int, None], ...]" [dict-item]
+ jax/_src/core.py:1956: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/state/indexing.py:83: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/debugging.py:412: error: Unsupported operand types for - ("int" and "None") [operator]
+ jax/_src/debugging.py:413: error: Unsupported operand types for % ("None" and "int") [operator]
+ jax/_src/debugging.py:415: error: Unsupported operand types for // ("None" and "int") [operator]
+ jax/_src/debugging.py:496: error: Unsupported operand types for - ("int" and "None") [operator]
+ jax/_src/debugging.py:498: error: Unsupported operand types for - ("int" and "None") [operator]
+ jax/_src/debugging.py:507: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/_src/debugging.py:509: error: Unsupported operand types for - ("int" and "None") [operator]
+ jax/_src/array.py:690: error: Argument 1 has incompatible type "tuple[slice[None, None, None], ...]"; expected "tuple[slice[None, int, None], ...] | None" [arg-type]
+ jax/_src/numpy/fft.py:92: error: Argument 1 to "map" has incompatible type "type[slice[Any, Any, Any]]"; expected "Callable[[int], slice[Never, int, Never]]" [arg-type]
+ jax/_src/numpy/lax_numpy.py:379: error: Argument 3 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/_src/numpy/lax_numpy.py:813: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/_src/numpy/lax_numpy.py:814: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1980: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1980: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1980: error: Argument 3 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1981: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1981: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1981: error: Argument 3 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1985: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1985: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1985: error: Argument 3 to "slice" has incompatible type "int"; expected "None" [arg-type]
discord.py (https://github.com/Rapptz/discord.py)
- discord/http.py:231: note: def __setitem__(self, slice, Iterable[Embed], /) -> None
+ discord/http.py:231: note: def __setitem__(self, slice[None, int, None], Iterable[Embed], /) -> None
streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/elements/lib/column_config_utils_test.py:382:30: error: Invalid index type "str" for "Union[ColumnConfig, None, str]"; expected type "Union[SupportsIndex, slice]" [index]
+ lib/tests/streamlit/elements/lib/column_config_utils_test.py:382:30: error: Invalid index type "str" for "Union[ColumnConfig, None, str]"; expected type "Union[SupportsIndex, slice[None, int, None]]" [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[None, int, None], /) -> Tuple[Any, ...]
Maybe I'm misreading, but some of these errors indicate that mypy is using the typevar defaults as the typevar bounds as well, which wouldn't be correct afaik.
EDIT: Removed a comment about the one pyright error; I'm not sure how that works right now.
I'd go with @srittau's idea of setting defaults to Any https://github.com/python/typeshed/pull/11637#discussion_r1596543856. This will allow users to parametrize slice without any regressions and we can always change the defaults later if needed.
One more thing, shouldn't the type variables be covariant?
Diff from mypy_primer, showing the effect of this PR on open source code:
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]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/array_algos/transforms.py:41: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1372: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1372: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1372: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1383: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1383: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1387: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1387: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1387: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
kornia (https://github.com/kornia/kornia)
+ kornia/contrib/models/sam/architecture/mask_decoder.py:92: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
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
operator (https://github.com/canonical/operator)
- ops/framework.py:1291: note: def __getitem__(self, slice, /) -> MutableSequence[Any]
+ ops/framework.py:1291: note: def __getitem__(self, slice[Any, Any, Any], /) -> MutableSequence[Any]
- ops/framework.py:1291: note: def __getitem__(self, slice, /) -> Sequence[Any]
+ ops/framework.py:1291: note: def __getitem__(self, slice[Any, Any, Any], /) -> Sequence[Any]
- ops/framework.py:1294: note: def __setitem__(self, slice, Iterable[Any], /) -> None
+ ops/framework.py:1294: note: def __setitem__(self, slice[Any, Any, Any], Iterable[Any], /) -> None
- ops/framework.py:1298: note: def __delitem__(self, slice, /) -> None
+ ops/framework.py:1298: note: def __delitem__(self, slice[Any, Any, Any], /) -> None
ibis (https://github.com/ibis-project/ibis)
- ibis/selectors.py:646: error: Item "slice" of "slice | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
+ ibis/selectors.py:646: error: Item "slice[Any, Any, Any]" of "slice[Any, Any, Any] | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
- ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "start" [union-attr]
+ ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice[Any, Any, Any] | Iterable[int | str]" has no attribute "start" [union-attr]
- ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "stop" [union-attr]
+ ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice[Any, Any, Any] | Iterable[int | str]" has no attribute "stop" [union-attr]
- ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice[Any, Any, Any] | Iterable[int | str]" has no attribute "step" [union-attr]
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]
jax (https://github.com/google/jax)
+ jax/_src/core.py:1956: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/lax_numpy.py:814: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1980: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1981: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1985: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
discord.py (https://github.com/Rapptz/discord.py)
- discord/http.py:231: note: def __setitem__(self, slice, Iterable[Embed], /) -> None
+ discord/http.py:231: note: def __setitem__(self, slice[Any, Any, Any], Iterable[Embed], /) -> None
streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/elements/lib/column_config_utils_test.py:382:30: error: Invalid index type "str" for "Union[ColumnConfig, None, str]"; expected type "Union[SupportsIndex, slice]" [index]
+ lib/tests/streamlit/elements/lib/column_config_utils_test.py:382:30: error: Invalid index type "str" for "Union[ColumnConfig, None, 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, ...]
One more thing, shouldn't the type variables be covariant?
I feel like I don't know enough about how slices are used beyond the basics to know the answer to this, tbh. More than willing to defer to someone else's knowledge.
Determining variance doesn't really require knowing how the class is used. Roughly speaking, a type parameter can be covariant if it's only used in method return types and contravariant if it's only used in parameter types. Here the typevars are only used in return types (read-only properties), so they can be covariant.
Type checkers will tell you if you use a covariant or contravariant typevar where you should have used an invariant one.
Covariance might help with some of the primer hits. I also don't understand why mypy wants explicit annotations in the test cases.
Diff from mypy_primer, showing the effect of this PR on open source code:
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]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/array_algos/transforms.py:41: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1372: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1372: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1372: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1383: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ pandas/core/algorithms.py:1383: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1387: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1387: error: Argument 1 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ pandas/core/algorithms.py:1387: error: Argument 2 to "slice" has incompatible type "None"; expected "int" [arg-type]
kornia (https://github.com/kornia/kornia)
+ kornia/contrib/models/sam/architecture/mask_decoder.py:92: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
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
operator (https://github.com/canonical/operator)
- ops/framework.py:1291: note: def __getitem__(self, slice, /) -> MutableSequence[Any]
+ ops/framework.py:1291: note: def __getitem__(self, slice[Any, Any, Any], /) -> MutableSequence[Any]
- ops/framework.py:1291: note: def __getitem__(self, slice, /) -> Sequence[Any]
+ ops/framework.py:1291: note: def __getitem__(self, slice[Any, Any, Any], /) -> Sequence[Any]
- ops/framework.py:1294: note: def __setitem__(self, slice, Iterable[Any], /) -> None
+ ops/framework.py:1294: note: def __setitem__(self, slice[Any, Any, Any], Iterable[Any], /) -> None
- ops/framework.py:1298: note: def __delitem__(self, slice, /) -> None
+ ops/framework.py:1298: note: def __delitem__(self, slice[Any, Any, Any], /) -> None
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]
ibis (https://github.com/ibis-project/ibis)
- ibis/selectors.py:646: error: Item "slice" of "slice | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
+ ibis/selectors.py:646: error: Item "slice[Any, Any, Any]" of "slice[Any, Any, Any] | Iterable[int | str]" has no attribute "__iter__" (not iterable) [union-attr]
- ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "start" [union-attr]
+ ibis/selectors.py:649: error: Item "Iterable[int | str]" of "slice[Any, Any, Any] | Iterable[int | str]" has no attribute "start" [union-attr]
- ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "stop" [union-attr]
+ ibis/selectors.py:650: error: Item "Iterable[int | str]" of "slice[Any, Any, Any] | Iterable[int | str]" has no attribute "stop" [union-attr]
- ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice | Iterable[int | str]" has no attribute "step" [union-attr]
+ ibis/selectors.py:651: error: Item "Iterable[int | str]" of "slice[Any, Any, Any] | Iterable[int | str]" has no attribute "step" [union-attr]
jax (https://github.com/google/jax)
+ jax/_src/core.py:1956: error: Argument 1 to "slice" has incompatible type "None"; expected "int" [arg-type]
+ jax/_src/numpy/lax_numpy.py:814: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1980: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1981: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
+ jax/experimental/sparse/bcoo.py:1985: error: Argument 2 to "slice" has incompatible type "int"; expected "None" [arg-type]
discord.py (https://github.com/Rapptz/discord.py)
- discord/http.py:231: note: def __setitem__(self, slice, Iterable[Embed], /) -> None
+ discord/http.py:231: note: def __setitem__(self, slice[Any, Any, Any], Iterable[Embed], /) -> None
streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/elements/lib/column_config_utils_test.py:382:30: error: Invalid index type "str" for "Union[ColumnConfig, None, str]"; expected type "Union[SupportsIndex, slice]" [index]
+ lib/tests/streamlit/elements/lib/column_config_utils_test.py:382:30: error: Invalid index type "str" for "Union[ColumnConfig, None, 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, ...]
Looking at the primer hits:
-
pandas does variations of this:
axis_indexer = [slice(None)] * values.ndim if periods > 0: axis_indexer[axis] = slice(None, periods) else: axis_indexer[axis] = slice(periods, None)This will need an explicit annotation of
axis_indexer. Not great, but not unheard of for lists. I also expect that collecting slices into a list is a fairly uncommon use, outside of pandas. -
kornia is collecting the slice in a variable, before using it. Will also need an explicit annotation.
-
jax hit number 1 is a bit more problematic:
slices = tuple(slice(int(d._data)) if type(d) is DArray and type(d.dtype) is bint else slice(None) for d in self.shape) -
The other jax hits need explicit annotations for lists.
While this introduces a bit of churn in more complex/unorthodox uses of slice, I'm +1 on this change if we can figure out why the mypy tests fail.