MCPcopy Index your code
hub / github.com/python/cpython / UUID

Class UUID

Lib/uuid.py:114–421  ·  view source on GitHub ↗

Instances of the UUID class represent UUIDs as specified in RFC 4122. UUID objects are immutable, hashable, and usable as dictionary keys. Converting a UUID to a string with str() yields something in the form '12345678-1234-1234-1234-123456789abc'. The UUID constructor accepts five

Source from the content-addressed store, hash-verified

112
113
114class UUID:
115 """Instances of the UUID class represent UUIDs as specified in RFC 4122.
116 UUID objects are immutable, hashable, and usable as dictionary keys.
117 Converting a UUID to a string with str() yields something in the form
118 '12345678-1234-1234-1234-123456789abc'. The UUID constructor accepts
119 five possible forms: a similar string of hexadecimal digits, or a tuple
120 of six integer fields (with 32-bit, 16-bit, 16-bit, 8-bit, 8-bit, and
121 48-bit values respectively) as an argument named 'fields', or a string
122 of 16 bytes (with all the integer fields in big-endian order) as an
123 argument named 'bytes', or a string of 16 bytes (with the first three
124 fields in little-endian order) as an argument named 'bytes_le', or a
125 single 128-bit integer as an argument named 'int'.
126
127 UUIDs have these read-only attributes:
128
129 bytes the UUID as a 16-byte string (containing the six
130 integer fields in big-endian byte order)
131
132 bytes_le the UUID as a 16-byte string (with time_low, time_mid,
133 and time_hi_version in little-endian byte order)
134
135 fields a tuple of the six integer fields of the UUID,
136 which are also available as six individual attributes
137 and two derived attributes. Those attributes are not
138 always relevant to all UUID versions:
139
140 The 'time_*' attributes are only relevant to version 1.
141
142 The 'clock_seq*' and 'node' attributes are only relevant
143 to versions 1 and 6.
144
145 The 'time' attribute is only relevant to versions 1, 6
146 and 7.
147
148 time_low the first 32 bits of the UUID
149 time_mid the next 16 bits of the UUID
150 time_hi_version the next 16 bits of the UUID
151 clock_seq_hi_variant the next 8 bits of the UUID
152 clock_seq_low the next 8 bits of the UUID
153 node the last 48 bits of the UUID
154
155 time the 60-bit timestamp for UUIDv1/v6,
156 or the 48-bit timestamp for UUIDv7
157 clock_seq the 14-bit sequence number
158
159 hex the UUID as a 32-character hexadecimal string
160
161 int the UUID as a 128-bit integer
162
163 urn the UUID as a URN as specified in RFC 4122/9562
164
165 variant the UUID variant (one of the constants RESERVED_NCS,
166 RFC_4122, RESERVED_MICROSOFT, or RESERVED_FUTURE)
167
168 version the UUID version number (1 through 8, meaningful only
169 when the variant is RFC_4122)
170
171 is_safe An enum indicating whether the UUID has been generated in

Callers 5

_unix_getnodeFunction · 0.85
_windll_getnodeFunction · 0.85
uuid1Function · 0.85
mainFunction · 0.85
uuid.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…