66import posixpath
77from abc import ABC , abstractmethod
88from collections .abc import Mapping as Mapping_abc
9- from collections .abc import Sequence as Sequence_abc
109from typing import (
1110 Any ,
1211 Generator ,
1312 Iterator ,
1413 Optional ,
14+ SupportsIndex ,
1515 Tuple ,
1616 TypeVar ,
1717 cast ,
@@ -198,7 +198,7 @@ def __init__(
198198 self ._path = path
199199
200200
201- class ReadOnlySequence (Sequence_abc [ResourceDictT ]):
201+ class ReadOnlySequence (Tuple [ResourceDictT , ... ]):
202202 """Read only Sequence."""
203203
204204 _data : Tuple [ResourceDictT , ...]
@@ -222,13 +222,17 @@ def __len__(self) -> int:
222222 return len (tuple (self ._data ))
223223
224224 @overload
225- def __getitem__ (self , index : int ) -> ResourceDictT : ...
225+ def __getitem__ (self , key : SupportsIndex , / ) -> ResourceDictT : ...
226226
227227 @overload
228- def __getitem__ (self , index : slice ) -> Tuple [ResourceDictT , ...]: ...
228+ def __getitem__ (self , key : slice , / ) -> tuple [ResourceDictT , ...]: ...
229229
230- def __getitem__ (self , index : int | slice ) -> ResourceDictT | Tuple [ResourceDictT , ...]:
231- return self ._data [index ]
230+ def __getitem__ (
231+ self ,
232+ key : SupportsIndex | slice ,
233+ / ,
234+ ) -> ResourceDictT | tuple [ResourceDictT , ...]:
235+ return self ._data [key ]
232236
233237 def __iter__ (self ) -> Iterator [ResourceDictT ]:
234238 return iter (self ._data )
0 commit comments