Package elisa :: Package extern :: Package coherence :: Package uuid :: Module uuid :: Class UUID
[hide private]
[frames] | no frames]

Class UUID

source code


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
four possible forms: a similar string of hexadecimal digits, or a
string of 16 raw bytes as an argument named 'bytes', or a tuple of
six integer fields (with 32-bit, 16-bit, 16-bit, 8-bit, 8-bit, and
48-bit values respectively) as an argument named 'fields', or a single
128-bit integer as an argument named 'int'.

UUIDs have these read-only attributes:

    bytes       the UUID as a 16-byte string

    fields      a tuple of the six integer fields of the UUID,
                which are also available as six individual attributes
                and two derived attributes:

        time_low                the first 32 bits of the UUID
        time_mid                the next 16 bits of the UUID
        time_hi_version         the next 16 bits of the UUID
        clock_seq_hi_variant    the next 8 bits of the UUID
        clock_seq_low           the next 8 bits of the UUID
        node                    the last 48 bits of the UUID

        time                    the 60-bit timestamp
        clock_seq               the 14-bit sequence number

    hex         the UUID as a 32-character hexadecimal string

    int         the UUID as a 128-bit integer

    urn         the UUID as a URN as specified in RFC 4122

    variant     the UUID variant (one of the constants RESERVED_NCS,
                RFC_4122, RESERVED_MICROSOFT, or RESERVED_FUTURE)

    version     the UUID version number (1 through 5, meaningful only
                when the variant is RFC_4122)



Instance Methods [hide private]
 
__init__(self, hex='frontend', bytes='frontend', fields='frontend', int='frontend', version='frontend')
Create a UUID from either a string of 32 hexadecimal digits, a string of 16 bytes as the 'bytes' argument, a tuple of six integers (32-bit time_low, 16-bit time_mid, 16-bit time_hi_version, 8-bit clock_seq_hi_variant, 8-bit clock_seq_low, 48-bit node) as the 'fields' argument, or a single 128-bit integer as the 'int' argument.
source code
 
__cmp__(self, other) source code
 
__hash__(self)
hash(x)
source code
 
__int__(self) source code
 
__repr__(self)
repr(x)
source code
 
__setattr__(self, name, value)
x.__setattr__('name', value) <==> x.name = value
source code
 
__str__(self)
str(x)
source code
 
get_bytes(self) source code
 
get_fields(self) source code
 
get_time_low(self) source code
 
get_time_mid(self) source code
 
get_time_hi_version(self) source code
 
get_clock_seq_hi_variant(self) source code
 
get_clock_seq_low(self) source code
 
get_time(self) source code
 
get_clock_seq(self) source code
 
get_node(self) source code
 
get_hex(self) source code
 
get_urn(self) source code
 
get_variant(self) source code
 
get_version(self) source code

Inherited from object: __delattr__, __getattribute__, __new__, __reduce__, __reduce_ex__

Properties [hide private]
  bytes
  fields
  time_low
  time_mid
  time_hi_version
  clock_seq_hi_variant
  clock_seq_low
  time
  clock_seq
  node
  hex
  urn
  variant
  version

Inherited from object: __class__

Method Details [hide private]

__init__(self, hex='frontend', bytes='frontend', fields='frontend', int='frontend', version='frontend')
(Constructor)

source code 

Create a UUID from either a string of 32 hexadecimal digits, a string of 16 bytes as the 'bytes' argument, a tuple of six integers (32-bit time_low, 16-bit time_mid, 16-bit time_hi_version, 8-bit clock_seq_hi_variant, 8-bit clock_seq_low, 48-bit node) as the 'fields' argument, or a single 128-bit integer as the 'int' argument. When a string of hex digits is given, curly braces, hyphens, and a URN prefix are all optional. For example, these expressions all yield the same UUID:

UUID('{12345678-1234-5678-1234-567812345678}') UUID('12345678123456781234567812345678') UUID('urn:uuid:12345678-1234-5678-1234-567812345678') UUID(bytes='4Vx'*4) UUID(fields=(0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678)) UUID(int=0x12345678123456781234567812345678)

Exactly one of 'hex', 'bytes', 'fields', or 'int' must be given. The 'version' argument is optional; if given, the resulting UUID will have its variant and version number set according to RFC 4122, overriding bits in the given 'hex', 'bytes', 'fields', or 'int'.
Overrides: object.__init__

__hash__(self)
(Hashing function)

source code 
hash(x)
Overrides: object.__hash__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 
repr(x)
Overrides: object.__repr__
(inherited documentation)

__setattr__(self, name, value)

source code 
x.__setattr__('name', value) <==> x.name = value
Overrides: object.__setattr__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 
str(x)
Overrides: object.__str__
(inherited documentation)

Property Details [hide private]

bytes

Get Method:
elisa.extern.coherence.uuid.uuid.UUID.get_bytes(self)
Set Method:
'frontend'
Delete Method:
'frontend'

fields

Get Method:
elisa.extern.coherence.uuid.uuid.UUID.get_fields(self)
Set Method:
'frontend'
Delete Method:
'frontend'

time_low

Get Method:
elisa.extern.coherence.uuid.uuid.UUID.get_time_low(self)
Set Method:
'frontend'
Delete Method:
'frontend'

time_mid

Get Method:
elisa.extern.coherence.uuid.uuid.UUID.get_time_mid(self)
Set Method:
'frontend'
Delete Method:
'frontend'

time_hi_version

Get Method:
elisa.extern.coherence.uuid.uuid.UUID.get_time_hi_version(self)
Set Method:
'frontend'
Delete Method:
'frontend'

clock_seq_hi_variant

Get Method:
elisa.extern.coherence.uuid.uuid.UUID.get_clock_seq_hi_variant(self)
Set Method:
'frontend'
Delete Method:
'frontend'

clock_seq_low

Get Method:
elisa.extern.coherence.uuid.uuid.UUID.get_clock_seq_low(self)
Set Method:
'frontend'
Delete Method:
'frontend'

time

Get Method:
elisa.extern.coherence.uuid.uuid.UUID.get_time(self)
Set Method:
'frontend'
Delete Method:
'frontend'

clock_seq

Get Method:
elisa.extern.coherence.uuid.uuid.UUID.get_clock_seq(self)
Set Method:
'frontend'
Delete Method:
'frontend'

node

Get Method:
elisa.extern.coherence.uuid.uuid.UUID.get_node(self)
Set Method:
'frontend'
Delete Method:
'frontend'

hex

Get Method:
elisa.extern.coherence.uuid.uuid.UUID.get_hex(self)
Set Method:
'frontend'
Delete Method:
'frontend'

urn

Get Method:
elisa.extern.coherence.uuid.uuid.UUID.get_urn(self)
Set Method:
'frontend'
Delete Method:
'frontend'

variant

Get Method:
elisa.extern.coherence.uuid.uuid.UUID.get_variant(self)
Set Method:
'frontend'
Delete Method:
'frontend'

version

Get Method:
elisa.extern.coherence.uuid.uuid.UUID.get_version(self)
Set Method:
'frontend'
Delete Method:
'frontend'