uuid-utils 0.11.1__cp39-abi3-win32.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.
uuid_utils/__init__.py ADDED
@@ -0,0 +1,44 @@
1
+ from uuid import SafeUUID
2
+
3
+ from ._uuid_utils import (
4
+ NAMESPACE_DNS,
5
+ NAMESPACE_OID,
6
+ NAMESPACE_URL,
7
+ NAMESPACE_X500,
8
+ RESERVED_FUTURE,
9
+ RESERVED_MICROSOFT,
10
+ RESERVED_NCS,
11
+ RFC_4122,
12
+ UUID,
13
+ __version__,
14
+ getnode,
15
+ uuid1,
16
+ uuid3,
17
+ uuid4,
18
+ uuid5,
19
+ uuid6,
20
+ uuid7,
21
+ uuid8,
22
+ )
23
+
24
+ __all__ = [
25
+ "NAMESPACE_DNS",
26
+ "NAMESPACE_OID",
27
+ "NAMESPACE_URL",
28
+ "NAMESPACE_X500",
29
+ "RESERVED_FUTURE",
30
+ "RESERVED_MICROSOFT",
31
+ "RESERVED_NCS",
32
+ "RFC_4122",
33
+ "UUID",
34
+ "SafeUUID",
35
+ "__version__",
36
+ "getnode",
37
+ "uuid1",
38
+ "uuid3",
39
+ "uuid4",
40
+ "uuid5",
41
+ "uuid6",
42
+ "uuid7",
43
+ "uuid8",
44
+ ]
@@ -0,0 +1,201 @@
1
+ import builtins
2
+ import sys
3
+ from uuid import SafeUUID
4
+
5
+ from typing_extensions import TypeAlias
6
+
7
+ # Because UUID has properties called int and bytes we need to rename these temporarily.
8
+ _FieldsType: TypeAlias = tuple[int, int, int, int, int, int]
9
+
10
+ __version__: str
11
+
12
+ class UUID:
13
+ """Instances of the UUID class represent UUIDs as specified in RFC 4122.
14
+ UUID objects are immutable, hashable, and usable as dictionary keys.
15
+ Converting a UUID to a string with str() yields something in the form
16
+ '12345678-1234-1234-1234-123456789abc'. The UUID constructor accepts
17
+ five possible forms: a similar string of hexadecimal digits, or a tuple
18
+ of six integer fields (with 32-bit, 16-bit, 16-bit, 8-bit, 8-bit, and
19
+ 48-bit values respectively) as an argument named 'fields', or a string
20
+ of 16 bytes (with all the integer fields in big-endian order) as an
21
+ argument named 'bytes', or a string of 16 bytes (with the first three
22
+ fields in little-endian order) as an argument named 'bytes_le', or a
23
+ single 128-bit integer as an argument named 'int'.
24
+
25
+ UUIDs have these read-only attributes:
26
+
27
+ bytes the UUID as a 16-byte string (containing the six
28
+ integer fields in big-endian byte order)
29
+
30
+ bytes_le the UUID as a 16-byte string (with time_low, time_mid,
31
+ and time_hi_version in little-endian byte order)
32
+
33
+ fields a tuple of the six integer fields of the UUID,
34
+ which are also available as six individual attributes
35
+ and two derived attributes:
36
+
37
+ time_low the first 32 bits of the UUID
38
+ time_mid the next 16 bits of the UUID
39
+ time_hi_version the next 16 bits of the UUID
40
+ clock_seq_hi_variant the next 8 bits of the UUID
41
+ clock_seq_low the next 8 bits of the UUID
42
+ node the last 48 bits of the UUID
43
+
44
+ time the 60-bit timestamp
45
+ clock_seq the 14-bit sequence number
46
+
47
+ hex the UUID as a 32-character hexadecimal string
48
+
49
+ int the UUID as a 128-bit integer
50
+
51
+ urn the UUID as a URN as specified in RFC 4122
52
+
53
+ variant the UUID variant (one of the constants RESERVED_NCS,
54
+ RFC_4122, RESERVED_MICROSOFT, or RESERVED_FUTURE)
55
+
56
+ version the UUID version number
57
+
58
+ is_safe An enum indicating whether the UUID has been generated in
59
+ a way that is safe for multiprocessing applications, via
60
+ uuid_generate_time_safe(3).
61
+
62
+ timestamp The timestamp of the UUID in milliseconds since epoch.
63
+ Only works for UUID versions 1, 6 and 7,
64
+ otherwise raises ValueError.
65
+ """
66
+
67
+ def __init__(
68
+ self,
69
+ hex: str | None = None,
70
+ bytes: builtins.bytes | None = None,
71
+ bytes_le: builtins.bytes | None = None,
72
+ fields: _FieldsType | None = None,
73
+ int: builtins.int | None = None,
74
+ version: builtins.int | None = None,
75
+ *,
76
+ is_safe: SafeUUID = ...,
77
+ ) -> None: ...
78
+ @property
79
+ def is_safe(self) -> SafeUUID: ...
80
+ @property
81
+ def bytes(self) -> builtins.bytes: ...
82
+ @property
83
+ def bytes_le(self) -> builtins.bytes: ...
84
+ @property
85
+ def clock_seq(self) -> builtins.int: ...
86
+ @property
87
+ def clock_seq_hi_variant(self) -> builtins.int: ...
88
+ @property
89
+ def clock_seq_low(self) -> builtins.int: ...
90
+ @property
91
+ def fields(self) -> _FieldsType: ...
92
+ @property
93
+ def hex(self) -> str: ...
94
+ @property
95
+ def int(self) -> builtins.int: ...
96
+ @property
97
+ def node(self) -> builtins.int: ...
98
+ @property
99
+ def time(self) -> builtins.int: ...
100
+ @property
101
+ def time_hi_version(self) -> builtins.int: ...
102
+ @property
103
+ def time_low(self) -> builtins.int: ...
104
+ @property
105
+ def time_mid(self) -> builtins.int: ...
106
+ @property
107
+ def timestamp(self) -> builtins.int:
108
+ """Get UUID timestamp milliseconds since epoch.
109
+ Only works for UUID versions 1, 6 and 7, otherwise raises ValueError."""
110
+ ...
111
+
112
+ @property
113
+ def urn(self) -> str: ...
114
+ @property
115
+ def variant(self) -> str: ...
116
+ @property
117
+ def version(self) -> builtins.int | None: ...
118
+ def __int__(self) -> builtins.int: ...
119
+ def __eq__(self, other: object) -> bool: ...
120
+ def __lt__(self, other: UUID) -> bool: ...
121
+ def __le__(self, other: UUID) -> bool: ...
122
+ def __gt__(self, other: UUID) -> bool: ...
123
+ def __ge__(self, other: UUID) -> bool: ...
124
+
125
+ def getnode() -> int: ...
126
+ def uuid1(node: int | None = None, clock_seq: int | None = None) -> UUID:
127
+ """Generate a UUID from a host ID, sequence number, and the current time.
128
+ If 'node' is not given, getnode() is used to obtain the hardware
129
+ address. If 'clock_seq' is given, it is used as the sequence number;
130
+ otherwise a random 14-bit sequence number is chosen."""
131
+ ...
132
+
133
+ if sys.version_info >= (3, 12):
134
+ def uuid3(namespace: UUID, name: str | bytes) -> UUID:
135
+ """Generate a UUID from the MD5 hash of a namespace UUID and a name."""
136
+ ...
137
+ else:
138
+ def uuid3(namespace: UUID, name: str) -> UUID:
139
+ """Generate a UUID from the MD5 hash of a namespace UUID and a name."""
140
+ ...
141
+
142
+ def uuid4() -> UUID:
143
+ """Generate a random UUID."""
144
+ ...
145
+
146
+ if sys.version_info >= (3, 12):
147
+ def uuid5(namespace: UUID, name: str | bytes) -> UUID:
148
+ """Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
149
+ ...
150
+ else:
151
+ def uuid5(namespace: UUID, name: str) -> UUID:
152
+ """Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
153
+ ...
154
+
155
+ def uuid6(
156
+ node: int | None = None, timestamp: int | None = None, nanos: int | None = None
157
+ ) -> UUID:
158
+ """Generate a version 6 UUID using the given timestamp and a host ID.
159
+ This is similar to version 1 UUIDs,
160
+ except that it is lexicographically sortable by timestamp.
161
+ """
162
+ ...
163
+
164
+ def uuid7(timestamp: int | None = None, nanos: int | None = None) -> UUID:
165
+ """Generate a version 7 UUID using a time value and random bytes."""
166
+ ...
167
+
168
+ def uuid8(bytes: bytes) -> UUID:
169
+ """Generate a custom UUID comprised almost entirely of user-supplied bytes."""
170
+ ...
171
+
172
+ NAMESPACE_DNS: UUID
173
+ NAMESPACE_URL: UUID
174
+ NAMESPACE_OID: UUID
175
+ NAMESPACE_X500: UUID
176
+ RESERVED_NCS: str
177
+ RFC_4122: str
178
+ RESERVED_MICROSOFT: str
179
+ RESERVED_FUTURE: str
180
+
181
+ __all__ = [
182
+ "NAMESPACE_DNS",
183
+ "NAMESPACE_OID",
184
+ "NAMESPACE_URL",
185
+ "NAMESPACE_X500",
186
+ "RESERVED_FUTURE",
187
+ "RESERVED_MICROSOFT",
188
+ "RESERVED_NCS",
189
+ "RFC_4122",
190
+ "UUID",
191
+ "SafeUUID",
192
+ "__version__",
193
+ "getnode",
194
+ "uuid1",
195
+ "uuid3",
196
+ "uuid4",
197
+ "uuid5",
198
+ "uuid6",
199
+ "uuid7",
200
+ "uuid8",
201
+ ]
Binary file
@@ -0,0 +1,77 @@
1
+ from uuid import (
2
+ NAMESPACE_DNS,
3
+ NAMESPACE_OID,
4
+ NAMESPACE_URL,
5
+ NAMESPACE_X500,
6
+ RESERVED_FUTURE,
7
+ RESERVED_MICROSOFT,
8
+ RESERVED_NCS,
9
+ RFC_4122,
10
+ UUID,
11
+ getnode,
12
+ )
13
+
14
+ import uuid_utils
15
+
16
+ __all__ = [
17
+ "NAMESPACE_DNS",
18
+ "NAMESPACE_OID",
19
+ "NAMESPACE_URL",
20
+ "NAMESPACE_X500",
21
+ "RESERVED_FUTURE",
22
+ "RESERVED_MICROSOFT",
23
+ "RESERVED_NCS",
24
+ "RFC_4122",
25
+ "UUID",
26
+ "getnode",
27
+ "uuid1",
28
+ "uuid3",
29
+ "uuid4",
30
+ "uuid5",
31
+ "uuid6",
32
+ "uuid7",
33
+ "uuid8",
34
+ ]
35
+
36
+
37
+ def uuid1(node=None, clock_seq=None):
38
+ """Generate a UUID from a host ID, sequence number, and the current time.
39
+ If 'node' is not given, getnode() is used to obtain the hardware
40
+ address. If 'clock_seq' is given, it is used as the sequence number;
41
+ otherwise a random 14-bit sequence number is chosen."""
42
+ return UUID(int=uuid_utils.uuid1(node, clock_seq).int)
43
+
44
+
45
+ def uuid3(namespace, name):
46
+ """Generate a UUID from the MD5 hash of a namespace UUID and a name."""
47
+ namespace = uuid_utils.UUID(namespace.hex) if namespace else namespace
48
+ return UUID(int=uuid_utils.uuid3(namespace, name).int)
49
+
50
+
51
+ def uuid4():
52
+ """Generate a random UUID."""
53
+ return UUID(int=uuid_utils.uuid4().int)
54
+
55
+
56
+ def uuid5(namespace, name):
57
+ """Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
58
+ namespace = uuid_utils.UUID(namespace.hex) if namespace else namespace
59
+ return UUID(int=uuid_utils.uuid5(namespace, name).int)
60
+
61
+
62
+ def uuid6(node=None, timestamp=None):
63
+ """Generate a version 6 UUID using the given timestamp and a host ID.
64
+ This is similar to version 1 UUIDs,
65
+ except that it is lexicographically sortable by timestamp.
66
+ """
67
+ return UUID(int=uuid_utils.uuid6(node, timestamp).int)
68
+
69
+
70
+ def uuid7(timestamp=None, nanos=None):
71
+ """Generate a version 7 UUID using a time value and random bytes."""
72
+ return UUID(int=uuid_utils.uuid7(timestamp, nanos).int)
73
+
74
+
75
+ def uuid8(bytes):
76
+ """Generate a custom UUID comprised almost entirely of user-supplied bytes.."""
77
+ return UUID(bytes=uuid_utils.uuid8(bytes).bytes)
@@ -0,0 +1,79 @@
1
+ import sys
2
+ from uuid import (
3
+ NAMESPACE_DNS,
4
+ NAMESPACE_OID,
5
+ NAMESPACE_URL,
6
+ NAMESPACE_X500,
7
+ RESERVED_FUTURE,
8
+ RESERVED_MICROSOFT,
9
+ RESERVED_NCS,
10
+ RFC_4122,
11
+ UUID,
12
+ SafeUUID,
13
+ getnode,
14
+ )
15
+
16
+ from typing_extensions import TypeAlias
17
+
18
+ __all__ = [
19
+ "NAMESPACE_DNS",
20
+ "NAMESPACE_OID",
21
+ "NAMESPACE_URL",
22
+ "NAMESPACE_X500",
23
+ "RESERVED_FUTURE",
24
+ "RESERVED_MICROSOFT",
25
+ "RESERVED_NCS",
26
+ "RFC_4122",
27
+ "UUID",
28
+ "SafeUUID",
29
+ "getnode",
30
+ ]
31
+
32
+ # Because UUID has properties called int and bytes we need to rename these temporarily.
33
+ _Int: TypeAlias = int
34
+ _Bytes: TypeAlias = bytes
35
+
36
+ def uuid1(node: _Int | None = None, clock_seq: _Int | None = None) -> UUID:
37
+ """Generate a UUID from a host ID, sequence number, and the current time.
38
+ If 'node' is not given, getnode() is used to obtain the hardware
39
+ address. If 'clock_seq' is given, it is used as the sequence number;
40
+ otherwise a random 14-bit sequence number is chosen."""
41
+ ...
42
+
43
+ if sys.version_info >= (3, 12):
44
+ def uuid3(namespace: UUID, name: str | bytes) -> UUID:
45
+ """Generate a UUID from the MD5 hash of a namespace UUID and a name."""
46
+ ...
47
+
48
+ else:
49
+ def uuid3(namespace: UUID, name: str) -> UUID:
50
+ """Generate a UUID from the MD5 hash of a namespace UUID and a name."""
51
+ ...
52
+
53
+ def uuid4() -> UUID:
54
+ """Generate a random UUID."""
55
+ ...
56
+
57
+ if sys.version_info >= (3, 12):
58
+ def uuid5(namespace: UUID, name: str | bytes) -> UUID:
59
+ """Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
60
+ ...
61
+ else:
62
+ def uuid5(namespace: UUID, name: str) -> UUID:
63
+ """Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
64
+ ...
65
+
66
+ def uuid6(node: _Int | None = None, timestamp: _Int | None = None) -> UUID:
67
+ """Generate a version 6 UUID using the given timestamp and a host ID.
68
+ This is similar to version 1 UUIDs,
69
+ except that it is lexicographically sortable by timestamp.
70
+ """
71
+ ...
72
+
73
+ def uuid7(timestamp: _Int | None = None, nanos: _Int | None = None) -> UUID:
74
+ """Generate a version 7 UUID using a time value and random bytes."""
75
+ ...
76
+
77
+ def uuid8(bytes: _Bytes) -> UUID:
78
+ """Generate a custom UUID comprised almost entirely of user-supplied bytes.."""
79
+ ...
uuid_utils/py.typed ADDED
File without changes
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.4
2
+ Name: uuid_utils
3
+ Version: 0.11.1
4
+ Classifier: Development Status :: 3 - Alpha
5
+ Classifier: Programming Language :: Python
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Programming Language :: Python :: 3 :: Only
8
+ Classifier: Programming Language :: Python :: 3.9
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Rust
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: BSD License
16
+ Classifier: Operating System :: OS Independent
17
+ License-File: LICENSE.md
18
+ Summary: Drop-in replacement for Python UUID with bindings in Rust
19
+ Keywords: rust,uuid
20
+ Author-email: Amin Alaee <me@aminalaee.dev>
21
+ Requires-Python: >=3.9
22
+ Project-URL: Documentation, https://github.com/aminalaee/uuid-utils
23
+ Project-URL: Issues, https://github.com/aminalaee/uuid-utils/issues
24
+ Project-URL: Source, https://github.com/aminalaee/uuid-utils
@@ -0,0 +1,10 @@
1
+ uuid_utils-0.11.1.dist-info/METADATA,sha256=9FBfIABc3vAynychnV0oDnCVIvlq_LE6l3EduMtc1do,1059
2
+ uuid_utils-0.11.1.dist-info/WHEEL,sha256=5QLBv-BBnZeZ-T8YAazxYYtRna1z6Pc6VlOEfcmNQss,90
3
+ uuid_utils-0.11.1.dist-info/licenses/LICENSE.md,sha256=IJMw6B06iYYOnseem_iUvnBfB1Wjhp13qgkfxKL5GQM,1513
4
+ uuid_utils/__init__.py,sha256=d8wMPt50wY4SCUdfC2VVcAI_8fW0g2lVA-7lIjAjBgI,709
5
+ uuid_utils/__init__.pyi,sha256=VF0h5095ufcHgTly-6kao4qXTZmzH0Y2h1WMQSN3HMc,7060
6
+ uuid_utils/_uuid_utils.pyd,sha256=NxYzZi499QJh0S3CU9IjN1QLnluj0YM2ZLwSC-PZ9es,353792
7
+ uuid_utils/compat/__init__.py,sha256=ss8wd1L5wfdA6x3Xyd6DPLvX0G7SJVCHusGHKpoY2GA,2167
8
+ uuid_utils/compat/__init__.pyi,sha256=ieLQIprlG9TmvAITc6YqgKEO9a85zlZLd149SiELBaE,2365
9
+ uuid_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ uuid_utils-0.11.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.9.4)
3
+ Root-Is-Purelib: false
4
+ Tag: cp39-abi3-win32
@@ -0,0 +1,27 @@
1
+ Copyright © 2023, Amin Alaee.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ * Neither the name of the copyright holder nor the names of its
15
+ contributors may be used to endorse or promote products derived from
16
+ this software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.