Skip to content

Conversation

@randolf-scholz
Copy link
Contributor

Trying to see what happens when we replace slice type hints with

IndexSlice: TypeAlias = slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]

annotations.

@github-actions

This comment has been minimized.

@brianschubert
Copy link
Collaborator

This seems like a good improvement to me. I imagine this would be very nice for replacing mypy's hardcoded SupportsIndex/None checks for slice indices (python/mypy#2410).

It looks like the pytype errors may be due to pytype having its own builtins stubs, which don't define slice as being generic: https://github.com/google/pytype/blob/97d949161b27259af283fc1d271f8cf056ddf9b6/pytype/stubs/builtins/builtins.pytd#L972

@github-actions

This comment has been minimized.

@srittau
Copy link
Collaborator

srittau commented Feb 28, 2025

Closing in favor of #13008.

@srittau srittau closed this Feb 28, 2025
@randolf-scholz
Copy link
Contributor Author

randolf-scholz commented Feb 28, 2025

@srittau This PR is not in conflict with #13008, it is for making some annotations in the stubs more precise by replacing slice[Any, Any, Any] with more concrete types.

Thanks to #13008, one could now use slice[SupportsIndex | None] instead of an alias, since it will default to slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None].

@srittau srittau reopened this Feb 28, 2025
@github-actions

This comment has been minimized.

@srittau srittau mentioned this pull request Jul 16, 2025
@randolf-scholz
Copy link
Contributor Author

randolf-scholz commented Jul 30, 2025

This should probably not get merged as-is. For collections.abc.Sequence and collections.abc.MutableSequence we should probably consider whether to use the weaker slice[int | None] rather than slice[SupportsIndex | None], since that ABC also only requires int for non-slice __getitem__.

@randolf-scholz
Copy link
Contributor Author

Likewise, this would also affect operator.{getitem,setitem,delitem}

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@randolf-scholz randolf-scholz marked this pull request as ready for review July 30, 2025 18:54
Use `slice[SupportesIndex | None]` in more places that support it

Use more precise `slice[SupportesIndex | None]` rather than `slice` in many places
@github-actions
Copy link
Contributor

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[Any, Any, Any], /) -> list[Any]
+ tests/wasm/json2mc.py:103: note:     def __getitem__(self, slice[Optional[SupportsIndex], Optional[SupportsIndex], Optional[SupportsIndex]], /) -> list[Any]

freqtrade (https://github.com/freqtrade/freqtrade)
- freqtrade/rpc/telegram.py:408: note:     def __getitem__(self, SupportsIndex | slice[Any, Any, Any], /) -> str
+ freqtrade/rpc/telegram.py:408: note:     def __getitem__(self, SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str
- freqtrade/rpc/telegram.py:408: note:     def __getitem__(self, slice[Any, Any, Any], /) -> bytes
+ freqtrade/rpc/telegram.py:408: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> bytes
- freqtrade/rpc/telegram.py:409: note:     def __getitem__(self, SupportsIndex | slice[Any, Any, Any], /) -> str
+ freqtrade/rpc/telegram.py:409: note:     def __getitem__(self, SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str
- freqtrade/rpc/telegram.py:409: note:     def __getitem__(self, slice[Any, Any, Any], /) -> bytes
+ freqtrade/rpc/telegram.py:409: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> bytes
- freqtrade/templates/FreqaiExampleStrategy.py:287: note:     def __getitem__(self, SupportsIndex | slice[Any, Any, Any], /) -> str
+ freqtrade/templates/FreqaiExampleStrategy.py:287: note:     def __getitem__(self, SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str
- freqtrade/templates/FreqaiExampleStrategy.py:287: note:     def __getitem__(self, slice[Any, Any, Any], /) -> bytes
+ freqtrade/templates/FreqaiExampleStrategy.py:287: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> bytes
- freqtrade/templates/FreqaiExampleStrategy.py:290: note:     def __getitem__(self, SupportsIndex | slice[Any, Any, Any], /) -> str
+ freqtrade/templates/FreqaiExampleStrategy.py:290: note:     def __getitem__(self, SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str
- freqtrade/templates/FreqaiExampleStrategy.py:290: note:     def __getitem__(self, slice[Any, Any, Any], /) -> bytes
+ freqtrade/templates/FreqaiExampleStrategy.py:290: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> bytes

colour (https://github.com/colour-science/colour)
- colour/models/tests/test_hunter_rdab.py:159: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_hunter_rdab.py:159: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_hunter_rdab.py:294: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_hunter_rdab.py:294: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_hunter_lab.py:233: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_hunter_lab.py:233: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_hunter_lab.py:368: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_hunter_lab.py:368: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_hdr_ipt.py:230: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_hdr_ipt.py:230: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_hdr_ipt.py:337: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_hdr_ipt.py:337: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_hdr_cie_lab.py:251: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_hdr_cie_lab.py:251: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_hdr_cie_lab.py:376: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_hdr_cie_lab.py:376: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_uvw.py:133: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_uvw.py:133: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_uvw.py:243: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_uvw.py:243: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_luv.py:148: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_luv.py:148: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_luv.py:258: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_luv.py:258: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_luv.py:368: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_luv.py:368: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_luv.py:485: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_luv.py:485: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_luv.py:710: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_luv.py:710: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_luv.py:823: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_luv.py:823: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_lab.py:133: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_lab.py:133: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_lab.py:243: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_lab.py:243: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/rgb/tests/test_rgb_colourspace.py:477: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/rgb/tests/test_rgb_colourspace.py:477: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/rgb/tests/test_rgb_colourspace.py:677: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/rgb/tests/test_rgb_colourspace.py:677: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/colorimetry/tests/test_whiteness.py:475: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/colorimetry/tests/test_whiteness.py:475: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/colorimetry/tests/test_whiteness.py:574: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/colorimetry/tests/test_whiteness.py:574: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_scam.py:215: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_scam.py:215: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_scam.py:404: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_scam.py:404: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_scam.py:406: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_scam.py:406: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_scam.py:407: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_scam.py:407: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_rlab.py:155: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_rlab.py:155: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_nayatani95.py:155: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_nayatani95.py:155: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_llab.py:223: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_llab.py:223: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_llab.py:224: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_llab.py:224: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_llab.py:225: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_llab.py:225: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_llab.py:434: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_llab.py:434: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_llab.py:435: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_llab.py:435: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_llab.py:438: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_llab.py:438: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_llab.py:441: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_llab.py:441: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_kim2009.py:223: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_kim2009.py:223: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_kim2009.py:224: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_kim2009.py:224: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_kim2009.py:225: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_kim2009.py:225: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_kim2009.py:434: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_kim2009.py:434: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_kim2009.py:435: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_kim2009.py:435: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_kim2009.py:438: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_kim2009.py:438: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_kim2009.py:441: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_kim2009.py:441: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_hunt.py:231: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_hunt.py:231: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_hunt.py:236: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_hunt.py:236: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_hunt.py:238: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_hunt.py:238: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_hellwig2022.py:242: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_hellwig2022.py:242: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_hellwig2022.py:243: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_hellwig2022.py:243: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_hellwig2022.py:449: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_hellwig2022.py:449: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_hellwig2022.py:452: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_hellwig2022.py:452: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_hellwig2022.py:455: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_hellwig2022.py:455: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_hellwig2022.py:456: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_hellwig2022.py:456: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam16.py:264: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_ciecam16.py:264: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam16.py:265: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_ciecam16.py:265: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam16.py:465: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_ciecam16.py:465: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam16.py:468: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_ciecam16.py:468: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam16.py:471: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_ciecam16.py:471: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam16.py:472: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_ciecam16.py:472: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam02.py:205: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_ciecam02.py:205: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam02.py:206: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_ciecam02.py:206: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam02.py:401: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_ciecam02.py:401: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam02.py:404: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_ciecam02.py:404: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam02.py:407: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_ciecam02.py:407: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam02.py:408: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_ciecam02.py:408: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_cam16.py:239: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_cam16.py:239: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_cam16.py:240: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_cam16.py:240: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_cam16.py:418: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_cam16.py:418: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_cam16.py:420: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_cam16.py:420: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_cam16.py:422: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_cam16.py:422: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_cam16.py:423: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_cam16.py:423: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_atd95.py:201: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_atd95.py:201: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/adaptation/tests/test_zhai2018.py:176: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/adaptation/tests/test_zhai2018.py:176: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/adaptation/tests/test_li2025.py:166: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/adaptation/tests/test_li2025.py:166: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/adaptation/tests/test_cmccat2000.py:162: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/adaptation/tests/test_cmccat2000.py:162: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/adaptation/tests/test_cmccat2000.py:297: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/adaptation/tests/test_cmccat2000.py:297: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/adaptation/tests/test_cie1994.py:158: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/adaptation/tests/test_cie1994.py:158: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/adaptation/tests/test_cie1994.py:159: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/adaptation/tests/test_cie1994.py:159: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/adaptation/tests/test_cie1994.py:160: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/adaptation/tests/test_cie1994.py:160: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/adaptation/tests/test_cie1994.py:161: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/adaptation/tests/test_cie1994.py:161: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/adaptation/tests/test_cie1994.py:162: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/adaptation/tests/test_cie1994.py:162: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]

apprise (https://github.com/caronc/apprise)
- apprise/config/base.py:795: note:     def __getitem__(self, SupportsIndex | slice[Any, Any, Any], /) -> str
+ apprise/config/base.py:795: note:     def __getitem__(self, SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str
- apprise/config/base.py:823: note:     def __getitem__(self, SupportsIndex | slice[Any, Any, Any], /) -> str
+ apprise/config/base.py:823: note:     def __getitem__(self, SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/infrastructure/provisioners/container_instance.py:274: note:     def __getitem__(self, SupportsIndex | slice[Any, Any, Any], /) -> str
+ src/prefect/infrastructure/provisioners/container_instance.py:274: note:     def __getitem__(self, SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str
- src/prefect/infrastructure/provisioners/container_instance.py:275: note:     def __getitem__(self, SupportsIndex | slice[Any, Any, Any], /) -> str
+ src/prefect/infrastructure/provisioners/container_instance.py:275: note:     def __getitem__(self, SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str
- src/prefect/infrastructure/provisioners/container_instance.py:347: note:     def __getitem__(self, SupportsIndex | slice[Any, Any, Any], /) -> str
+ src/prefect/infrastructure/provisioners/container_instance.py:347: note:     def __getitem__(self, SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str
- src/prefect/infrastructure/provisioners/container_instance.py:356: note:     def __getitem__(self, SupportsIndex | slice[Any, Any, Any], /) -> str
+ src/prefect/infrastructure/provisioners/container_instance.py:356: note:     def __getitem__(self, SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str
- src/prefect/infrastructure/provisioners/container_instance.py:413: note:     def __getitem__(self, SupportsIndex | slice[Any, Any, Any], /) -> str
+ src/prefect/infrastructure/provisioners/container_instance.py:413: note:     def __getitem__(self, SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str
- src/prefect/infrastructure/provisioners/container_instance.py:638: note:     def __getitem__(self, SupportsIndex | slice[Any, Any, Any], /) -> str
+ src/prefect/infrastructure/provisioners/container_instance.py:638: note:     def __getitem__(self, SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str
- src/prefect/cli/deploy/_actions.py:165: note:     def __setitem__(self, slice[Any, Any, Any], Iterable[dict[str, Any]], /) -> None
+ src/prefect/cli/deploy/_actions.py:165: note:     def __setitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], Iterable[dict[str, Any]], /) -> None
- src/prefect/cli/deploy/_actions.py:193: note:     def __setitem__(self, slice[Any, Any, Any], Iterable[dict[str, Any]], /) -> None
+ src/prefect/cli/deploy/_actions.py:193: note:     def __setitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], Iterable[dict[str, Any]], /) -> None
- src/prefect/cli/deploy/_actions.py:201: note:     def __setitem__(self, slice[Any, Any, Any], Iterable[dict[str, Any]], /) -> None
+ src/prefect/cli/deploy/_actions.py:201: note:     def __setitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], Iterable[dict[str, Any]], /) -> None
- src/prefect/cli/deploy/_actions.py:220: note:     def __getitem__(self, slice[Any, Any, Any], /) -> list[dict[str, Any]]
+ src/prefect/cli/deploy/_actions.py:220: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[dict[str, Any]]

scipy (https://github.com/scipy/scipy)
- scipy/spatial/transform/_rotation_xp.py:539: note:     def __getitem__(self, SupportsIndex | slice[Any, Any, Any], /) -> str
+ scipy/spatial/transform/_rotation_xp.py:539: note:     def __getitem__(self, SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str
- scipy/spatial/transform/_rigid_transform_xp.py:300: note:     def __getitem__(self, SupportsIndex | slice[Any, Any, Any], /) -> str
+ scipy/spatial/transform/_rigid_transform_xp.py:300: note:     def __getitem__(self, SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str
- scipy/spatial/transform/_rigid_transform_xp.py:301: note:     def __getitem__(self, SupportsIndex | slice[Any, Any, Any], /) -> str
+ scipy/spatial/transform/_rigid_transform_xp.py:301: note:     def __getitem__(self, SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str

discord.py (https://github.com/Rapptz/discord.py)
- discord/http.py:242: note:     def __setitem__(self, slice[Any, Any, Any], Iterable[Embed], /) -> None
+ discord/http.py:242: note:     def __setitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], Iterable[Embed], /) -> None

operator (https://github.com/canonical/operator)
- ops/framework.py:1385: note:          def __getitem__(self, slice[Any, Any, Any], /) -> MutableSequence[Any]
+ ops/framework.py:1385: note:          def __getitem__(self, slice[int | None, int | None, int | None], /) -> MutableSequence[Any]
- ops/framework.py:1385: note:          def __getitem__(self, slice[Any, Any, Any], /) -> Sequence[Any]
+ ops/framework.py:1385: note:          def __getitem__(self, slice[int | None, int | None, int | None], /) -> Sequence[Any]
- ops/framework.py:1388: note:          def __setitem__(self, slice[Any, Any, Any], Iterable[Any], /) -> None
+ ops/framework.py:1388: note:          def __setitem__(self, slice[int | None, int | None, int | None], Iterable[Any], /) -> None
- ops/framework.py:1392: note:          def __delitem__(self, slice[Any, Any, Any], /) -> None
+ ops/framework.py:1392: note:          def __delitem__(self, slice[int | None, int | None, int | None], /) -> None

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/web_routedef.py:151:6: error: Signature of "__getitem__" incompatible with supertype "typing.Sequence"  [override]
+ aiohttp/web_routedef.py:151:6: note:      Superclass:
+ aiohttp/web_routedef.py:151:6: note:          @overload
+ aiohttp/web_routedef.py:151:6: note:          def __getitem__(self, int, /) -> AbstractRouteDef
+ aiohttp/web_routedef.py:151:6: note:          @overload
+ aiohttp/web_routedef.py:151:6: note:          def __getitem__(self, slice[int | None, int | None, int | None], /) -> Sequence[AbstractRouteDef]
+ aiohttp/web_routedef.py:151:6: note:      Subclass:
+ aiohttp/web_routedef.py:151:6: note:          @overload
+ aiohttp/web_routedef.py:151:6: note:          def __getitem__(self, int, /) -> AbstractRouteDef
+ aiohttp/web_routedef.py:151:6: note:          @overload
+ aiohttp/web_routedef.py:151:6: note:          def __getitem__(self, slice[int, int, int], /) -> list[AbstractRouteDef]

@randolf-scholz
Copy link
Contributor Author

Hm, the only thing that sticks out to me is the aiohttp case: must implementations of Sequence support open-ended slices?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants