Skip to content

Commit 64c5ae9

Browse files
committed
Use @overload typing for SpriteList.__getitem__
1 parent d98ef02 commit 64c5ae9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

arcade/sprite_list/sprite_list.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
Union,
2525
Generic,
2626
Callable,
27-
cast, Sized,
27+
cast,
28+
overload,
29+
Sized
2830
)
2931

3032
from arcade import (
@@ -249,6 +251,14 @@ def __iter__(self) -> Iterator[SpriteType]:
249251
"""Return an iterable object of sprites."""
250252
return iter(self.sprite_list)
251253

254+
@overload
255+
def __getitem__(self, i: int) -> SpriteType:
256+
...
257+
258+
@overload
259+
def __getitem__(self, i: slice) -> List[SpriteType]:
260+
...
261+
252262
def __getitem__(self, i):
253263
return self.sprite_list[i]
254264

0 commit comments

Comments
 (0)