tsrkit-types 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
tsrkit_types/bytes.py CHANGED
@@ -1,6 +1,4 @@
1
- from typing import Tuple, Union, ClassVar, Self
2
- import base64
3
-
1
+ from typing import Tuple, Union, ClassVar
4
2
  from tsrkit_types.integers import Uint
5
3
  from tsrkit_types.itf.codable import Codable
6
4
 
@@ -22,7 +20,7 @@ class Bytes(bytes, Codable):
22
20
  return f"{self.__class__.__name__}({self.hex()})"
23
21
 
24
22
  @classmethod
25
- def from_bits(cls, bits: list[bool], bit_order = "msb") -> Self:
23
+ def from_bits(cls, bits: list[bool], bit_order = "msb") -> "Bytes":
26
24
  # Sanitize input: make sure bits are 0 or 1
27
25
  bits = [int(bool(b)) for b in bits]
28
26
  n = len(bits)
@@ -79,7 +77,7 @@ class Bytes(bytes, Codable):
79
77
  return current_offset - offset
80
78
 
81
79
  @classmethod
82
- def decode_from(cls, buffer: Union[bytes, bytearray, memoryview], offset: int = 0) -> Tuple[Self, int]:
80
+ def decode_from(cls, buffer: Union[bytes, bytearray, memoryview], offset: int = 0) -> Tuple["Bytes", int]:
83
81
  current_offset = offset
84
82
  _len = cls._length
85
83
  if _len is None:
tsrkit_types/enum.py CHANGED
@@ -20,8 +20,8 @@ class Enum(metaclass=EnumMeta):
20
20
  >>> assert decoded == value
21
21
  >>> assert bytes_read == 1
22
22
  >>>
23
- >>> assert MyEnum.from_json(1,) == MyEnum.A
24
- >>> assert MyEnum.from_json("A",) == MyEnum.A
23
+ >>> assert MyEnum.from_json(1) == MyEnum.A
24
+ >>> assert MyEnum.from_json("A") == MyEnum.A
25
25
  """
26
26
 
27
27
  @property
@@ -106,7 +106,7 @@ class Enum(metaclass=EnumMeta):
106
106
  The corresponding enum value
107
107
 
108
108
  Raises:
109
- JsonDeserializationError: If the value is invalid
109
+ ValueError: If the value is invalid
110
110
  """
111
111
  for v in cls.__members__.values():
112
112
  if v._value_ == data or v._name_ == data:
tsrkit_types/null.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Optional, Self, Tuple, Union
1
+ from typing import Optional, Tuple, Union
2
2
 
3
3
 
4
4
  class NullType:
@@ -22,7 +22,7 @@ class NullType:
22
22
  return 0
23
23
 
24
24
  @classmethod
25
- def decode_from(cls, buffer: Union[bytes, bytearray, memoryview], offset: int = 0) -> Tuple[Self, int]:
25
+ def decode_from(cls, buffer: Union[bytes, bytearray, memoryview], offset: int = 0) -> Tuple['NullType', int]:
26
26
  return cls(), 0
27
27
 
28
28
  # ---------------------------------------------------------------------------- #
@@ -33,7 +33,7 @@ class NullType:
33
33
  return None
34
34
 
35
35
  @classmethod
36
- def from_json(cls, json_str: Optional[str]) -> Self:
36
+ def from_json(cls, json_str: Optional[str]) -> 'NullType':
37
37
  if json_str is None:
38
38
  return cls()
39
39
  raise ValueError("Invalid JSON string for NullType")
tsrkit_types/sequences.py CHANGED
@@ -84,7 +84,7 @@ class Seq(list, Codable, Generic[T], metaclass=SeqCheckMeta):
84
84
  raise TypeError(f"{value!r} is not an instance of {self._element_type!r}")
85
85
 
86
86
  def _validate_self(self):
87
- """For Resultant Self check - added to fns that alter size"""
87
+ """For Resultant self check - added to fns that alter size"""
88
88
  if len(self) < self._min_length:
89
89
  raise ValueError(f"Vector: Expected sequence size to be >= {self._min_length}, resultant size {len(self)}")
90
90
  elif len(self) > self._max_length:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tsrkit-types
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Performant Python Typings library for type-safe binary serialization, JSON encoding, and data validation with zero dependencies
5
5
  Author-email: chainscore-labs <hello@chainscore.finance>, prasad-kumkar <prasad@chainscore.finance>
6
6
  License-Expression: MIT
@@ -15,7 +15,6 @@ Classifier: Intended Audience :: Developers
15
15
  Classifier: Intended Audience :: System Administrators
16
16
  Classifier: Operating System :: OS Independent
17
17
  Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.10
19
18
  Classifier: Programming Language :: Python :: 3.11
20
19
  Classifier: Programming Language :: Python :: 3.12
21
20
  Classifier: Programming Language :: Python :: 3 :: Only
@@ -28,7 +27,7 @@ Classifier: Topic :: Utilities
28
27
  Classifier: Topic :: System :: Archiving
29
28
  Classifier: Topic :: Communications
30
29
  Classifier: Typing :: Typed
31
- Requires-Python: >=3.10
30
+ Requires-Python: >=3.11
32
31
  Description-Content-Type: text/markdown
33
32
  License-File: LICENSE
34
33
  Provides-Extra: dev
@@ -735,6 +734,6 @@ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for gui
735
734
 
736
735
  ## Requirements
737
736
 
738
- - **Python**: >= 3.10
737
+ - **Python**: >= 3.11
739
738
  - **Runtime Dependencies**: None (zero dependencies!)
740
739
  - **Development Dependencies**: pytest and plugins (see `pyproject.toml`)
@@ -1,19 +1,19 @@
1
1
  tsrkit_types/__init__.py,sha256=Vw03Fv9RnfmZGqzBpFhuglyewh4MxKR8T5bdWdal1VU,1870
2
2
  tsrkit_types/bits.py,sha256=ggx2lDRWtBBIYQBtKEx-XirwYTJdajctCEpd3VmuXrc,3275
3
3
  tsrkit_types/bool.py,sha256=anu5RquxV8xdDMj7aIwOOCP3WnK6vMNst4WUPlfeKm4,1460
4
- tsrkit_types/bytes.py,sha256=t4GeqbYMloKrTu4XyGSRquMhQL4Ayr-S4vgZhZBS9BU,3771
4
+ tsrkit_types/bytes.py,sha256=rw0sjw1fO9bOElftWehs8oLCZFMXWeajjCyOH-5kChU,3756
5
5
  tsrkit_types/choice.py,sha256=L4Pb0ZBvaoCW2h9VBLclmmgIJvfO0Yeb2khPniFN2Xo,5113
6
6
  tsrkit_types/dictionary.py,sha256=EktyMKH27HVoR1xNhrkV8fW6KfcxpbHiiYPYoCrFdoI,5614
7
- tsrkit_types/enum.py,sha256=0PZUuydhGVN6zmAscQNzq4Vnn5mUUPIxlDoQBodqf7g,4272
7
+ tsrkit_types/enum.py,sha256=3MyLW15_ToQQdctJjcMY8Xb3OsS_Ad997OOEo8FjVeA,4256
8
8
  tsrkit_types/integers.py,sha256=GT9xVZYBNMcPpShJIlSazwiZYGhoBowhR0MA_cGO5Q0,7200
9
- tsrkit_types/null.py,sha256=IcYYY5ZT7cZ5q5oyc0mCFGUCVCdhAXB_ftyAM9z5_Ek,1312
9
+ tsrkit_types/null.py,sha256=OwHVhWLdazaFLXXR8iHPaHe67NPmYHDCavBxUfcZ53s,1318
10
10
  tsrkit_types/option.py,sha256=V4J8SmhUDjINqMM6Ml3ho0YwTy2UT-avrjoYh32Swyg,879
11
- tsrkit_types/sequences.py,sha256=2vJeO47rmIN7WQjFGKudDhzDVifTNmrj1whE03npz3c,8092
11
+ tsrkit_types/sequences.py,sha256=6aseAdoAkD3RG20ag6CTzVZPR_YlJfLHo82JrNZY3dE,8092
12
12
  tsrkit_types/string.py,sha256=8rvg0BwvyhQnbMW3qornmBFTQHeTQFUfwD7OC0eVgcY,2575
13
13
  tsrkit_types/struct.py,sha256=ni8jwZlfT_wehardfImBJ0AsvnO-oCW-3APplLXsqGY,3206
14
14
  tsrkit_types/itf/codable.py,sha256=jWfoYZ31MZ6k3nlHb2IwJdjD3G0pVPyZWlF0Sv9MAWs,2794
15
- tsrkit_types-0.1.1.dist-info/licenses/LICENSE,sha256=TwnDvVCPwHadHWLUuY1sPx03XNw1jzh_ZmoDBNai9Uc,1072
16
- tsrkit_types-0.1.1.dist-info/METADATA,sha256=Yuq6ylZlPzHnNpfEGIio0FFMS13G6oMPHkFwGVAjkm0,19404
17
- tsrkit_types-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
- tsrkit_types-0.1.1.dist-info/top_level.txt,sha256=pnVhnUsnZ_A0FIj1zHwDw3suMGrfMJwusp-4GPVY1CM,13
19
- tsrkit_types-0.1.1.dist-info/RECORD,,
15
+ tsrkit_types-0.1.2.dist-info/licenses/LICENSE,sha256=TwnDvVCPwHadHWLUuY1sPx03XNw1jzh_ZmoDBNai9Uc,1072
16
+ tsrkit_types-0.1.2.dist-info/METADATA,sha256=Yt9wxA4VDq7jhjzPGrrpcQ4rhjgMUQN3hoTl9rjT3ec,19353
17
+ tsrkit_types-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
+ tsrkit_types-0.1.2.dist-info/top_level.txt,sha256=pnVhnUsnZ_A0FIj1zHwDw3suMGrfMJwusp-4GPVY1CM,13
19
+ tsrkit_types-0.1.2.dist-info/RECORD,,