Your IP : 18.118.166.45


Current Path : /opt/alt/python33/lib64/python3.3/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/__pycache__/uuid.cpython-33.pyc

�
��fMWc@sdZdZddddg\ZZZZeZeZ	Gdd�de
�Zdd	�Zd
d�Z
dd
�Zdd�ZeZZZyDddlZddlZx�ddgD]yZyejejje��ZWnw�YnXeed�rejZneed�r+ejZeek	r(Pnnq�WddlZejdkr�ddl Z ee j!�j"j#d�d�dkr�eZZnnyej$j%ZWneZYnXe&ede&ede��ZWnYnXdd�Z'dd�Z(dd �Z)ea*d!d"�Z+ea,eed#d$�Z-d%d&�Z.d'd(�Z/d)d*�Z0ed+�Z1ed,�Z2ed-�Z3ed.�Z4dS(/uQUUID objects (universally unique identifiers) according to RFC 4122.

This module provides immutable UUID objects (class UUID) and the functions
uuid1(), uuid3(), uuid4(), uuid5() for generating version 1, 3, 4, and 5
UUIDs as specified in RFC 4122.

If all you want is a unique ID, you should probably call uuid1() or uuid4().
Note that uuid1() may compromise privacy since it creates a UUID containing
the computer's network address.  uuid4() creates a random UUID.

Typical usage:

    >>> import uuid

    # make a UUID based on the host ID and current time
    >>> uuid.uuid1()    # doctest: +SKIP
    UUID('a8098c1a-f86e-11da-bd1a-00112444be1e')

    # make a UUID using an MD5 hash of a namespace UUID and a name
    >>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org')
    UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')

    # make a random UUID
    >>> uuid.uuid4()    # doctest: +SKIP
    UUID('16fd2706-8baf-433b-82eb-8c7fada847da')

    # make a UUID using a SHA-1 hash of a namespace UUID and a name
    >>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')
    UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')

    # make a UUID from a string of hex digits (braces and hyphens ignored)
    >>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}')

    # convert a UUID to a string of hex digits in standard form
    >>> str(x)
    '00010203-0405-0607-0809-0a0b0c0d0e0f'

    # get the raw 16 bytes of the UUID
    >>> x.bytes
    b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f'

    # make a UUID from a 16-byte string
    >>> uuid.UUID(bytes=x.bytes)
    UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')
uKa-Ping Yee <ping@zesty.ca>ureserved for NCS compatibilityuspecified in RFC 4122u$reserved for Microsoft compatibilityureserved for future definitioncBs�|EeZdZdZd8d8d8d8d8d8dd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zedd��Zedd��Zedd��Zed d!��Zed"d#��Zed$d%��Zed&d'��Zed(d)��Zed*d+��Zed,d-��Zed.d/��Zed0d1��Zed2d3��Zed4d5��Zed6d7��Z d8S(9uUUIDu�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 possible forms: a similar string of hexadecimal digits, 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 string
    of 16 bytes (with all the integer fields in big-endian order) as an
    argument named 'bytes', or a string of 16 bytes (with the first three
    fields in little-endian order) as an argument named 'bytes_le', 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 (containing the six
                    integer fields in big-endian byte order)

        bytes_le    the UUID as a 16-byte string (with time_low, time_mid,
                    and time_hi_version in little-endian byte order)

        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)
    cCs�|||||gjd�dkr3td��n|dk	r�|jdd�jdd�}|jd�jdd�}t|�dkr�td	��nt|d
�}n|dk	r9t|�d
kr�td��ntt	|dd���tt	|dd
���tt	|d
d���|dd�}n|dk	r�t|�d
krftd��nt
|t�s�tt|���tdd
t
|�d
�}n|dk	r%t|�d
kr�td��n|\}}}	}
}}d|kod'knstd��nd|ko.d(knsBtd��nd|	koYd)knsmtd��nd|
ko�d*kns�td��nd|ko�d+kns�td��nd|ko�d,kns�td��n|
d>|B}
|d>|d>B|	d>B|
d>B|B}n|dk	r_d|koHd-kns_td��q_n|dk	r�d|ko�d kns�td!��n|d/M}|d0O}|d2M}||d%>O}n||jd&<dS(3umCreate a UUID from either a string of 32 hexadecimal digits,
        a string of 16 bytes as the 'bytes' argument, a string of 16 bytes
        in little-endian order as the 'bytes_le' 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='\x12\x34\x56\x78'*4)
        UUID(bytes_le='\x78\x56\x34\x12\x34\x12\x78\x56' +
                      '\x12\x34\x56\x78\x12\x34\x56\x78')
        UUID(fields=(0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678))
        UUID(int=0x12345678123456781234567812345678)

        Exactly one of 'hex', 'bytes', 'bytes_le', 'fields', or 'int' must
        be given.  The 'version' argument is optional; if given, the resulting
        UUID will have its variant and version set according to RFC 4122,
        overriding the given 'hex', 'bytes', 'bytes_le', 'fields', or 'int'.
        iu0need one of hex, bytes, bytes_le, fields, or intuurn:uuuuid:u{}u-i u$badly formed hexadecimal UUID stringiu bytes_le is not a 16-char stringiiiNubytes is not a 16-char stringu%02xufields is not a 6-tupleiu*field 1 out of range (need a 32-bit value)u*field 2 out of range (need a 16-bit value)u*field 3 out of range (need a 16-bit value)u*field 4 out of range (need an 8-bit value)u*field 5 out of range (need an 8-bit value)i0u*field 6 out of range (need a 48-bit value)i`iPi@i�u*int is out of range (need a 128-bit value)iuillegal version numberi�i�i�iLuintliiiill	ll����lll����(ucountuNoneu	TypeErrorureplaceustripulenu
ValueErroruint_ubytes_ureversedu
isinstanceuAssertionErrorureprutupleu__dict__(uselfuhexubytesubytes_leufieldsuintuversionutime_lowutime_midutime_hi_versionuclock_seq_hi_variantu
clock_seq_lowunodeu	clock_seq((u)/opt/alt/python33/lib64/python3.3/uuid.pyu__init__hs^$M! )


u
UUID.__init__cCs#t|t�r|j|jkStS(N(u
isinstanceuUUIDuintuNotImplemented(uselfuother((u)/opt/alt/python33/lib64/python3.3/uuid.pyu__eq__�suUUID.__eq__cCs#t|t�r|j|jkStS(N(u
isinstanceuUUIDuintuNotImplemented(uselfuother((u)/opt/alt/python33/lib64/python3.3/uuid.pyu__ne__�suUUID.__ne__cCs#t|t�r|j|jkStS(N(u
isinstanceuUUIDuintuNotImplemented(uselfuother((u)/opt/alt/python33/lib64/python3.3/uuid.pyu__lt__�suUUID.__lt__cCs#t|t�r|j|jkStS(N(u
isinstanceuUUIDuintuNotImplemented(uselfuother((u)/opt/alt/python33/lib64/python3.3/uuid.pyu__gt__�suUUID.__gt__cCs#t|t�r|j|jkStS(N(u
isinstanceuUUIDuintuNotImplemented(uselfuother((u)/opt/alt/python33/lib64/python3.3/uuid.pyu__le__�suUUID.__le__cCs#t|t�r|j|jkStS(N(u
isinstanceuUUIDuintuNotImplemented(uselfuother((u)/opt/alt/python33/lib64/python3.3/uuid.pyu__ge__�suUUID.__ge__cCs
t|j�S(N(uhashuint(uself((u)/opt/alt/python33/lib64/python3.3/uuid.pyu__hash__�su
UUID.__hash__cCs|jS(N(uint(uself((u)/opt/alt/python33/lib64/python3.3/uuid.pyu__int__�suUUID.__int__cCsdt|�S(NuUUID(%r)(ustr(uself((u)/opt/alt/python33/lib64/python3.3/uuid.pyu__repr__�su
UUID.__repr__cCstd��dS(NuUUID objects are immutable(u	TypeError(uselfunameuvalue((u)/opt/alt/python33/lib64/python3.3/uuid.pyu__setattr__�suUUID.__setattr__cCsVd|j}d|dd�|dd�|dd�|dd�|dd�fS(Nu%032xu%s-%s-%s-%s-%siiii(uint(uselfuhex((u)/opt/alt/python33/lib64/python3.3/uuid.pyu__str__�s
uUUID.__str__cCsKt�}x5tddd�D]!}|jd|j|?d@�qWt|�S(Nii�ii�(u	bytearrayurangeuinsertuintubytes_(uselfubytesushift((u)/opt/alt/python33/lib64/python3.3/uuid.pyubytes�s	u
UUID.bytescCse|j}tt|dd���tt|dd���tt|dd���|dd�S(Niiii(ubytesubytes_ureversed(uselfubytes((u)/opt/alt/python33/lib64/python3.3/uuid.pyubytes_le�s	Mu
UUID.bytes_lecCs(|j|j|j|j|j|jfS(N(utime_lowutime_midutime_hi_versionuclock_seq_hi_variantu
clock_seq_lowunode(uself((u)/opt/alt/python33/lib64/python3.3/uuid.pyufields�suUUID.fieldscCs|jd?S(Ni`(uint(uself((u)/opt/alt/python33/lib64/python3.3/uuid.pyutime_low�su
UUID.time_lowcCs|jd?d@S(NiPi��(uint(uself((u)/opt/alt/python33/lib64/python3.3/uuid.pyutime_midsu
UUID.time_midcCs|jd?d@S(Ni@i��(uint(uself((u)/opt/alt/python33/lib64/python3.3/uuid.pyutime_hi_versionsuUUID.time_hi_versioncCs|jd?d@S(Ni8i�(uint(uself((u)/opt/alt/python33/lib64/python3.3/uuid.pyuclock_seq_hi_variantsuUUID.clock_seq_hi_variantcCs|jd?d@S(Ni0i�(uint(uself((u)/opt/alt/python33/lib64/python3.3/uuid.pyu
clock_seq_lowsuUUID.clock_seq_lowcCs!|jd@d>|jd>B|jBS(Ni�i0i (utime_hi_versionutime_midutime_low(uself((u)/opt/alt/python33/lib64/python3.3/uuid.pyutimesu	UUID.timecCs|jd@d>|jBS(Ni?i(uclock_seq_hi_variantu
clock_seq_low(uself((u)/opt/alt/python33/lib64/python3.3/uuid.pyu	clock_seqsuUUID.clock_seqcCs|jd@S(Nl���(uint(uself((u)/opt/alt/python33/lib64/python3.3/uuid.pyunodesu	UUID.nodecCsd|jS(Nu%032x(uint(uself((u)/opt/alt/python33/lib64/python3.3/uuid.pyuhex!suUUID.hexcCsdt|�S(Nu	urn:uuid:(ustr(uself((u)/opt/alt/python33/lib64/python3.3/uuid.pyuurn%suUUID.urncCs;|jd@stS|jd@s"tS|jd@s3tStSdS(Ni�i0i@i lll(uintuRESERVED_NCSuRFC_4122uRESERVED_MICROSOFTuRESERVED_FUTURE(uself((u)/opt/alt/python33/lib64/python3.3/uuid.pyuvariant)s


uUUID.variantcCs(|jtkr$t|jd?d@�SdS(NiLi(uvariantuRFC_4122uint(uself((u)/opt/alt/python33/lib64/python3.3/uuid.pyuversion4suUUID.versionN(!u__name__u
__module__u__qualname__u__doc__uNoneu__init__u__eq__u__ne__u__lt__u__gt__u__le__u__ge__u__hash__u__int__u__repr__u__setattr__u__str__upropertyubytesubytes_leufieldsutime_lowutime_midutime_hi_versionuclock_seq_hi_variantu
clock_seq_lowutimeu	clock_sequnodeuhexuurnuvariantuversion(u
__locals__((u)/opt/alt/python33/lib64/python3.3/uuid.pyuUUID8s:.PuUUIDc
CsGddl}ddl}|j|�}|dkrm|jjd	�}|j|d|�}|dkrmdSny�d||f}|j|���}	x�|	D]�}
|
j�j�}xot	t
|��D][}|||kr�y't|||�jdd�d�SWqt
tfk
rYqXq�q�Wq�WWdQXWntk
rBYnXdS(
Niu/sbinu	/usr/sbinupathuLC_ALL=C %s %s 2>/dev/nullu:ui(u/sbinu	/usr/sbin(uosushutiluwhichuNoneupathsepujoinupopenuloweruspliturangeulenuintureplaceu
ValueErroru
IndexErroruIOError(
ucommanduargsuhw_identifiersu	get_indexuosushutilu
executableupathucmdupipeulineuwordsui((u)/opt/alt/python33/lib64/python3.3/uuid.pyu	_find_mac:s*
$
u	_find_maccCs�x9dD]1}td|ddgdd��}|r|SqWd	d
l}|j|j��}tdd|gd
d��}|r�|Stdddgdd��}|r�|Sd
S(u5Get the hardware address on Unix by running ifconfig.uu-au-avuifconfiguhwaddruethercSs|dS(Ni((ui((u)/opt/alt/python33/lib64/python3.3/uuid.pyu<lambda>^su#_ifconfig_getnode.<locals>.<lambda>iNuarpu-ancSsdS(Nii����((ui((u)/opt/alt/python33/lib64/python3.3/uuid.pyu<lambda>fsulanscanu-aiulan0cSsdS(Ni((ui((u)/opt/alt/python33/lib64/python3.3/uuid.pyu<lambda>ks(uu-au-av(u	_find_macusocketu
gethostbynameugethostnameuNone(uargsumacusocketuip_addr((u)/opt/alt/python33/lib64/python3.3/uuid.pyu_ifconfig_getnodeYs
!u_ifconfig_getnodec	CsCddl}ddl}dddg}yQddl}|jd�}|jjj|d�|jd|jj	d��WnYnXx�|D]�}z�y&|j
|jj|d�d	�}Wnt
k
r�w�Yn\XxX|D]P}|jd
�dj�j�}|jd|�r�t|jd
d�d�Sq�WWd|j�Xq�WdS(u<Get the hardware address on Windows by running ipconfig.exe.iNuuc:\windows\system32uc:\winnt\system32i,umbcsuipconfigu /allu:iu&([0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]u-ii����(uosureuctypesucreate_string_bufferuwindllukernel32uGetSystemDirectoryAuinsertuvalueudecodeupopenupathujoinuIOErrorusplitustripulowerumatchuintureplaceuclose(	uosureudirsuctypesubufferudirupipeulineuvalue((u)/opt/alt/python33/lib64/python3.3/uuid.pyu_ipconfig_getnodeqs& 
&

!u_ipconfig_getnodecCs�ddl}ddl}|j�}|j|_|j�|_}|j�|j|�dkrfdS|j	�xt
|j�D]
}|j�|j
|_t|j|�|_|j|�dkr�q�n|j�|j|_t|j|�|_djd�|_|j�|_}|j|�dkr9q�n|j	�|j}|dd>|dd>|dd	>|d
d>|dd>|d
SWdS(utGet the hardware address on Windows using NetBIOS calls.
    See http://support.microsoft.com/kb/118623 for details.iNu*ii(ii iiiiii(u	win32wnetunetbiosuNCBuNCBENUMuCommandu	LANA_ENUMuBufferu_packuNetbiosu_unpackurangeulengthuResetuNCBRESETuordulanauLana_numuNCBASTATuljustuCallnameuADAPTER_STATUSuadapter_address(u	win32wnetunetbiosuncbuadaptersuiustatusubytes((u)/opt/alt/python33/lib64/python3.3/uuid.pyu_netbios_getnode�s0




	u_netbios_getnodeiNuuuiducuuuid_generate_randomuuuid_generate_timeudarwinu.i	uUuidCreateSequentialu
UuidCreatecCs2tjd�}t|�tdt|j��jS(u.Get the hardware address on Unix using ctypes.iubytes(uctypesucreate_string_bufferu_uuid_generate_timeuUUIDubytes_urawunode(u_buffer((u)/opt/alt/python33/lib64/python3.3/uuid.pyu_unixdll_getnode�s
u_unixdll_getnodecCs>tjd�}t|�dkr:tdt|j��jSdS(u1Get the hardware address on Windows using ctypes.iiubytesN(uctypesucreate_string_bufferu_UuidCreateuUUIDubytes_urawunode(u_buffer((u)/opt/alt/python33/lib64/python3.3/uuid.pyu_windll_getnode�su_windll_getnodecCs ddl}|jdd�dBS(uCGet a random node ID, with eighth bit set as suggested by RFC 4122.iNii0ll(urandomu	randrange(urandom((u)/opt/alt/python33/lib64/python3.3/uuid.pyu_random_getnode�su_random_getnodec
Cs�tdk	rtSddl}|jdkr=tttg}nttg}x@|t	gD]1}y
|�aWnwWYnXtdk	rWtSqWWdS(u3Get the hardware address as a 48-bit positive integer.

    The first time this runs, it may launch a separate program, which could
    be quite slow.  If all attempts to obtain the hardware address fail, we
    choose a random 48-bit number with its eighth bit set to 1 as recommended
    in RFC 4122.
    iNuwin32(
u_nodeuNoneusysuplatformu_windll_getnodeu_netbios_getnodeu_ipconfig_getnodeu_unixdll_getnodeu_ifconfig_getnodeu_random_getnode(usysugettersugetter((u)/opt/alt/python33/lib64/python3.3/uuid.pyugetnode�s

ugetnodecCsWtrQ||kodknrQtjd�}t|�tdt|j��Sddl}t|j�d�}t|d�d}t	dk	r�|t	kr�t	d}n|a	|dkr�ddl
}|jd�}n|d
@}|d?d@}|d
?d@}	|d@}
|d?d@}|dkr2t�}ntd|||	||
|fdd�S(uGenerate a UUID from a host ID, sequence number, and the current time.
    If 'node' is not given, getnode() is used to obtain the hardware
    address.  If 'clock_seq' is given, it is used as the sequence number;
    otherwise a random 14-bit sequence number is chosen.iubytesiNge��Aidl@'Hw�
iil��i i��i0i�i�ii?ufieldsuversioni@(
u_uuid_generate_timeuNoneuctypesucreate_string_bufferuUUIDubytes_urawutimeuintu_last_timestampurandomu	randrangeugetnode(unodeu	clock_sequ_bufferutimeunanosecondsu	timestampurandomutime_lowutime_midutime_hi_versionu
clock_seq_lowuclock_seq_hi_variant((u)/opt/alt/python33/lib64/python3.3/uuid.pyuuuid1
s,"



uuuid1cCsOddlm}||jt|d��j�}td|dd�dd�S(	uAGenerate a UUID from the MD5 hash of a namespace UUID and a name.i(umd5uutf-8ubytesNiuversioni(uhashlibumd5ubytesudigestuUUID(u	namespaceunameumd5uhash((u)/opt/alt/python33/lib64/python3.3/uuid.pyuuuid3-s"uuuid3cs�tr5tjd�}t|�tdt|j��Sy,ddl}td|jd�dd�SWnLddl�t�fdd�t	d�D��}td|dd�SYnXdS(	uGenerate a random UUID.iubytesiNuversionic3s|]}�jd�VqdS(iN(u	randrange(u.0ui(urandom(u)/opt/alt/python33/lib64/python3.3/uuid.pyu	<genexpr>Bsuuuid4.<locals>.<genexpr>(
u_uuid_generate_randomuctypesucreate_string_bufferuUUIDubytes_urawuosuurandomurandomurange(u_bufferuosubytes((urandomu)/opt/alt/python33/lib64/python3.3/uuid.pyuuuid43s
 %uuuid4cCsOddlm}||jt|d��j�}td|dd�dd�S(	uCGenerate a UUID from the SHA-1 hash of a namespace UUID and a name.i(usha1uutf-8ubytesNiuversioni(uhashlibusha1ubytesudigestuUUID(u	namespaceunameusha1uhash((u)/opt/alt/python33/lib64/python3.3/uuid.pyuuuid5Es"uuuid5u$6ba7b810-9dad-11d1-80b4-00c04fd430c8u$6ba7b811-9dad-11d1-80b4-00c04fd430c8u$6ba7b812-9dad-11d1-80b4-00c04fd430c8u$6ba7b814-9dad-11d1-80b4-00c04fd430c8(5u__doc__u
__author__uRESERVED_NCSuRFC_4122uRESERVED_MICROSOFTuRESERVED_FUTUREuintuint_ubytesubytes_uobjectuUUIDu	_find_macu_ifconfig_getnodeu_ipconfig_getnodeu_netbios_getnodeuNoneu_uuid_generate_randomu_uuid_generate_timeu_UuidCreateuctypesuctypes.utilulibnameuCDLLuutilufind_libraryulibuhasattruuuid_generate_randomuuuid_generate_timeusysuplatformuosuunameureleaseusplituwindllurpcrt4ugetattru_unixdll_getnodeu_windll_getnodeu_random_getnodeu_nodeugetnodeu_last_timestampuuuid1uuuid3uuuid4uuuid5u
NAMESPACE_DNSu
NAMESPACE_URLu
NAMESPACE_OIDuNAMESPACE_X500(((u)/opt/alt/python33/lib64/python3.3/uuid.pyu<module>-sh�!		(
	#

?>