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 f
| 83 | |
| 84 | |
| 85 | class UUID: |
| 86 | """Instances of the UUID class represent UUIDs as specified in RFC 4122. |
| 87 | UUID objects are immutable, hashable, and usable as dictionary keys. |
| 88 | Converting a UUID to a string with str() yields something in the form |
| 89 | '12345678-1234-1234-1234-123456789abc'. The UUID constructor accepts |
| 90 | five possible forms: a similar string of hexadecimal digits, or a tuple |
| 91 | of six integer fields (with 32-bit, 16-bit, 16-bit, 8-bit, 8-bit, and |
| 92 | 48-bit values respectively) as an argument named 'fields', or a string |
| 93 | of 16 bytes (with all the integer fields in big-endian order) as an |
| 94 | argument named 'bytes', or a string of 16 bytes (with the first three |
| 95 | fields in little-endian order) as an argument named 'bytes_le', or a |
| 96 | single 128-bit integer as an argument named 'int'. |
| 97 | |
| 98 | UUIDs have these read-only attributes: |
| 99 | |
| 100 | bytes the UUID as a 16-byte string (containing the six |
| 101 | integer fields in big-endian byte order) |
| 102 | |
| 103 | bytes_le the UUID as a 16-byte string (with time_low, time_mid, |
| 104 | and time_hi_version in little-endian byte order) |
| 105 | |
| 106 | fields a tuple of the six integer fields of the UUID, |
| 107 | which are also available as six individual attributes |
| 108 | and two derived attributes: |
| 109 | |
| 110 | time_low the first 32 bits of the UUID |
| 111 | time_mid the next 16 bits of the UUID |
| 112 | time_hi_version the next 16 bits of the UUID |
| 113 | clock_seq_hi_variant the next 8 bits of the UUID |
| 114 | clock_seq_low the next 8 bits of the UUID |
| 115 | node the last 48 bits of the UUID |
| 116 | |
| 117 | time the 60-bit timestamp |
| 118 | clock_seq the 14-bit sequence number |
| 119 | |
| 120 | hex the UUID as a 32-character hexadecimal string |
| 121 | |
| 122 | int the UUID as a 128-bit integer |
| 123 | |
| 124 | urn the UUID as a URN as specified in RFC 4122 |
| 125 | |
| 126 | variant the UUID variant (one of the constants RESERVED_NCS, |
| 127 | RFC_4122, RESERVED_MICROSOFT, or RESERVED_FUTURE) |
| 128 | |
| 129 | version the UUID version number (1 through 5, meaningful only |
| 130 | when the variant is RFC_4122) |
| 131 | |
| 132 | is_safe An enum indicating whether the UUID has been generated in |
| 133 | a way that is safe for multiprocessing applications, via |
| 134 | uuid_generate_time_safe(3). |
| 135 | """ |
| 136 | |
| 137 | __slots__ = ('int', 'is_safe', '__weakref__') |
| 138 | |
| 139 | def __init__(self, hex=None, bytes=None, bytes_le=None, fields=None, |
| 140 | int=None, version=None, |
| 141 | *, is_safe=SafeUUID.unknown): |
| 142 | r"""Create a UUID from either a string of 32 hexadecimal digits, |
no outgoing calls
no test coverage detected