typeid-python 0.3.1__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
@@ -81,13 +81,17 @@ def from_uuid(suffix: uuid6.UUID, prefix: Optional[str] = None) -> TypeID:
81
81
 
82
82
  def get_prefix_and_suffix(string: str) -> tuple:
83
83
  parts = string.rsplit("_", 1)
84
+
85
+ # When there's no underscore in the string.
84
86
  if len(parts) == 1:
85
- prefix = None
86
- suffix = parts[0]
87
- elif len(parts) == 2 and parts[0] == "":
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() == "":
88
94
  raise InvalidTypeIDStringException(f"Invalid TypeID: {string}")
89
- else:
90
- prefix, suffix = parts
91
95
 
92
96
  return prefix, suffix
93
97
 
@@ -1,22 +1,22 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: typeid-python
3
- Version: 0.3.1
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
21
  Requires-Dist: uuid6 (>=2023.5.2)
22
22
  Project-URL: Repository, https://github.com/akhundMurad/typeid-python
@@ -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=6deYh-fDaJdcKjs14TVzMVNnfzsU2M9f_4FdqWnlNw4,2996
7
- typeid/validation.py,sha256=Cb9IkHrK1-HFukFYpSzyNGhllaF3MIZDcD5RnmsfrK8,910
8
- typeid_python-0.3.1.dist-info/LICENSE,sha256=f98oZ9FId4i3835UJYGw066BU8PSc57L1utGWS1ypcs,1070
9
- typeid_python-0.3.1.dist-info/METADATA,sha256=3b8dCEoGwAlMgk3GcDuh2j5IoDBCWAEtcVeMQcvk5kQ,4114
10
- typeid_python-0.3.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
11
- typeid_python-0.3.1.dist-info/RECORD,,