typeid-python 0.3.0__py3-none-any.whl → 0.3.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.

Potentially problematic release.


This version of typeid-python might be problematic. Click here for more details.

typeid/errors.py CHANGED
@@ -2,13 +2,13 @@ class TypeIDException(Exception):
2
2
  ...
3
3
 
4
4
 
5
- class PrefixValidationException(Exception):
5
+ class PrefixValidationException(TypeIDException):
6
6
  ...
7
7
 
8
8
 
9
- class SuffixValidationException(Exception):
9
+ class SuffixValidationException(TypeIDException):
10
10
  ...
11
11
 
12
12
 
13
- class InvalidTypeIDStringException(Exception):
13
+ class InvalidTypeIDStringException(TypeIDException):
14
14
  ...
typeid/py.typed ADDED
File without changes
typeid/typeid.py CHANGED
@@ -80,14 +80,17 @@ def from_uuid(suffix: uuid6.UUID, prefix: Optional[str] = None) -> TypeID:
80
80
 
81
81
 
82
82
  def get_prefix_and_suffix(string: str) -> tuple:
83
- parts = string.split("_")
84
- prefix = None
83
+ parts = string.rsplit("_", 1)
84
+
85
+ # When there's no underscore in the string.
85
86
  if len(parts) == 1:
86
- suffix = parts[0]
87
- elif len(parts) == 2 and parts[0] != "":
88
- suffix = parts[1]
89
- prefix = parts[0]
90
- else:
87
+ if parts[0].strip() == "":
88
+ raise InvalidTypeIDStringException(f"Invalid TypeID: {string}")
89
+ return None, parts[0]
90
+
91
+ # When there is an underscore, unpack prefix and suffix.
92
+ prefix, suffix = parts
93
+ if prefix.strip() == "" or suffix.strip() == "":
91
94
  raise InvalidTypeIDStringException(f"Invalid TypeID: {string}")
92
95
 
93
96
  return prefix, suffix
@@ -1,24 +1,24 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: typeid-python
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Python implementation of TypeIDs: type-safe, K-sortable, and globally unique identifiers inspired by Stripe IDs
5
5
  Home-page: https://github.com/akhundMurad/typeid-python
6
6
  License: MIT
7
7
  Keywords: typeid,uuid,uuid6,guid
8
8
  Author: Murad Akhundov
9
9
  Author-email: akhundov1murad@gmail.com
10
- Requires-Python: >=3.8,<4
10
+ Requires-Python: >=3.9,<4
11
11
  Classifier: Development Status :: 3 - Alpha
12
12
  Classifier: License :: OSI Approved :: MIT License
13
13
  Classifier: Operating System :: OS Independent
14
14
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.8
16
15
  Classifier: Programming Language :: Python :: 3.9
17
16
  Classifier: Programming Language :: Python :: 3.10
18
17
  Classifier: Programming Language :: Python :: 3.11
19
18
  Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
20
  Provides-Extra: cli
21
- Requires-Dist: uuid6 (>=2023.5.2,<2024.0.0)
21
+ Requires-Dist: uuid6 (>=2023.5.2)
22
22
  Project-URL: Repository, https://github.com/akhundMurad/typeid-python
23
23
  Description-Content-Type: text/markdown
24
24
 
@@ -0,0 +1,12 @@
1
+ typeid/__init__.py,sha256=bS8J12-a6sOcTIHBumVs9qLRxCX5P-KWVLeMw6m1e_U,149
2
+ typeid/base32.py,sha256=UTYXJjb95_nn-vYIpw7nquguBac4GZ0TL0oE6BuujPg,6504
3
+ typeid/cli.py,sha256=h93_EAOzWO3bqubgL83Q-smHp11lvxMjgAunwyTWwFM,872
4
+ typeid/constants.py,sha256=2ApV0agNys2yI9NM8oQZbyTR2rgP-VtxXGrM6glBB2Q,37
5
+ typeid/errors.py,sha256=2bSRH97Uvq_V1KnLadTmTNHAV5yOXOAHetJwz0YKDzc,225
6
+ typeid/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ typeid/typeid.py,sha256=EiFQYb31aX1reLpqYQHm0xIRv8L2ZAA7LFyuRmQSyuw,3194
8
+ typeid/validation.py,sha256=Cb9IkHrK1-HFukFYpSzyNGhllaF3MIZDcD5RnmsfrK8,910
9
+ typeid_python-0.3.2.dist-info/LICENSE,sha256=f98oZ9FId4i3835UJYGw066BU8PSc57L1utGWS1ypcs,1070
10
+ typeid_python-0.3.2.dist-info/METADATA,sha256=G2v8ENke_pE8P49XNAWgWBojnh0641ekN2I7sAKZt88,4115
11
+ typeid_python-0.3.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
+ typeid_python-0.3.2.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- typeid/__init__.py,sha256=bS8J12-a6sOcTIHBumVs9qLRxCX5P-KWVLeMw6m1e_U,149
2
- typeid/base32.py,sha256=UTYXJjb95_nn-vYIpw7nquguBac4GZ0TL0oE6BuujPg,6504
3
- typeid/cli.py,sha256=h93_EAOzWO3bqubgL83Q-smHp11lvxMjgAunwyTWwFM,872
4
- typeid/constants.py,sha256=2ApV0agNys2yI9NM8oQZbyTR2rgP-VtxXGrM6glBB2Q,37
5
- typeid/errors.py,sha256=QPHZ-DJg5OpPOHtuetsqMCYu-E_aHMJZTTeFqx9Gz_4,207
6
- typeid/typeid.py,sha256=clwA9ADePwO9bXclAk1G6_-ASGchRLaFbOvaBIyeyMU,3009
7
- typeid/validation.py,sha256=Cb9IkHrK1-HFukFYpSzyNGhllaF3MIZDcD5RnmsfrK8,910
8
- typeid_python-0.3.0.dist-info/LICENSE,sha256=f98oZ9FId4i3835UJYGw066BU8PSc57L1utGWS1ypcs,1070
9
- typeid_python-0.3.0.dist-info/METADATA,sha256=7kPAUATsQLMCKm5A1-fH49MrNh6qRyIuj8Frpl8_HTo,4124
10
- typeid_python-0.3.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
11
- typeid_python-0.3.0.dist-info/RECORD,,