Skip to content

Commit 2a14d49

Browse files
committed
📝 Fix missing getitem
1 parent ff182ae commit 2a14d49

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

slhdsa/asn/schema.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Any, ClassVar, Dict, Iterable, Tuple, Type, TypeVar, get_type_hints
3+
from typing import Any, ClassVar, Dict, Iterable, Iterator, Tuple, Type, TypeVar, get_type_hints, overload
44

55
__all__ = [
66
"ASN1Error",
@@ -150,13 +150,19 @@ def __init__(self, value: Iterable[int]):
150150
_validate_oid(arcs)
151151
self.arcs = arcs
152152

153-
def __iter__(self): # pragma: no cover - trivial
153+
def __iter__(self) -> Iterator[int]: # pragma: no cover - trivial
154154
return iter(self.arcs)
155155

156156
def __len__(self) -> int: # pragma: no cover - trivial
157157
return len(self.arcs)
158158

159-
def __getitem__(self, idx: int) -> int: # pragma: no cover - trivial
159+
@overload
160+
def __getitem__(self, idx: int) -> int: ...
161+
162+
@overload
163+
def __getitem__(self, idx: slice) -> tuple[int, ...]: ...
164+
165+
def __getitem__(self, idx: int | slice) -> int | tuple[int, ...]: # pragma: no cover - trivial
160166
return self.arcs[idx]
161167

162168
def __eq__(self, other: object) -> bool:

0 commit comments

Comments
 (0)