typeid-python 0.3.1__tar.gz → 0.3.2__tar.gz

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.

@@ -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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "typeid-python"
3
- version = "0.3.1"
3
+ version = "0.3.2"
4
4
  description = "Python implementation of TypeIDs: type-safe, K-sortable, and globally unique identifiers inspired by Stripe IDs"
5
5
  authors = ["Murad Akhundov <akhundov1murad@gmail.com>"]
6
6
  license = "MIT"
@@ -9,11 +9,11 @@ repository = "https://github.com/akhundMurad/typeid-python"
9
9
  classifiers = [
10
10
  "Development Status :: 3 - Alpha",
11
11
  "License :: OSI Approved :: MIT License",
12
- "Programming Language :: Python :: 3.8",
13
12
  "Programming Language :: Python :: 3.9",
14
13
  "Programming Language :: Python :: 3.10",
15
14
  "Programming Language :: Python :: 3.11",
16
15
  "Programming Language :: Python :: 3.12",
16
+ "Programming Language :: Python :: 3.13",
17
17
  "Operating System :: OS Independent",
18
18
  ]
19
19
  keywords = ["typeid", "uuid", "uuid6", "guid"]
@@ -44,7 +44,7 @@ exclude = [
44
44
 
45
45
 
46
46
  [tool.poetry.dependencies]
47
- python = ">=3.8,<4"
47
+ python = ">=3.9,<4"
48
48
  uuid6 = ">=2023.5.2"
49
49
 
50
50
 
@@ -0,0 +1,14 @@
1
+ class TypeIDException(Exception):
2
+ ...
3
+
4
+
5
+ class PrefixValidationException(TypeIDException):
6
+ ...
7
+
8
+
9
+ class SuffixValidationException(TypeIDException):
10
+ ...
11
+
12
+
13
+ class InvalidTypeIDStringException(TypeIDException):
14
+ ...
File without changes
@@ -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,14 +0,0 @@
1
- class TypeIDException(Exception):
2
- ...
3
-
4
-
5
- class PrefixValidationException(Exception):
6
- ...
7
-
8
-
9
- class SuffixValidationException(Exception):
10
- ...
11
-
12
-
13
- class InvalidTypeIDStringException(Exception):
14
- ...
File without changes
File without changes