Your IP : 3.140.198.3


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/ipaddress.cpython-310.opt-2.pyc

o

6��f�/�@s�	dZddlZdZdZGdd�de�ZGdd�de�Zd	d
�Zd<dd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�ZGd"d#�d#�ZdaejGd$d%�d%e��ZejGd&d'�d'e��ZGd(d)�d)�ZGd*d+�d+ee�ZGd,d-�d-e�ZGd.d/�d/ee�ZGd0d1�d1�Zee_Gd2d3�d3�ZGd4d5�d5ee�ZGd6d7�d7e�Z Gd8d9�d9ee�Z!Gd:d;�d;�Z"e"e_dS)=z1.0�N� �c@�eZdZdS)�AddressValueErrorN��__name__�
__module__�__qualname__�r
r
�0/opt/alt/python310/lib64/python3.10/ipaddress.pyr�rc@r)�NetmaskValueErrorNrr
r
r
rr
rr
c	C�T	zt|�WSttfyYnwzt|�WSttfy"Ynwt|�d���)Nz. does not appear to be an IPv4 or IPv6 address)�IPv4Addressrr
�IPv6Address�
ValueError��addressr
r
r�
ip_addresss
�
�rTc	CsX	zt||�WSttfyYnwzt||�WSttfy$Ynwt|�d���)Nz. does not appear to be an IPv4 or IPv6 network)�IPv4Networkrr
�IPv6Networkr)r�strictr
r
r�
ip_network9s��rc	Cr)Nz0 does not appear to be an IPv4 or IPv6 interface)�
IPv4Interfacerr
�
IPv6Interfacerrr
r
r�ip_interfaceVs
�
�rcC�(	z|�dd�WStytd��w)N��bigz&Address negative or too large for IPv4��to_bytes�
OverflowErrorrrr
r
r�v4_int_to_packedxs
�r"cCr)N�rz&Address negative or too large for IPv6rrr
r
r�v6_int_to_packed�s	�r$cCs.	t|��d�}t|�dkrtd|����|S)N�/�zOnly one '/' permitted in )�str�split�lenr)r�addrr
r
r�_split_optional_netmask�s
r+ccsR�	t|�}t|�}}|D]}|j|jdkr||fV|}|}q||fVdS�N�)�iter�next�_ip)�	addresses�it�first�last�ipr
r
r�_find_address_range�s�	
r6cCs&	|dkr|St|||d@���S)Nrr-)�min�
bit_length)Znumber�bitsr
r
r�_count_righthand_zero_bits�s
r:ccs��	t|t�rt|t�std��|j|jkrtd||f��||kr&td��|jdkr.t}n|jdkr6t}ntd��|j}|j}|j}||krwt	t
||�||d��d�}||||f�}|V|d|>7}|d|jkrqdS||ksGdSdS)Nz1first and last must be IP addresses, not networks�%%s and %s are not of the same versionz*last IP address must be greater than firstr�zunknown IP versionr-)
�
isinstance�_BaseAddress�	TypeError�versionrrr�_max_prefixlenr0r7r:r8�	_ALL_ONES)r3r4r5Zip_bitsZ	first_intZlast_intZnbits�netr
r
r�summarize_address_range�s<�
��


��rDccs��	t|�}i}|r.|��}|��}|�|�}|dur |||<n||kr,||=|�|�|s
d}t|���D]}|durC|j|jkrCq6|V|}q6dS�N)�list�pop�supernet�get�append�sorted�values�broadcast_address)r1Zto_merge�subnetsrCrHZexistingr4r
r
r�_collapse_addresses_internal�s,�


��rOc	Cs*	g}g}g}|D]l}t|t�r*|r$|dj|jkr$td||df��|�|�q	|j|jkr\|rD|dj|jkrDtd||df��z|�|j�Wq	ty[|�|j	�Yq	w|rp|dj|jkrptd||df��|�|�q	t
t|��}|r�t|�D]\}}|�
t||��q�t||�S)N���r;)r=r>�_versionr?rJ�
_prefixlenrAr5�AttributeError�network_addressrK�setr6�extendrDrO)r1ZaddrsZipsZnetsr5r3r4r
r
r�collapse_addresses0s>
����rWcCs*	t|t�r
|��St|t�r|��StSrE)r=�_BaseNetwork�_get_networks_keyr>�_get_address_key�NotImplemented)�objr
r
r�get_mixed_type_keyfs

r]c@s�eZdZ	dZedd��Zedd��Zedd��Zedd	��Zd
d�Z	dd
�Z
edd��Zedd��Z
edd��Zedd��Zedd��Zedd��Zdd�ZdS)�_IPAddressBaser
cC�
	|��SrE)�_explode_shorthand_ip_string��selfr
r
r�exploded��z_IPAddressBase.explodedcCs
	t|�SrE�r'rar
r
r�
compressed�rdz_IPAddressBase.compressedcCr_rE)�_reverse_pointerrar
r
r�reverse_pointer��z_IPAddressBase.reverse_pointercC�dt|�f}t|��)Nz%200s has no version specified��type�NotImplementedError�rb�msgr
r
rr@�sz_IPAddressBase.versioncCsF|dkrd}t|||jf��||jkr!d}t|||j|jf��dS)Nrz-%d (< 0) is not permitted as an IPv%d addressz2%d (>= 2**%d) is not permitted as an IPv%d address)rrQrBrA)rbrror
r
r�_check_int_address�s

��z!_IPAddressBase._check_int_addresscCs.t|�}||krd}t|||||jf��dS)Nz6%r (len %d != %d) is not permitted as an IPv%d address)r)rrQ)rbrZexpected_lenZaddress_lenror
r
r�_check_packed_address�s��z$_IPAddressBase._check_packed_addresscCs	|j|j|?ASrE)rB)�cls�	prefixlenr
r
r�_ip_int_from_prefix�s	z"_IPAddressBase._ip_int_from_prefixc	Cs^	t||j�}|j|}||?}d|>d}||kr-|jd}|�|d�}d}t||��|S)Nr-�rz&Netmask pattern %r mixes zeroes & ones)r:rAr r)	rr�ip_intZtrailing_zeroesrsZleading_onesZall_onesZbyteslenZdetailsror
r
r�_prefix_from_ip_int�s�

z"_IPAddressBase._prefix_from_ip_intcCsd|}t|�d�)Nz%r is not a valid netmask)r
)rrZnetmask_strror
r
r�_report_invalid_netmask�s
z&_IPAddressBase._report_invalid_netmaskcCsl	|��r	|��s|�|�zt|�}Wnty"|�|�Ynwd|kr.|jks4n|�|�|S�Nr)�isascii�isdigitrx�intrrA)rrZ
prefixlen_strrsr
r
r�_prefix_from_prefix_string�s
�
z)_IPAddressBase._prefix_from_prefix_stringcCs�	z|�|�}Wnty|�|�Ynwz|�|�WSty&Ynw||jN}z|�|�WStyA|�|�YdSwrE)�_ip_int_from_stringrrxrwrrB)rr�ip_strrvr
r
r�_prefix_from_ip_string�s"��
�z%_IPAddressBase._prefix_from_ip_stringcCsJ	t|ttf�r
||jfSt|t�st|�}t|�dkr|S|d|jfS)Nr-r)r=�bytesr|rA�tupler+r))rrrr
r
r�_split_addr_prefixs	

z!_IPAddressBase._split_addr_prefixcCs|jt|�ffSrE)�	__class__r'rar
r
r�
__reduce__-�z_IPAddressBase.__reduce__N)rrr	�	__slots__�propertyrcrfrhr@rprq�classmethodrtrwrxr}r�r�r�r
r
r
rr^s4




	




!
r^csreZdZ	dZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
�fdd�Z�ZS)r>r
cC�|jSrE�r0rar
r
r�__int__>sz_BaseAddress.__int__cCs2z
|j|jko|j|jkWStytYSwrE)r0rQrSr[�rb�otherr
r
r�__eq__As
��z_BaseAddress.__eq__cCsFt|t�stS|j|jkrtd||f��|j|jkr!|j|jkSdS�Nr;F)r=r>r[rQr?r0r�r
r
r�__lt__Hs
�z_BaseAddress.__lt__cCs t|t�stS|�t|�|�SrE�r=r|r[r�r�r
r
r�__add__T�
z_BaseAddress.__add__cCs t|t�stS|�t|�|�SrEr�r�r
r
r�__sub__Yr�z_BaseAddress.__sub__cC�d|jjt|�fS�Nz%s(%r)�r�rr'rar
r
r�__repr__^�z_BaseAddress.__repr__cCst|�|j��SrE)r'�_string_from_ip_intr0rar
r
r�__str__ar�z_BaseAddress.__str__cCsttt|j���SrE)�hash�hexr|r0rar
r
r�__hash__dsz_BaseAddress.__hash__cCs
|j|fSrE�rQrar
r
rrZgs
z_BaseAddress._get_address_keycCs|j|jffSrE)r�r0rar
r
rr�jsz_BaseAddress.__reduce__cs�	|r	|ddkrtt|�|�Stdurddl}|�d�at�|�}|s*t��|�S|��\}}}|dkr?|j	dkr=d}nd}|dkrG|j
}n|j
d}|rV||dd	7}|r\|d
7}tt|�|�d|�|�|���S)NrP�srz(#?)(_?)([xbnX])�nr�b�xr-r&�0)�formatr'�_address_fmt_re�re�compile�	fullmatch�super�
__format__�groupsrQrAr|)rbZfmtr��mZ	alternateZgroupingZfmt_baseZpadlen�r�r
rr�ms,




 z_BaseAddress.__format__)rrr	r�r�r�r�r�r�r�r�r�rZr�r��
__classcell__r
r
r�rr>3sr>c@s^eZdZ	dd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Ze
jdd��Ze
jdd��Zedd��Zedd��Zedd��Zedd ��Zed!d"��Zed#d$��Zd%d&�Zd'd(�Zd)d*�ZdEd-d.�ZdEd/d0�Zed1d2��Zed3d4��Zd5d6�Z d7d8�Z!ed9d:��Z"ed;d<��Z#ed=d>��Z$ed?d@��Z%edAdB��Z&edCdD��Z'd,S)FrXcCr�r�r�rar
r
rr��r�z_BaseNetwork.__repr__cC�d|j|jfS�N�%s/%d)rTrsrar
r
rr��r�z_BaseNetwork.__str__ccs<�	t|j�}t|j�}t|d|�D]}|�|�VqdSr,�r|rTrM�range�_address_class�rb�network�	broadcastr�r
r
r�hosts�s�

�z_BaseNetwork.hostsccs:�t|j�}t|j�}t||d�D]}|�|�VqdSr,r�r�r
r
r�__iter__�s�

�z_BaseNetwork.__iter__cCsht|j�}t|j�}|dkr|||krtd��|�||�S|d7}|||kr-td��|�||�S)Nrzaddress out of ranger-)r|rTrM�
IndexErrorr�)rbr�r�r�r
r
r�__getitem__�s

z_BaseNetwork.__getitem__cCs^t|t�stS|j|jkrtd||f��|j|jkr!|j|jkS|j|jkr-|j|jkSdSr�)r=rXr[rQr?rT�netmaskr�r
r
rr��s
�z_BaseNetwork.__lt__cCsFz|j|jko|j|jkot|j�t|j�kWSty"tYSwrE)rQrTr|r�rSr[r�r
r
rr��s
���z_BaseNetwork.__eq__cCstt|j�t|j�A�SrE)r�r|rTr�rar
r
rr��sz_BaseNetwork.__hash__cCs4|j|jkrdSt|t�rdS|j|jj@|jjkS�NF)rQr=rXr0r�rTr�r
r
r�__contains__�s

z_BaseNetwork.__contains__cCs*	|j|vp|j|vp|j|vp|j|vSrE)rTrMr�r
r
r�overlaps�s


�z_BaseNetwork.overlapscCs|�t|j�t|j�B�SrE)r�r|rT�hostmaskrar
r
rrM�s�z_BaseNetwork.broadcast_addresscCs|�t|j�|jA�SrE)r�r|r�rBrar
r
rr��sz_BaseNetwork.hostmaskcCr�r�)rTrRrar
r
r�with_prefixlen��z_BaseNetwork.with_prefixlencCr��N�%s/%s)rTr�rar
r
r�with_netmaskr�z_BaseNetwork.with_netmaskcCr�r�)rTr�rar
r
r�
with_hostmaskr�z_BaseNetwork.with_hostmaskcCs	t|j�t|j�dSr,)r|rMrTrar
r
r�
num_addressessz_BaseNetwork.num_addressescCrj)Nz%%200s has no associated address classrkrnr
r
rr�sz_BaseNetwork._address_classcCr�rE)rRrar
r
rrs�z_BaseNetwork.prefixlenccs"�	|j|jkstd||f��t|t�std|��|�|�s(td||f��||kr.dS|�d|j|jf�}|�	�\}}||krv||krv|�|�rV|V|�	�\}}n|�|�re|V|�	�\}}n	t
d|||f��||krv||ksG||kr|VdS||kr�|VdSt
d|||f��)Nr;z%s is not a network objectz%s not contained in %sr�z3Error performing exclusion: s1: %s s2: %s other: %s)rQr?r=rX�	subnet_ofrr�rTrsrN�AssertionError)rbr��s1�s2r
r
r�address_excludesD�#�


�

��

�z_BaseNetwork.address_excludecCsb	|j|jkrtd||f��|j|jkrdS|j|jkrdS|j|jkr'dS|j|jkr/dSdS)Nz"%s and %s are not of the same typerPr-r)rQr?rTr�r�r
r
r�compare_networksgs �z_BaseNetwork.compare_networkscCs	|j|j|jfSrE)rQrTr�rar
r
rrY�sz_BaseNetwork._get_networks_keyr-Nc	cs��	|j|jkr
|VdS|dur'||jkrtd��|dkr"td��||j}|dkr/td��|j|}||jkrAtd||f��t|j�}t|j�d}t|j�d|?}t|||�D]}|�||f�}|Vq\dS)Nznew prefix must be longerr-�(cannot set prefixlen_diff and new_prefixrzprefix length diff must be > 0z0prefix length diff %d is invalid for netblock %s)	rRrArr|rTrMr�r�r�)	rb�prefixlen_diff�
new_prefix�
new_prefixlen�start�end�stepZnew_addrZcurrentr
r
rrN�s6�



��
�z_BaseNetwork.subnetscCs�	|jdkr|S|dur"||jkrtd��|dkrtd��|j|}|j|}|dkr4td|j|f��|�t|j�t|j�|>@|f�S)Nrznew prefix must be shorterr-r�z;current prefixlen is %d, cannot have a prefixlen_diff of %d)rRrrsr�r|rTr�)rbr�r�r�r
r
rrH�s(



���z_BaseNetwork.supernetcC�	|jjo|jjSrE)rT�is_multicastrMrar
r
rr����z_BaseNetwork.is_multicastcCs^z|j|jkrt|�d|�d���|j|jko|j|jkWSty.td|�d|����w)Nz and z are not of the same versionz*Unable to test subnet containment between )rQr?rTrMrS)�ar�r
r
r�
_is_subnet_ofs
����z_BaseNetwork._is_subnet_ofcCs	|�||�SrE�r�r�r
r
rr��z_BaseNetwork.subnet_ofcCs	|�||�SrEr�r�r
r
r�supernet_ofr�z_BaseNetwork.supernet_ofcCr�rE)rT�is_reservedrMrar
r
rr�r�z_BaseNetwork.is_reservedcCr�rE)rT�
is_link_localrMrar
r
rr�+s�z_BaseNetwork.is_link_localcCr�rE)rT�
is_privaterMrar
r
rr�6r�z_BaseNetwork.is_privatecC�
	|jSrE�r�rar
r
r�	is_globalBriz_BaseNetwork.is_globalcCr�rE)rT�is_unspecifiedrMrar
r
rr�Mr�z_BaseNetwork.is_unspecifiedcCr�rE)rT�is_loopbackrMrar
r
rr�Yr�z_BaseNetwork.is_loopback)r-N)(rrr	r�r�r�r�r�r�r�r�r�r��	functools�cached_propertyrMr�r�r�r�r�r�r�rsr�r�rYrNrHr��staticmethodr�r�r�r�r�r�r�r�r�r
r
r
rrX�sf








K0


5)








rXc@s�eZdZ	dZdZdedZeZiZdd�Z	e
dd��Ze
d	d
��Ze
dd��Z
e
d
d��Zdd�Zedd��Zedd��ZdS)�_BaseV4r
rr&r-cCst|�SrErerar
r
rr`xsz$_BaseV4._explode_shorthand_ip_stringcCs�	||jvrCt|t�r|}d|kr|jksn|�|�nz|�|�}Wnty4|�|�}Ynwt|�	|��}||f|j|<|j|Sry)
�_netmask_cacher=r|rArxr}r
r�rrt�rr�argrsr�r
r
r�
_make_netmask{s


��
z_BaseV4._make_netmaskc
Csr	|std��|�d�}t|�dkrtd|��zt�t|j|�d�WSty8}z	td||f�d�d}~ww)N�Address cannot be empty�.rzExpected 4 octets in %rr�%s in %r)rr(r)r|�
from_bytes�map�_parse_octetr)rrrZoctets�excr
r
rr~�s
��z_BaseV4._ip_int_from_stringcCs�	|std��|��r|��sd}t||��t|�dkr%d}t||��|dkr7|ddkr7d}t||��t|d�}|d	krFtd
|��|S)NzEmpty octet not permittedz#Only decimal digits permitted in %r�z$At most 3 characters permitted in %rr�rz%Leading zeros are not permitted in %r�
�zOctet %d (> 255) not permitted)rrzr{r)r|)rrZ	octet_strroZ	octet_intr
r
rr��s 
z_BaseV4._parse_octetcCs	d�tt|�dd���S)Nr�rr)�joinr�r'r )rrrvr
r
rr��s	z_BaseV4._string_from_ip_intcCs(	t|��d�ddd�}d�|�dS)Nr�rPz
.in-addr.arpa)r'r(r�)rbZreverse_octetsr
r
rrg��z_BaseV4._reverse_pointercCr�rE�rArar
r
r�
max_prefixlen�r�z_BaseV4.max_prefixlencCr�rEr�rar
r
rr@�r�z_BaseV4.versionN)rrr	r�rQ�
IPV4LENGTHrBrAr�r`r�r�r~r�r�rgr�r�r@r
r
r
rr�es*


#
	
r�c@s�eZdZ	dZdd�Zedd��Zedd��Zee�	�dd	���Z
ee�	�d
d���Zedd
��Zedd��Z
edd��Zedd��ZdS)r)r0�__weakref__cCsv	t|t�r|�|�||_dSt|t�r$|�|d�t�|d�|_dSt|�}d|vr3td|����|�	|�|_dS)Nrrr%�Unexpected '/' in )
r=r|rpr0r�rqr�r'rr~�rbrZaddr_strr
r
r�__init__�s


zIPv4Address.__init__cC�	t|j�SrE)r"r0rar
r
r�packed�
zIPv4Address.packedcC�	||jjvSrE)�
_constants�_reserved_networkrar
r
rr� �zIPv4Address.is_reservedcs6	t�fdd��jjD��ot�fdd��jjD��S)Nc3��|]}�|vVqdSrEr
��.0rCrar
r�	<genexpr>=��z)IPv4Address.is_private.<locals>.<genexpr>c3��|]}�|vVqdSrEr
rrar
rr
>r)�anyr�_private_networks�all�_private_networks_exceptionsrar
rarr�+s�zIPv4Address.is_privatecCs	||jjvo
|jSrE)r�_public_networkr�rar
r
rr�As
zIPv4Address.is_globalcCrrE�r�_multicast_networkrar
r
rr�Sr	zIPv4Address.is_multicastcCs	||jjkSrE)r�_unspecified_addressrar
r
rr�^r	zIPv4Address.is_unspecifiedcCrrE)r�_loopback_networkrar
r
rr�i�zIPv4Address.is_loopbackcCrrE�r�_linklocal_networkrar
r
rr�srzIPv4Address.is_link_localN)rrr	r�rr�rr�r��	lru_cacher�r�r�r�r�r�r
r
r
rr�s,#







	rc@sxeZdZdd�Zejdd��Zdd�Zdd�Zd	d
�Z	dd�Z
ejZe
d
d��Ze
dd��Ze
dd��Ze
dd��ZdS)rcC�D|�|�\}}t�||�t||fdd�|_|jj|_|jj|_dS�NF)r)r�rrrr�r�rR�rbrr*�maskr
r
rr��

zIPv4Interface.__init__cC�|jjSrE�r�r�rar
r
rr���zIPv4Interface.hostmaskcC�d|�|j�|jfSr��r�r0rRrar
r
rr��s�zIPv4Interface.__str__cC�@t�||�}|tus|s|Sz|j|jkWStyYdSwr�)rr�r[r�rS�rbr�Z
address_equalr
r
rr����zIPv4Interface.__eq__cCsLt�||�}|turtSz|j|jkp|j|jko|WSty%YdSwr�)rr�r[r�rS�rbr�Zaddress_lessr
r
rr�����zIPv4Interface.__lt__cC�t|j|jt|jj�f�SrE�r�r0rRr|r�rTrar
r
rr���zIPv4Interface.__hash__cC�
t|j�SrE)rr0rar
r
rr5��
zIPv4Interface.ipcCr%r�r&rar
r
rr����zIPv4Interface.with_prefixlencCr%r��r�r0r�rar
r
rr��r1zIPv4Interface.with_netmaskcCr%r��r�r0r�rar
r
rr��r1zIPv4Interface.with_hostmaskN)rrr	rr�r�r�r�r�r�r�r^r�r�r5r�r�r�r
r
r
rr~s"



rc@s0eZdZ	eZddd�Zee��dd���Z	dS)rTc�	|�|�\�}t��|_|�|�\|_|_t|j�}|t|j�@|kr6|r,td|��t|t|j�@�|_|j|jdkrD|j	|_
dS|j|jkrS�fdd�|_
dSdS)N�%s has host bits setr-c�
t��gSrE)rr
�r*r
r�<lambda>�
z&IPv4Network.__init__.<locals>.<lambda>)r�rrTr�r�rRr|rrAr�r��rbrrr rr
r7rr�s "

��zIPv4Network.__init__cCs(	|jtd�vo|jtd�vo|jS)N�
100.64.0.0/10)rTrrMr�rar
r
rr�s��zIPv4Network.is_globalN�T)
rrr	rr�rr�r�rr�r
r
r
rr�s
4rc@s�eZdZed�Zed�Zed�Zed�Zed�ed�ed�ed�ed�ed�ed	�ed
�ed�ed�ed
�ed�ed�ed�gZed�ed�gZ	ed�Z
ed�ZdS)�_IPv4Constantsz169.254.0.0/16z127.0.0.0/8z224.0.0.0/4r;z	0.0.0.0/8z
10.0.0.0/8z
172.16.0.0/12z192.0.0.0/24z192.0.0.170/31z192.0.2.0/24z192.168.0.0/16z
198.18.0.0/15z198.51.100.0/24z203.0.113.0/24z240.0.0.0/4z255.255.255.255/32z192.0.0.9/32z
192.0.0.10/32z0.0.0.0N)
rrr	rrrrrrrrrrr
r
r
rr=s2��r=c@s�eZdZ	dZdZdedZdZed�Z	eZ
iZedd��Z
ed	d
��Zedd��Zed
d��Zeddd��Zdd�Zdd�Zedd��Zedd��Zedd��ZdS)�_BaseV6r
r<r&r-ruZ0123456789ABCDEFabcdefcCsn	||jvr2t|t�r|}d|kr|jksn|�|�n|�|�}t|�|��}||f|j|<|j|Sry)r�r=r|rArxr}rrtr�r
r
rr�Ps


�

z_BaseV6._make_netmaskc
Cs�	|std��|�d�}d}t|�|krd||f}t|��d|dvrWz	t|���j}WntyB}z	td||f�d�d}~ww|�d|d	?d
@�|�d|d
@�|jd}t|�|krnd|d|f}t|��d}tdt|�d�D]}	||	s�|dur�d
|}t|��|	}qy|dur�|}
t|�|d}|ds�|
d8}
|
r�d}t||��|ds�|d8}|r�d}t||��|j|
|}|dkr�d}t||jd|f��n3t|�|jkr�d}t||j|f��|ds�d}t||��|d�sd}t||��t|�}
d}d}z7d}
t|
�D]}	|
d	K}
|
|�	||	�O}
�q|
d	|K}
t|d�D]}	|
d	K}
|
|�	||	�O}
�q0|
WSt
�yY}z	td||f�d�d}~ww)Nr��:r�z At least %d parts expected in %rr�rPr��%xr#�r-z!At most %d colons permitted in %rz At most one '::' permitted in %rrz0Leading ':' only permitted as part of '::' in %rz1Trailing ':' only permitted as part of '::' in %rz/Expected at most %d other parts with '::' in %rz,Exactly %d parts expected without '::' in %r)rr(r)rrGr0rJ�
_HEXTET_COUNTr��
_parse_hextetr)rrr�partsZ
_min_partsroZipv4_intr�Z
_max_partsZ
skip_index�iZparts_hiZparts_loZ
parts_skippedrvr
r
rr~ds�
��
��
��z_BaseV6._ip_int_from_stringcCs@	|j�|�s
td|��t|�dkrd}t||��t|d�S)NzOnly hex digits permitted in %rrz$At most 4 characters permitted in %rr#)�_HEX_DIGITS�
issupersetrr)r|)rrZ
hextet_strror
r
rrC�s
z_BaseV6._parse_hextetc	Cs�	d}d}d}d}t|�D]\}}|dkr(|d7}|dkr|}||kr'|}|}q
d}d}q
|dkrP||}|t|�kr@|dg7}dg|||�<|dkrPdg|}|S)NrPrr�r-�)�	enumerater))	rr�hextetsZbest_doublecolon_startZbest_doublecolon_lenZdoublecolon_startZdoublecolon_len�indexZhextetZbest_doublecolon_endr
r
r�_compress_hextets�s4��

z_BaseV6._compress_hextetsNcs\	|dur
t|j�}||jkrtd��d|��fdd�tddd�D�}|�|�}d�|�S)	NzIPv6 address is too large�%032xcs&g|]}dt�||d�d��qS)r@rr#)r|�rr��Zhex_strr
r�
<listcomp>+s&z/_BaseV6._string_from_ip_int.<locals>.<listcomp>rrrr?)r|r0rBrr�rLr�)rrrvrJr
rOrr�s



z_BaseV6._string_from_ip_intcs�	t|t�rt|j�}nt|t�rt|j�}nt|�}|�|�}d|��fdd�tddd�D�}t|ttf�rBdd�	|�|j
fSd�	|�S)	NrMcsg|]
}�||d��qS)rr
rNrOr
rrPCsz8_BaseV6._explode_shorthand_ip_string.<locals>.<listcomp>rrrr�r?)r=rr'rTrr5r~r�rXr�rR)rbrrvrDr
rOrr`0s
	


z$_BaseV6._explode_shorthand_ip_stringcCs(	|jddd��dd�}d�|�dS)NrPr?rHr�z	.ip6.arpa)rc�replacer�)rbZ
reverse_charsr
r
rrgHr�z_BaseV6._reverse_pointercCsB	|�d�\}}}|sd}||fS|rd|vrtd|��||fS)N�%zInvalid IPv6 address: "%r")�	partitionr)rr*�sep�scope_idr
r
r�_split_scope_idQs�z_BaseV6._split_scope_idcCr�rEr�rar
r
rr�er�z_BaseV6.max_prefixlencCr�rEr�rar
r
rr@ir�z_BaseV6.versionrE)rrr	r�rQ�
IPV6LENGTHrBrB�	frozensetrFrAr�r�r�r~rCrLr�r`rgr�rVr�r�r@r
r
r
rr><s6

g

/	

r>cs�eZdZ	dZdd�Z�fdd�Zdd�Z�fdd	�Zed
d��Z	edd
��Z
edd��Zedd��Zedd��Z
edd��Zee��dd���Zedd��Zedd��Zedd��Zedd��Zed d!��Zed"d#��Z�ZS)$r)r0�	_scope_idr�cCs�	t|t�r|�|�||_d|_dSt|t�r*|�|d�t�|d�|_d|_dSt|�}d|vr9t	d|����|�
|�\}|_|�|�|_dS)Nr#rr%r)r=r|rpr0rYr�rqr�r'rrVr~rr
r
rrts 


zIPv6Address.__init__cs"t���}|jr|d|jS|S)NrR)r�r�rY)rbrr�r
rr��s
zIPv6Address.__str__cCst|j|jf�SrE)r�r0rYrar
r
rr��r�zIPv6Address.__hash__cs2t��|�}|turtS|sdS|jt|dd�kS)NFrY)r�r�r[rY�getattrr(r�r
rr��szIPv6Address.__eq__cCs	|jSrE)rYrar
r
rrU�szIPv6Address.scope_idcCrrE)r$r0rar
r
rr�rzIPv6Address.packedcCrrErrar
r
rr��r	zIPv6Address.is_multicastcs	t�fdd��jjD��S)Nc3r
rEr
rNrar
rr
�rz*IPv6Address.is_reserved.<locals>.<genexpr>)rr�_reserved_networksrar
rarr��szIPv6Address.is_reservedcCrrErrar
r
rr��rzIPv6Address.is_link_localcCrrE)r�_sitelocal_networkrar
r
r�
is_site_local�s
zIPv6Address.is_site_localcsJ	�j}|dur|jSt�fdd��jjD��o$t�fdd��jjD��S)Nc3r
rEr
rrar
rr
�rz)IPv6Address.is_private.<locals>.<genexpr>c3rrEr
rrar
rr
r)�ipv4_mappedr�rrrrr)rbr^r
rarr��s�zIPv6Address.is_privatecCr�rEr�rar
r
rr�s
zIPv6Address.is_globalcC�	|jdkSryr�rar
r
rr��
zIPv6Address.is_unspecifiedcCr_r,r�rar
r
rr�r`zIPv6Address.is_loopbackcCs"	|jd?dkr
dSt|jd@�S)NrrA����r0rrar
r
rr^*szIPv6Address.ipv4_mappedcCs6	|jd?dkr
dSt|jd?d@�t|jd@�fS)N�`i �@rarbrar
r
r�teredo7s�zIPv6Address.teredocCs&	|jd?dkr
dSt|jd?d@�S)N�pi �Prarbrar
r
r�	sixtofourFszIPv6Address.sixtofour)rrr	r�rr�r�r�r�rUrr�r�r�r]r�rr�r�r�r�r^rerhr�r
r
r�rrnsD(






	








rcs�eZdZdd�Zejdd��Z�fdd�Zdd�Zd	d
�Z	dd�Z
ejZe
d
d��Ze
dd��Ze
dd��Ze
dd��Ze
dd��Ze
dd��Z�ZS)rcCrr)r�rrrr�r�rRrr
r
rrVr!zIPv6Interface.__init__cCr"rEr#rar
r
rr�^r$zIPv6Interface.hostmaskcsdt���|jfSr�)r�r�rRrar�r
rr�bs
�zIPv6Interface.__str__cCr'r�)rr�r[r�rSr(r
r
rr�fr)zIPv6Interface.__eq__cCsLt�||�}|tur|Sz|j|jkp|j|jko|WSty%YdSwr�)rr�r[r�rSr*r
r
rr�rr+zIPv6Interface.__lt__cCr,rEr-rar
r
rr�~r.zIPv6Interface.__hash__cCr/rE)rr0rar
r
rr5�r0zIPv6Interface.ipcCr%r�r&rar
r
rr��r1zIPv6Interface.with_prefixlencCr%r�r2rar
r
rr��r1zIPv6Interface.with_netmaskcCr%r�r3rar
r
rr��r1zIPv6Interface.with_hostmaskcC�|jdko|jjSry)r0r�r�rar
r
rr���zIPv6Interface.is_unspecifiedcCrir,)r0r�r�rar
r
rr��rjzIPv6Interface.is_loopback)rrr	rr�r�r�r�r�r�r�r^r�r�r5r�r�r�r�r�r�r
r
r�rrTs*





rc@s0eZdZ	eZd	dd�Zdd�Zedd��ZdS)
rTcr4)Nr5r-cr6rE)rr
r7r
rr8�r9z&IPv6Network.__init__.<locals>.<lambda>)r�rrTr�r�rRr|rrAr�r�r:r
r7rr�s 

��zIPv6Network.__init__ccs@�	t|j�}t|j�}t|d|d�D]}|�|�VqdSr,r�r�r
r
rr��s�

�zIPv6Network.hostscCr�rE)rTr]rMrar
r
rr]�s
�zIPv6Network.is_site_localNr<)	rrr	rr�rr�r�r]r
r
r
rr�s
0rc@s�eZdZed�Zed�Zed�ed�ed�ed�ed�ed�ed	�ed
�ed�ed�g
Zed�ed
�ed�ed�ed�ed�gZed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed �gZed!�Z	d"S)#�_IPv6Constantsz	fe80::/10zff00::/8z::1/128z::/128z
::ffff:0:0/96z64:ff9b:1::/48z100::/64z	2001::/23z
2001:db8::/32z	2002::/16zfc00::/7z
2001:1::1/128z
2001:1::2/128z2001:3::/32z2001:4:112::/48z2001:20::/28z2001:30::/28z::/8z100::/8z200::/7z400::/6z800::/5z1000::/4z4000::/3z6000::/3z8000::/3zA000::/3zC000::/3zE000::/4zF000::/5zF800::/6zFE00::/9z	fec0::/10N)
rrr	rrrrrr[r\r
r
r
rrk�s>��
�rkr<)#�__version__r�r�rWrrr
rrrr"r$r+r6r:rDrOrWr]r^r��total_orderingr>rXr�rrrr=rr>rrrrkr
r
r
r�<module>s\
"7163kH
CR&4gK\
-

?>