Skip to content

Commit

Permalink
Added abstract methods to stubs (#64)
Browse files Browse the repository at this point in the history
* Added abstract methods to stubs

* Reformatted
  • Loading branch information
gentlegiantJGC authored Feb 27, 2024
1 parent 4a60303 commit 17d2e96
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/amulet_nbt/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ from typing import (
Mapping,
Optional,
)
from collections.abc import MutableSequence, MutableMapping, Sequence
from collections.abc import MutableSequence, MutableMapping
import numpy
from numpy.typing import NDArray, ArrayLike

Expand Down Expand Up @@ -388,6 +388,23 @@ class ListTag(AbstractBaseMutableTag, MutableSequence[AnyNBTT]):
def get_byte_array(self, index: int) -> ByteArrayTag: ...
def get_int_array(self, index: int) -> IntArrayTag: ...
def get_long_array(self, index: int) -> LongArrayTag: ...
def insert(self, index: int, value: AnyNBT) -> None:
pass

@overload
def __getitem__(self, index: int) -> AnyNBT: ...
@overload
def __getitem__(self, index: slice) -> list[AnyNBT]: ...
@overload
def __setitem__(self, index: int, value: AnyNBT) -> None: ...
@overload
def __setitem__(self, index: slice, value: Iterable[AnyNBT]) -> None: ...
@overload
def __delitem__(self, index: int) -> None: ...
@overload
def __delitem__(self, index: slice) -> None: ...
def __len__(self) -> int:
pass

_TagT = TypeVar("_TagT", bound=AbstractBaseTag)

Expand Down Expand Up @@ -535,6 +552,11 @@ class CompoundTag(AbstractBaseMutableTag, MutableMapping[str | bytes, AnyNBT]):
def setdefault_long_array(
self, key: str | bytes, default: LongArrayTag | None = None
) -> LongArrayTag: ...
def __setitem__(self, key: str | bytes, value: AnyNBT) -> None: ...
def __delitem__(self, key: str | bytes) -> None: ...
def __getitem__(self, key: str | bytes) -> AnyNBT: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[str | bytes]: ...

class AbstractBaseArrayTag(AbstractBaseMutableTag):
def __init__(self, value: Iterable[SupportsInt] = ()) -> None: ...
Expand Down

0 comments on commit 17d2e96

Please sign in to comment.