|
3 | 3 | import uuid_utils |
4 | 4 | from typing import Generic, Optional, TypeVar |
5 | 5 |
|
6 | | -import uuid as std_uuid |
7 | | - |
8 | 6 | from typeid import base32 |
9 | 7 | from typeid.errors import InvalidTypeIDStringException |
10 | 8 | from typeid.validation import validate_prefix, validate_suffix_and_decode |
11 | 9 |
|
12 | 10 | PrefixT = TypeVar("PrefixT", bound=str) |
13 | 11 |
|
14 | 12 |
|
15 | | -def _uuid_from_bytes_v7(uuid_bytes: bytes) -> std_uuid.UUID: |
| 13 | +def _uuid_from_bytes_v7(uuid_bytes: bytes) -> uuid_utils.UUID: |
16 | 14 | """ |
17 | 15 | Construct a UUID object from bytes. |
18 | 16 | """ |
@@ -67,7 +65,7 @@ def __init__(self, prefix: Optional[PrefixT] = None, suffix: Optional[str] = Non |
67 | 65 | self._prefix: Optional[PrefixT] = prefix |
68 | 66 |
|
69 | 67 | self._str: Optional[str] = None |
70 | | - self._uuid: Optional[std_uuid.UUID] = None |
| 68 | + self._uuid: Optional[uuid_utils.UUID] = None |
71 | 69 | self._uuid_bytes: Optional[bytes] = None |
72 | 70 |
|
73 | 71 | if not suffix: |
@@ -109,7 +107,7 @@ def from_string(cls, string: str) -> "TypeID": |
109 | 107 | return cls(suffix=suffix, prefix=prefix) |
110 | 108 |
|
111 | 109 | @classmethod |
112 | | - def from_uuid(cls, suffix: std_uuid.UUID, prefix: Optional[PrefixT] = None) -> "TypeID": |
| 110 | + def from_uuid(cls, suffix: uuid_utils.UUID, prefix: Optional[PrefixT] = None) -> "TypeID": |
113 | 111 | """ |
114 | 112 | Construct a TypeID from an existing UUID. |
115 | 113 |
|
@@ -164,7 +162,7 @@ def prefix(self) -> str: |
164 | 162 | return self._prefix or "" |
165 | 163 |
|
166 | 164 | @property |
167 | | - def uuid(self) -> std_uuid.UUID: |
| 165 | + def uuid(self) -> uuid_utils.UUID: |
168 | 166 | """ |
169 | 167 | The UUID represented by this TypeID. |
170 | 168 |
|
@@ -296,7 +294,7 @@ def from_string(string: str) -> TypeID: |
296 | 294 | return TypeID.from_string(string=string) |
297 | 295 |
|
298 | 296 |
|
299 | | -def from_uuid(suffix: std_uuid.UUID, prefix: Optional[str] = None) -> TypeID: |
| 297 | +def from_uuid(suffix: uuid_utils.UUID, prefix: Optional[str] = None) -> TypeID: |
300 | 298 | warnings.warn("Consider TypeID.from_uuid instead.", DeprecationWarning) |
301 | 299 | return TypeID.from_uuid(suffix=suffix, prefix=prefix) |
302 | 300 |
|
|
0 commit comments