Ñò ‚Ic@sÕdZdZdiƒdiddƒZdZddd d g\ZZZZ d e fd „ƒYZ d „Z d„Z d„Zd„Zd„Zd„Zd„Ze dƒZe dƒZe dƒZe dƒZdS(sUUID (universally unique identifiers) as specified in RFC 4122. This module provides the UUID class and the functions uuid1(), uuid3(), uuid4(), uuid5() for generating version 1, 3, 4, and 5 UUIDs respectively. This module works with Python 2.3 or higher.sKa-Ping Yee s$Date: 2005/11/30 11:51:58 $it/t-s$Revision: 1.10 $sreserved for NCS compatibilitysspecified in RFC 4122s$reserved for Microsoft compatibilitysreserved for future definitiontUUIDcBsªeZdZd„Zd„Zd„Zd„Zd„Zd„Ze eeƒZ d„Z e e ƒZ d„Z d „Ze e eƒZd „Zd „Ze eeƒZRS( sInstances of the UUID class represent UUIDs as specified in RFC 4122. Converting a UUID to a string using str() produces a string in the form "{12345678-1234-1234-1234-123456789abc}". The UUID constructor accepts a similar string (braces and hyphens optional), or six integer arguments (with 32-bit, 16-bit, 16-bit, 8-bit, 8-bit, and 48-bit values respectively). UUID objects have the following attributes: bytes gets or sets the UUID as a 16-byte string urn gets the UUID as a URN as specified in RFC 4122 variant gets or sets the UUID variant as one of the constants RESERVED_NCS, RFC_4122, RESERVED_MICROSOFT, RESERVED_FUTURE version gets or sets the UUID version number (1 through 5) c Gsmt|ƒdjoô|diddƒiddƒ}|iddƒiddƒiddƒ}t|ƒd jpttd ƒ‚t|d d ƒ}t|d d !d ƒ}t|d d !d ƒ}t|d d!d ƒ}t|dd!d ƒ}t|dd !d ƒ}n|\}}}}}}d|jo djnpttdƒ‚d|jo djnpttdƒ‚d|jo djnpttdƒ‚d|jo djnpttdƒ‚d|jo djnpttdƒ‚d|jo djnpttdƒ‚||_||_||_||_||_ ||_ dS(sÏCreate a UUID either from a string representation in hexadecimal or from six integers (32-bit time_low, 16-bit time_mid, 16-bit time_hi_ver, 8-bit clock_hi_res, 8-bit clock_low, 48-bit node).iisurn:tsuuid:t{t}Ri sbadly formed UUID stringiii iiIstime_low out of rangestime_mid out of rangestime_hi_ver out of rangesclock_hi_res out of rangesclock_low out of rangeIsnode out of rangeNiiii( tlentreplacetAssertionErrort ValueErrortintttime_lowttime_midt time_hi_vert clock_hi_rest clock_lowtnode( tselftargstdigitsR R R RRR((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pyt__init__$s."*#......     cCst|it|d|ƒƒS(Ntbytes(tcmpRtgetattr(Rtother((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pyt__cmp__BscCs,d|i|i|i|i|i|ifS(Ns{%08x-%04x-%04x-%02x%02x-%012x}(R R R RRR(R((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pyt__str__EscCsdt|ƒS(NsUUID(%r)(tstr(R((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pyt__repr__JscCsd„}||id?ƒ||id?ƒ||id?ƒ||iƒ||id?ƒ||iƒ||id?ƒ||iƒ||iƒ||iƒ||id?ƒ||id?ƒ||id?ƒ||id?ƒ||id?ƒ||iƒS(NcSst|d@ƒS(Niÿ(tchr(tn((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pytbyteNsiiii(i (R R R RRR(RR((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pyt get_bytesMs cCsÙtt|ƒ}|dd>|dd>|dd>|d|_|dd>|d |_|d d>|d |_|d|_|d |_|d d>|dd>|dd>|dd>|dd>|d|_dS(Niiiiiiiiiiii i i(i i i i ii(tmaptordR R R RRR(RRtvalues((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pyt set_bytesZs1  cCs,d|i|i|i|i|i|ifS(Ns&urn:uuid:%08x-%04x-%04x-%02x%02x-%012x(R R R RRR(R((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pytget_urnhscCsA|id@ptS|id@ptS|id@ptStSdS(Ni€i@i (Rt RESERVED_NCStRFC_4122tRESERVED_MICROSOFTtRESERVED_FUTURE(R((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pyt get_variantoscCs½|tjo|idM_nš|tjo"|idM_|idO_nk|tjo"|idM_|idO_n<|tjo"|idM_|idO_n tdƒ‚dS(Nii?i€iiÀiàsillegal variant identifier(R&RR'R(R)R (Rtvariant((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pyt set_variantys    cCs |id?S(Ni (R (R((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pyt get_versionŠscCsTd|jo djnpttdƒ‚|idM_|i|d>O_dS(Niisillegal version numberiÿi (RR R (Rtversion((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pyt set_versions.(t__name__t __module__t__doc__RRRRR R$tpropertyRR%turnR*R,R+R-R/R.(((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pyRs           cCs¹ddkl}x¢||ƒD]”}|iƒiƒ}d|jo1||idƒd}t|iddƒdƒSd|jo1||idƒd}t|iddƒdƒSqWd S( s+Get the hardware address on a Unix machine.iÿÿÿÿ(tpopenthwaddrit:RitetherN(tosR5tlowertsplittindexR R(tprogramR5tlinetwordstaddr((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pyt unixgetaddr”s   cCs~ddkl}xg||dƒD]U}|iƒiƒidƒo3|idƒdiƒ}t|iddƒdƒSq!Wd S( s.Get the hardware address on a Windows machine.iÿÿÿÿ(R5s /allsphysical addressR7RRiN(R9R5tstripR:t startswithR;R R(R=R5R>R@((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pyt wingetaddr s cCsŽddkl}l}xqdddddgD]Z}|||dƒƒot||dƒƒS|||d ƒƒot||d ƒƒSq,Wd S( s-Get the hardware address as a 48-bit integer.iÿÿÿÿ(tjointisfiles/sbins /usr/sbins c:\windowssc:\windows\systemsc:\windows\system32tifconfigs ipconfig.exeN(tos.pathRERFRARD(RERFtdir((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pytgetaddr¨s  c CsËddkl}ddkl}t|ƒdƒ}t|dƒd}|dƒ}|d@}|d ?d @}|d ?d @}|d@}|d?d@} tƒ} t||||| | ƒ} t| _d| _| S(s7Generate a UUID based on the time and hardware address.iÿÿÿÿ(ttime(t randrangegeÍÍAidI@Ò²iiIi iÿÿi0iÿiÿii?iIÿÿÿÿ( RKtrandomRLR RJRR'R+R.( RKRLt nanosecondst timestamptclockR R R RRRtuuid((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pytuuid1²s      c Cs‹yddkl}Wn#tj oddkl}nXtddddddƒ}||i|ƒiƒd |_t|_d|_|S(sAGenerate a UUID from the MD5 hash of a namespace UUID and a name.iÿÿÿÿ(tmd5iii( thashlibRSt ImportErrorRRtdigestR'R+R.(t namespacetnameRSRQ((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pytuuid3Æs   c Cs­yddkl}WnVddkl}t|d ƒ|d ƒ|d ƒ|dƒ|dƒ|dƒƒ}n+Xtd d d d d d ƒ}|dƒ|_t|_d |_|S(sGenerate a random UUID.iÿÿÿÿ(turandom(RLil iil0iiliiiil( R9RZRMRLRRR'R+R.(RZRLRQ((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pytuuid4Òs%  c Cs‹yddkl}Wn#tj oddkl}nXtddddddƒ}||i|ƒiƒd |_t|_d|_ |S(sCGenerate a UUID from the SHA-1 hash of a namespace UUID and a name.iÿÿÿÿ(tsha1(tshaiii( RTR\RUR]RRRVR'R+R.(RWRXR\RQ((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pytuuid5ás   s&{6ba7b810-9dad-11d1-80b4-00c04fd430c8}s&{6ba7b811-9dad-11d1-80b4-00c04fd430c8}s&{6ba7b812-9dad-11d1-80b4-00c04fd430c8}s&{6ba7b814-9dad-11d1-80b4-00c04fd430c8}N(R2t __author__R;Rt__date__t __version__R&R'R(R)tobjectRRARDRJRRRYR[R^t NAMESPACE_DNSt NAMESPACE_URLt NAMESPACE_OIDtNAMESPACE_X500(((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pyts"‚