From fa4849f6bf4cad83b5753946155e42224eeab783 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Sun, 12 Nov 2023 15:13:42 +0000 Subject: [PATCH 1/2] Added missing type hints --- amulet_nbt/_compound.pyi | 8 +++++++- amulet_nbt/_list.pyi | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/amulet_nbt/_compound.pyi b/amulet_nbt/_compound.pyi index 1799fe6d..52401978 100644 --- a/amulet_nbt/_compound.pyi +++ b/amulet_nbt/_compound.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, Iterable +from typing import Any, Dict, Iterable, Iterator from collections.abc import MutableMapping from ._value import AbstractBaseMutableTag, AbstractBaseTag @@ -52,3 +52,9 @@ class CompoundTag(AbstractBaseMutableTag, MutableMapping[str, AnyNBT]): def setdefault_long_array( self, key: str, default: LongArrayTag = None ) -> LongArrayTag: ... + def __getitem__(self, item: str) -> AnyNBT:... + def __setitem__(self, key: str, value: AnyNBT) -> None:... + + def __delitem__(self, item: str) -> None: ... + def __iter__(self) -> Iterator[str]: ... + def __len__(self) -> int:... diff --git a/amulet_nbt/_list.pyi b/amulet_nbt/_list.pyi index 6a098d32..08ab3533 100644 --- a/amulet_nbt/_list.pyi +++ b/amulet_nbt/_list.pyi @@ -1,4 +1,4 @@ -from typing import Iterable, overload, List, TypeVar +from typing import Iterable, overload, List, TypeVar, overload from collections.abc import MutableSequence from ._value import AbstractBaseMutableTag @@ -33,3 +33,8 @@ 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 __getitem__(self, item: int) -> AnyNBTT:... + def __setitem__(self, key: int, value: AnyNBTT) -> None:... + def __delitem__(self, key: int) -> None:... + def __len__(self) -> int:... + def insert(self, index: int, item: AnyNBTT) -> None:... From 905c232fa391b73f152a5ff9f6f47e8f56c5b0e3 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Sun, 12 Nov 2023 15:17:56 +0000 Subject: [PATCH 2/2] Reformatted --- amulet_nbt/_compound.pyi | 7 +++---- amulet_nbt/_list.pyi | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/amulet_nbt/_compound.pyi b/amulet_nbt/_compound.pyi index 52401978..23071b9e 100644 --- a/amulet_nbt/_compound.pyi +++ b/amulet_nbt/_compound.pyi @@ -52,9 +52,8 @@ class CompoundTag(AbstractBaseMutableTag, MutableMapping[str, AnyNBT]): def setdefault_long_array( self, key: str, default: LongArrayTag = None ) -> LongArrayTag: ... - def __getitem__(self, item: str) -> AnyNBT:... - def __setitem__(self, key: str, value: AnyNBT) -> None:... - + def __getitem__(self, item: str) -> AnyNBT: ... + def __setitem__(self, key: str, value: AnyNBT) -> None: ... def __delitem__(self, item: str) -> None: ... def __iter__(self) -> Iterator[str]: ... - def __len__(self) -> int:... + def __len__(self) -> int: ... diff --git a/amulet_nbt/_list.pyi b/amulet_nbt/_list.pyi index 08ab3533..8dd627bb 100644 --- a/amulet_nbt/_list.pyi +++ b/amulet_nbt/_list.pyi @@ -33,8 +33,8 @@ 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 __getitem__(self, item: int) -> AnyNBTT:... - def __setitem__(self, key: int, value: AnyNBTT) -> None:... - def __delitem__(self, key: int) -> None:... - def __len__(self) -> int:... - def insert(self, index: int, item: AnyNBTT) -> None:... + def __getitem__(self, item: int) -> AnyNBTT: ... + def __setitem__(self, key: int, value: AnyNBTT) -> None: ... + def __delitem__(self, key: int) -> None: ... + def __len__(self) -> int: ... + def insert(self, index: int, item: AnyNBTT) -> None: ...