Ńň ‚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 Gs6t|ƒdjoŃ|diddƒiddƒ}|iddƒiddƒiddƒ}t|d d ƒ}t|d d !d ƒ}t|d d !d ƒ}t|d d !d ƒ}t|d d !d ƒ}t|d d!d ƒ}n|\}}}}}}||_||_||_||_||_||_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}Riii iii N( tlentreplacetintttime_lowttime_midt time_hi_vert clock_hi_rest clock_lowtnode( tselftargstdigitsR R R R R R((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 R R R(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 R R R(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 R R R(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 R R R(R((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pytget_urnhscCsA|id@ptS|id@ptS|id@ptStSdS(Ni€i@i (R t 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$R R%R&R't ValueError(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ŠscCs&|idM_|i|d>O_dS(Ni˙i (R (Rtversion((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pyt set_versions(t__name__t __module__t__doc__RRRRRR"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(tosR4tlowertsplittindexRR(tprogramR4tlinetwordstaddr((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˙˙˙˙(R4s /allsphysical addressR6RRiN(R8R4tstripR9t startswithR:RR(R<R4R=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.pathRDRER@RC(RDREtdir((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˙˙˙˙( RJtrandomRKRRIRR%R*R-( RJRKt nanosecondst timestamptclockR R R R R Rtuuid((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( thashlibRRt ImportErrorRRtdigestR%R*R-(t namespacetnameRRRP((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(RKil iil0iiliiiil( R8RYRLRKRRR%R*R-(RYRKRP((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( RSR[RTR\RRRUR%R*R-(RVRWR[RP((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(R1t __author__R:Rt__date__t __version__R$R%R&R'tobjectRR@RCRIRQRXRZR]t NAMESPACE_DNSt NAMESPACE_URLt NAMESPACE_OIDtNAMESPACE_X500(((s:/usr/lib/python2.6/site-packages/paste/script/util/uuid.pyts"‚