Qfs&dZddlZddlZddlmZmZdZejdvrdxZZ nddlZejZ e dk(Ze dk(Z d Z dZ erd Z d Z gd \ZZZZeZeZeeGd dZGddZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ# ddl$Z$e%e$ddZ&e%e$ddZ'e$jPZ)dZ+d Z,d!Z-d"Z.e reegZ/n4ejd#k(reee!gZ/nejd$k(rgZ/n ere!gZ/neeee!e gZ/ej`d%k(re,ge/zZ1nej`d&k(re-ge/zZ1ne/Z1da2d'Z3da4d2d(Z5d)Z6d*Z7d+Z8d,Z9ed-Z:ed.Z;ed/Z<ed0Z=e>d1k(re9yy#e*$r dZ$dZ&dZ'dZ)YwxYw)3aQUUID 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') N)Enum _simple_enumzKa-Ping Yee )win32darwin emscriptenwasiFAIXLinux:.T)zreserved for NCS compatibilityzspecified in RFC 4122z$reserved for Microsoft compatibilityzreserved for future definitionceZdZdZdZdZy)SafeUUIDrN)__name__ __module__ __qualname__safeunsafeunknown+/opt/alt/python312/lib64/python3.12/uuid.pyrrNs D FGrrcreZdZdZdZ d!ej ddZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZedZedZedZedZedZedZedZedZedZedZedZedZ edZ!edZ"ed Z#y)"UUIDa 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) is_safe An enum indicating whether the UUID has been generated in a way that is safe for multiprocessing applications, via uuid_generate_time_safe(3). )intis_safe __weakref__N)rc<|||||gjddk7r td|h|jddjdd}|jdjdd}t |d k7r t d t |d }|9t |d k7r t d |d dd|dd dz|dddz|ddz}|.t |d k7r t dt j|}|t |dk7r t d|\}} } } } } d|cxkrdkst dt dd| cxkrdkst dt dd| cxkrdkst dt dd| cxkrdkst dt dd| cxkrdkst dt dd| cxkrdkst dt d| dz| z}|d z| d!zz| d"zz|d#zz| z}|%d|cxkrd$d%zkst d&t d&|9d$|cxkrdkst d't d'|d(z}|d)z}|d*z}||d+zz}tj|d,|tj|d-|y).aLCreate 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'. is_safe is an enum exposed as an attribute on the instance. It indicates whether the UUID has been generated in a way that is safe for multiprocessing applications, via uuid_generate_time_safe(3). NzGone of the hex, bytes, bytes_le, fields, or int arguments must be givenzurn:zuuid:z{}- z$badly formed hexadecimal UUID stringz bytes_le is not a 16-char stringrzbytes is not a 16-char stringzfields is not a 6-tuplerlz*field 1 out of range (need a 32-bit value)iz*field 2 out of range (need a 16-bit value)z*field 3 out of range (need a 16-bit value)z*field 4 out of range (need an 8-bit value)z*field 5 out of range (need an 8-bit value)z*field 6 out of range (need a 48-bit value)`P@0z*int is out of range (need a 128-bit value)zillegal version numberl lLrr) count TypeErrorreplacestriplen ValueErrorint_ from_bytesobject __setattr__)selfhexbytesbytes_lefieldsrversionrtime_lowtime_midtime_hi_versionclock_seq_hi_variant clock_seq_lownode clock_seqs r__init__z UUID.__init__sD@ &# . 4 4T :a ?=> > ?++fb)11'2>C))D/))#r2C3x2~ !GHHsB-C  8}" !CDDcg2g&#c"*)==c#bj)*,4QRL9E  5zR !@AA//%(C  6{a !:;;:@ 8Xx !=$(5( !MNN) !MNN(5( !MNN) !MNN/%/ !MNN0 !MNN,3t3 !MNN4 !MNN ,, !MNN- !MNN$u$ !MNN% !MNN-2mCINx2~6#r)+.72o?AEFC ?$af$ !MNN% !MNN  $1$ !9::% !9:: ? "C < C ? "C 7b= C4,4G4rcd|ji}|jtjk7r|jj|d<|SNrr)rrrrvalue)r=ds r __getstate__zUUID.__getstate__s< DHH  <<8++ + <<--AiLrctj|d|dtj|dd|vrt|dytjyrL)r;r<rr)r=states r __setstate__zUUID.__setstate__sQ4e 54'50$E)$45 H6>6F6F Hrc`t|tr|j|jk(StSN isinstancerrNotImplementedr=others r__eq__z UUID.__eq__% eT "88uyy( (rc`t|tr|j|jkStSrTrUrXs r__lt__z UUID.__lt__% eT "88eii' 'rc`t|tr|j|jkDStSrTrUrXs r__gt__z UUID.__gt__r^rc`t|tr|j|jkStSrTrUrXs r__le__z UUID.__le__r[rc`t|tr|j|jk\StSrTrUrXs r__ge__z UUID.__ge__r[rc,t|jSrT)hashrr=s r__hash__z UUID.__hash__ sDHH~rc|jSrTrrgs r__int__z UUID.__int__s xxrcL|jjdt|dS)N()) __class__rstrrgs r__repr__z UUID.__repr__s>>22CI>>rctd)NzUUID objects are immutable)r4)r=namerMs rr<zUUID.__setattr__s455rc ^d|jz}|ddd|ddd|ddd|ddd|dd S)N%032xr'r! r#rj)r=r>s r__str__z UUID.__str__sE  GS2YBr C2JBCB Brc8|jjdS)Nr#)rto_bytesrgs rr?z UUID.bytessxx  $$rcZ|j}|ddd|dddz|dddz|ddzS)Nr$rr%r&r'r?)r=r?s rr@z UUID.bytes_le!sK cg2gs3rz!22U3s2:5FFab  rc|j|j|j|j|j|j fSrT)rCrDrErFrGrHrgs rrAz UUID.fields's: t}}d.B.B))4+=+=tyyJ Jrc |jdz S)Nr+rjrgs rrCz UUID.time_low,sxx2~rc&|jdz dzS)Nr,rjrgs rrDz UUID.time_mid0B&((rc&|jdz dzS)Nr-rrjrgs rrEzUUID.time_hi_version4rrc&|jdz dzS)N8rjrgs rrFzUUID.clock_seq_hi_variant8B$&&rc&|jdz dzS)Nr.rrjrgs rrGzUUID.clock_seq_low<rrc`|jdzdz|jdzz|jzS)Nr.r")rErDrCrgs rtimez UUID.time@s7&&/B6"$&(, 6 7rc@|jdzdz|jzS)N?r')rFrGrgs rrIzUUID.clock_seqEs(++d2q8""# $rc |jdzS)Nlrjrgs rrHz UUID.nodeJsxx.((rc d|jzS)Nrurjrgs rr>zUUID.hexNs!!rcdt|zS)Nz urn:uuid:)rprgs rurnzUUID.urnRsSY&&rc|jdzstS|jdzstS|jdzstStS)Nr1ll)r RESERVED_NCSRFC_4122RESERVED_MICROSOFTRESERVED_FUTURErgs rvariantz UUID.variantVs=xx<( \*O\*% %" "rc`|jtk(rt|jdz dzSy)Nr2)rrrrgs rrBz UUID.versionas- <<8 #B#-. . $r)NNNNNN)$rrr__doc__ __slots__rrrJrOrRrZr]r`rbrdrhrkrqr<rxpropertyr?r@rArCrDrErFrGrrIrHr>rrrBrrrrrUs1f2ICG)-T5"*"2"2T5lH    ?6B %% JJ))))''''77$$))""''##//rrcNddl}ddl}ddl}ddl} |jj d|j j|j}|jddg|j||jj|}|yt|j}d|d<|dk7r|g|}n|f}|j||j|j| } | sy| j!\} } |j#| S#t$|j&f$rYywxYw) NrPATHz/sbinz /usr/sbin)pathCLC_ALL)r )stdoutstderrenv)ioosshutil subprocessenvirongetdefpathsplitpathsepextendwhichjoindictPopenPIPEDEVNULL communicateBytesIOOSErrorSubprocessError) commandargsrrrr path_dirs executablerprocrrs r_get_command_stdoutrhs%%JJNN62::6<z_parse_mac..s"9541D &Q&&5s#%rc3@K|]}|jddyw)r0N)rjustrs rrz_parse_mac..s@%$$**Q-%sc38K|]}t|dk(yw)rNrrs rrz_parse_mac..s4ed3t9>esr#)rrr7_MAC_OMITS_LEADING_ZEROESallrrr8)rpartshexstrs r _parse_macrs JJz "E 5zQ 9599 @%@@4e44 %62 s< B BBczt||}|y|jjj} |j |}d}|D]H}|jj} ||} t| } | 5t| r| cS|G| }J|S#t $rYywxYw#t $rYgwxYw)aLooks for a MAC address under a heading in a command's output. The first line of words in the output is searched for the given heading. Words at the same word index as the heading in subsequent lines are then examined to see if they look like MAC addresses. N) rreadlinerrindexr8rrr) rrheadingrr column_indexrrrrrs r_find_mac_under_headingrs!$ /F ~ '')//1H~~g. O ##% &D ;   J  "!O '    s#B4B. B+*B+. B:9B:c@d}dD]}td||d}|s|cSy)z5Get the hardware address on Unix by running ifconfig.)shwaddrsethersaddress:slladdr)r z-az-avifconfigc |dzSNr/rrs rz#_ifconfig_getnode..s1Q3rNr)rrrs r_ifconfig_getnoders0=H!$ZxO J" rc,tdddgd}|r|Sy)z/Get the hardware address on Unix by running ip.iplinks link/etherc |dzSrrrs rrz_ip_getnode.. s!A#rNrrs r _ip_getnoder s! !v  NC  rcjddl}ddl}t|dsy |j|j }t dd|j|gd}|r|St dd|j|gd}|r|St dd|jd|zgd }|r|Sy#t $rYywxYw) z0Get the hardware address on Unix by running arp.rN gethostbynamearpz-ancy)Nrrrs rrz_arp_getnode..sQSrc |dzSrrrs rrz_arp_getnode..!s QRSTQTrz(%s)c |dzS)Nrrrs rrz_arp_getnode..'sacr)rsockethasattrr gethostnamerrfsencode)rrip_addrrs r _arp_getnoders 6? +&&v'9'9';< !  G0D/E| TC   !  G0D/E} UC   !  FW.0srrrrr_lanscan_getnoder-s ")UWI{ KKrctdddS)z4Get the hardware address on Unix by running netstat.netstatz-iansAddress)rrrr_netstat_getnoder2s #9fj AArctSz1[DEPRECATED] Get the hardware address on Windows._windll_getnoderrr_ipconfig_getnoder 7   rctSrr rrr_netbios_getnoder<r rgenerate_time_safe UuidCreatecy)z>[DEPRECATED] Platform-specific functions loaded at import timeNrrrr_load_system_functionsrOsrcVtr#t\}}t|jSy)zBGet the hardware address on Unix using the _uuid extension module.r|N)_generate_time_saferrH) uuid_time_s r _unix_getnoderSs'*, 1)$)))rcPtr t}t|jSy)zEGet the hardware address on Windows using the _uuid extension module.)r@N) _UuidCreaterrH) uuid_bytess rr r Ys" ] Z(---rc2ddl}|jddzS)zGet a random node ID.rNr.l)random getrandbits)rs r_random_getnoder_s   b !W --rrrposixntcttSttgzD]*} |atdtcxkr dks"tcS,y#Y2xYw)a3Get 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. Nrr*)_node_GETTERSr)getters rgetnoder%sU  o.. HE  A$:'$:L%; /  s A  A ct0||cxur)nn&t\}} t|}t ||Sddl}|j }|dzdz}t|tkr tdz}|a|ddl}|jd}|dz} |d z d z} |d z d z} |d z} |dz dz} | t}t | | | | | |fdS#t$rtj}YwxYw)aGenerate 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.N)r?rrdl@'Hw r/lr"rr.rrr'r)rArB) rrr8rrrtime_ns_last_timestamprrr%)rHrIrsafely_generatedrr nanoseconds timestamprrCrDrErGrFs ruuid1r.s!&49+D&9&;# # '/0G)W55,,.Ks"%77I"yO'C#a' O&&r* :%HR6)H B&0O$M%Nd2 |y (O,mTCLM OO/ '&&G 's CC! C!ct|tr t|d}ddlm}||j|zdj }t |ddd S) zAGenerate a UUID from the MD5 hash of a namespace UUID and a name.utf-8r)md5F)usedforsecurityNr#r$r?rB)rVrpr?hashlibr1digestr) namespacersr1r5s ruuid3r7sU$T7# $ fh  fSbk1 --rcBttjddS)zGenerate a random UUID.r#rr3)rrurandomrrruuid4r:s bjjna 00rct|tr t|d}ddlm}||j|zj }t |dddS)zCGenerate a UUID from the SHA-1 hash of a namespace UUID and a name.r0r)sha1Nr#r%r3)rVrpr?r4r<r5r)r6rsr<rfs ruuid5r=sJ$T7#  $& ' . . 0D d3Bi ++rcfttttd}d}tt t td}ddl}|jd}|jdd |jd d |jd dd|jddd|j}||j}|j}|j}|j|vrJ|r|s|j!d|jd||vr||n t#|}t%|||yt%|y)z$Run the uuid command line interface.)r.r7r:r=)r7r=)z@dnsz@urlz@oidz@x500rNz2Generates a uuid using the selected uuid function.) descriptionz-uz--uuidr:zLThe function to use to generate the uuid. By default uuid4 function is used.)choicesdefaulthelpz-nz --namespacezThe namespace is a UUID, or '@ns' where 'ns' is a well-known predefined UUID addressed by namespace name. Such as @dns, @url, @oid, and @x500. Only required for uuid3/uuid5 functions.)rBz-Nz--namezVThe name used as part of generating the uuid. Only required for uuid3/uuid5 functions.zIncorrect number of arguments. zO requires a namespace and a name. Run 'python -m uuid -h' for more information.)r.r7r:r= NAMESPACE_DNS NAMESPACE_URL NAMESPACE_OIDNAMESPACE_X500argparseArgumentParser add_argumentkeys parse_argsuuidr6rserrorrprint) uuid_funcsuuid_namespace_funcs namespacesrGparserr uuid_funcr6rss rmainrTsO J . J  $ $H%JF h 0A7=> mCD  hCD    D499%II 99D yy(( LL199+@@  .7*-DJy)$y/  i 4() ikrz$6ba7b810-9dad-11d1-80b4-00c04fd430c8z$6ba7b811-9dad-11d1-80b4-00c04fd430c8z$6ba7b812-9dad-11d1-80b4-00c04fd430c8z$6ba7b814-9dad-11d1-80b4-00c04fd430c8__main__)NN)?rrsysenumrr __author__platform_AIX_LINUXsystem_platform_systemrrrrrrrr9r?bytes_rrrrrrrrrrrrr r_uuidgetattrrrhas_uuid_generate_time_safe_has_uuid_generate_time_safe ImportErrorrrr r _OS_GETTERSrsr#r"r%r*r.r7r:r=rTrCrDrErFrrrrresj,\ #+ <<<<D6&x(5(D7*F  !J $?N; h*O  d P/P/f\! #F8!L8L B   (!%)=tD%t4K#(#D#D I* . .,  12K\\X$l4DEK\\WK #$K$k<#%57K77g,HWW_ ;.HH O,$OL .1,.f;< ;< ;< <= zFa( EK#' (s"$F FF