fkdZddlZddlZddlmZmZdZejdvrdxZZ nddlZej Z e dkZe dkZ d Z dZ erd Z d Z gd \ZZZZeZeZeeGd dZGddZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ# ddl$Z$e%e$ddZ&e%e$ddZ'e$j(Z)n#e*$r dZ$dZ&dZ'dZ)YnwxYwdZ+d Z,d!Z-d"Z.e reegZ/n,ejd#kreee!gZ/nejd$krgZ/n ere!gZ/neeee!e gZ/ej0d%kre,ge/zZ1nej0d&kre-ge/zZ1ne/Z1da2d'Z3da4d0d(Z5d)Z6d*Z7d+Z8ed,Z9ed-Z:ed.Z;ed/Z>> 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 )win32darwinFAIXLinux:.T)zreserved for NCS compatibilityzspecified in RFC 4122z$reserved for Microsoft compatibilityzreserved for future definitionceZdZdZdZdZdS)SafeUUIDrN)__name__ __module__ __qualname__safeunsafeunknown+/opt/alt/python311/lib64/python3.11/uuid.pyr r Ns D FGGGrr ceZdZdZdZ d!ejddZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZedZedZedZedZedZedZedZedZedZedZedZedZ edZ!edZ"ed Z#dS)"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|||||gddkrtd||dddd}|ddd}t |d krt d t |d }|Pt |d krt d |d dd|dd dz|dddz|ddz}|> > ?++fb))11'2>>C))D//))#r22C3xx2~~ !GHHHsB--C  8}}"" !CDDDcg2g&#c"*)==c#bj)*,4QRRL9E  5zzR !@AAA//%((C  6{{a !:;;;:@ 8Xx !=$((((5(((( !MNNN((((5(((( !MNNN////%//// !MNNN,3333t3333 !MNNN ,,,,,,,, !MNNN$$$$u$$$$ !MNNN-2mCINx2~6#r)+.72o?AEFC ?$$$$af$$$$ !MNNN  $$$$1$$$$ !9::: ? "C < C ? "C 7b= C4,,,4G44444rc`d|ji}|jtjkr|jj|d<|SNrr)rrr rvalue)r;ds r __getstate__zUUID.__getstate__s3 DH  <8+ + + <-AiLrct|d|dt|dd|vrt|dn tjdSrJ)r9r:r r)r;states r __setstate__zUUID.__setstate__so4e 5554'500$E)$45556>6F H H H H HrcZt|tr|j|jkStSN isinstancerrNotImplementedr;others r__eq__z UUID.__eq__) eT " " )8uy( (rcZt|tr|j|jkStSrRrSrVs r__lt__z UUID.__lt__) eT " " (8ei' 'rcZt|tr|j|jkStSrRrSrVs r__gt__z UUID.__gt__r\rcZt|tr|j|jkStSrRrSrVs r__le__z UUID.__le__rYrcZt|tr|j|jkStSrRrSrVs r__ge__z UUID.__ge__rYrc*t|jSrR)hashrr;s r__hash__z UUID.__hash__ sDH~~rc|jSrRrres r__int__z UUID.__int__s xrc@|jjdt|dS)N()) __class__rstrres r__repr__z UUID.__repr__s">222CIIII>>rc td)NzUUID objects are immutable)r2)r;namerKs rr:zUUID.__setattr__s4555rc d|jz}|ddd|ddd|ddd|ddd|dd S)N%032xr%r r!rh)r;r<s r__str__z UUID.__str__s_  GGGS2YYYBrE C2JJJBCCB Brc6|jdS)Nr!)rto_bytesres rr=z UUID.bytessx  $$$rcl|j}|ddd|dddz|dddz|ddzS)Nr"r r#r$r%r=)r;r=s rr>z UUID.bytes_le!sK cg2gs3rz!22U3s2:5FFabb  rcN|j|j|j|j|j|jfSrR)rArBrCrDrErFres rr?z UUID.fields's+ t}d.B)4+=tyJ Jrc|jdz S)Nr)rhres rrAz UUID.time_low,sx2~rc|jdz dzS)Nr*rhres rrBz UUID.time_mid0B&((rc|jdz dzS)Nr+r~rhres rrCzUUID.time_hi_version4rrc|jdz dzS)N8rhres rrDzUUID.clock_seq_hi_variant8B$&&rc|jdz dzS)Nr,rrhres rrEzUUID.clock_seq_low<rrcB|jdzdz|jdzz|jzS)Nr,r )rCrBrAres rtimez UUID.time@s0&/B6"$&(, 6 7rc,|jdzdz|jzS)N?r%)rDrEres rrGzUUID.clock_seqEs"+d2q8"# $rc|jdzS)Nlrhres rrFz UUID.nodeJsx.((rcd|jzS)Nrsrhres rr<zUUID.hexNs!!rc&dt|zS)Nz urn:uuid:)rnres rurnzUUID.urnRsSYY&&rcv|jdzstS|jdzstS|jdzstStS)Nr/ll)r RESERVED_NCSRFC_4122RESERVED_MICROSOFTRESERVED_FUTUREres rvariantz UUID.variantVsFx<( # \* #O\* #% %" "rcZ|jtkrt|jdz dzSdS)Nr0)rrrres rr@z UUID.versionas2 <8 # #B#-.. . $ #r)NNNNNN)$rrr__doc__ __slots__r rrHrMrPrXr[r^r`rbrfriror:rvpropertyr=r>r?rArBrCrDrErrGrFr<rrr@rrrrrUs11f2ICG)-T5"*"2T5T5T5T5T5lHHH    ???666BBB %%X%X JJXJX))X)))X)''X'''X'77X7$$X$))X)""X"''X'##X#//X///rrcPddl}ddl}ddl}ddl} |jd|j|j}| ddg| ||j |}|dSt|j}d|d<|dkr|g|R}n|f}| ||j|j| } | sdS| \} } || S#t$|jf$rYdSwxYw) NrPATHz/sbinz /usr/sbin)pathCLC_ALL)r)stdoutstderrenv)ioosshutil subprocessenvirongetdefpathsplitpathsepextendwhichjoindictPopenPIPEDEVNULL communicateBytesIOOSErrorSubprocessError) commandargsrrrr path_dirs executablerprocrrs r_get_command_stdoutrhsk%%%%%%%%%%%%%%%%JNN62:66<z_parse_mac..sD9941D &&&&Q&&&&999999rrc3BK|]}|ddVdS)r0N)rjustrs rrz_parse_mac..s0@@$$**Q--@@@@@@rc3<K|]}t|dkVdS)rNrrs rrz_parse_mac..s,44d3t99>444444rr!)rrr5_MAC_OMITS_LEADING_ZEROESallrrr6)rpartshexstrs r _parse_macrs JJz " "E 5zzQ ! 99599999  F@@%@@@@@44e44444  F%62 s#B33 CCct||}|dS|} ||}n#t $rYdSwxYwd}|D]k}|} ||} n#t $rY>wxYwt| } | Tt| r| cS|| }l|S)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) rreadlinerrindexr6rrr) rrheadingrr column_indexrrrrrs r_find_mac_under_headingrs !$ / /F ~t  ''))//11H~~g.. ttO " " ##%% &DD    H  ;     JJJ  "!O s$A$$ A21A2"B++ B87B8cFd}dD]}td||d}|r|cSdS)z5Get the hardware address on Unix by running ifconfig.)shwaddrsethersaddress:slladdr)rz-az-avifconfigc |dzSNr-rrs rz#_ifconfig_getnode..s 1Q3rNr)rrrs r_ifconfig_getnodersH=H!$ZxOO  JJJ  4rc6tdddgd}|r|SdS)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  N NC  4rcddl}ddl}t|dsdS ||}n#t $rYdSwxYwt dd|j|gd}|r|St dd|j|gd}|r|St dd|jd|zgd }|r|SdS) z0Get the hardware address on Unix by running arp.rN gethostbynamearpz-ancdS)Nr rrs rrz_arp_getnode..sQSrc |dzSrrrs rrz_arp_getnode..!s QRSTQTrz(%s)c |dzS)Nrrrs rrz_arp_getnode..'s acr)rsockethasattrr gethostnamerrfsencode)rrip_addrrs r _arp_getnoders# 6? + +t&&v'9'9';';<< tt !  G0D0D/E|| T TC   !  G0D0D/E}} U UC   !  FW.0srrrrr_lanscan_getnoder-s ")UWI{{ K KKrc$tdddS)z4Get the hardware address on Unix by running netstat.netstatz-iansAddress)rrrr_netstat_getnoder2s #9fj A AArctSz1[DEPRECATED] Get the hardware address on Windows._windll_getnoderrr_ipconfig_getnoder 7   rctSrrrrr_netbios_getnoder <r rgenerate_time_safe UuidCreatecdS)z>[DEPRECATED] Platform-specific functions loaded at import timeNrrrr_load_system_functionsrOsrc`tr&t\}}t|jSdS)zBGet the hardware address on Unix using the _uuid extension module.rzN)_generate_time_saferrF) uuid_time_s r _unix_getnoderSs7**,, 1)$$$))**rcZtr#t}t|jSdS)zEGet the hardware address on Windows using the _uuid extension module.)r>N) _UuidCreaterrF) uuid_bytess rrrYs1. ]] Z(((--..rc:ddl}|ddzS)zGet a random node ID.rNr,l)random getrandbits)rs r_random_getnoder_s&MMM   b ! !W --rrrposixntcttSttgzD]:} |an#YxYwtdtcxkrdkr n1tcS;dS)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#s  o.. FHHEE  H  A$:$:$:$:'$:$:$:$:$:LLL s -1ctY||cxurRnnOt\}} t|}n#t$rtj}YnwxYwt ||Sddl}|}|dzdz}t|tkr tdz}|a|ddl}| d}|dz} |d z d z} |d z d z} |d z} |dz dz} |t}t | | | | | |fdS)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 r~r,rrr%r)r?r@) rr r6rrrtime_ns_last_timestamprrr#)rFrGrsafely_generatedrr nanoseconds timestamprrArBrCrErDs ruuid1r,so&49+D+D+D+D+D+D+D+D&9&;&;# # '/00GG ' ' '&GGG ')W5555KKK,,..Ks"%77I"yO'C'C#a' O &&r** :%HR6)H B&0O$M%Nd2 |yy (O,mTCLM O O OOs4A  A cddlm}||jt|dzd}t |ddd S) zAGenerate a UUID from the MD5 hash of a namespace UUID and a name.r)md5utf-8F)usedforsecurityNr!r"r=r@)hashlibr.r=digestr) namespacerqr.r3s ruuid3r5sl S%g... fhh  fSbSk1 - - --rcHttjddS)zGenerate a random UUID.r!rr1)rrurandomrrruuid4r8s bjnna 0 0 00rcddlm}||jt|dz}t |dddS)zCGenerate a UUID from the SHA-1 hash of a namespace UUID and a name.r)sha1r/Nr!r#r1)r2r:r=r3r)r4rqr:rds ruuid5r;s[ 4 %g"6"66 7 7 > > @ @D d3B3i + + ++rz$6ba7b810-9dad-11d1-80b4-00c04fd430c8z$6ba7b811-9dad-11d1-80b4-00c04fd430c8z$6ba7b812-9dad-11d1-80b4-00c04fd430c8z$6ba7b814-9dad-11d1-80b4-00c04fd430c8)NN)=rrsysenumrr __author__platform_AIX_LINUXsystem_platform_systemrrrrrrrr7r=bytes_r rrrrrrrrrrrr r _uuidgetattrrrhas_uuid_generate_time_safe_has_uuid_generate_time_safe ImportErrorrrrr _OS_GETTERSrqr!r r#r(r,r5r8r; NAMESPACE_DNS NAMESPACE_URL NAMESPACE_OIDNAMESPACE_X500rrrrOs ,,\ ########+ <&&&D66OOO&x((5(D7*F  !%J $?N?N?N; h*O  d P/P/P/P/P/P/P/P/f\!!! # # #F8!!!L8LLL BBB   (LLL!'%)=tDD'%t44K#(#D  ((( EK#'   (III*** ... . . ., 7 12KK\X$l4DEKK\WKK 7#$KK$k<#%57K7g,HHW__ ;.HHH OOO,$O$O$O$OL...111,,,;<< ;<< ;<< <==s)%C CC