Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/__pycache__/ipaddress.cpython-37.opt-2.pyc

B

YI~dj�@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#�ZejGd$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�ZGd8d9�d9ee�Z Gd:d;�d;�Z!e!e_dS)=z1.0�N� �c@seZdZdS)�AddressValueErrorN)�__name__�
__module__�__qualname__�rr�./opt/alt/python37/lib64/python3.7/ipaddress.pyrsrc@seZdZdS)�NetmaskValueErrorN)rrrrrrr	r
sr
c	CsTyt|�Sttfk
r YnXyt|�Sttfk
rBYnXtd|��dS)Nz0%r does not appear to be an IPv4 or IPv6 address)�IPv4Addressrr
�IPv6Address�
ValueError)�addressrrr	�
ip_addresssrTc	CsXy
t||�Sttfk
r"YnXy
t||�Sttfk
rFYnXtd|��dS)Nz0%r does not appear to be an IPv4 or IPv6 network)�IPv4Networkrr
�IPv6Networkr
)r�strictrrr	�
ip_network9s

rc	CsTyt|�Sttfk
r YnXyt|�Sttfk
rBYnXtd|��dS)Nz2%r does not appear to be an IPv4 or IPv6 interface)�
IPv4Interfacerr
�
IPv6Interfacer
)rrrr	�ip_interfaceWsrcCs.y|�dd�Stk
r(td��YnXdS)N��bigz&Address negative or too large for IPv4)�to_bytes�
OverflowErrorr
)rrrr	�v4_int_to_packedzsrcCs.y|�dd�Stk
r(td��YnXdS)N�rz&Address negative or too large for IPv6)rrr
)rrrr	�v6_int_to_packed�s
rcCs*t|��d�}t|�dkr&td|��|S)N�/�zOnly one '/' permitted in %r)�str�split�lenr)r�addrrrr	�_split_optional_netmask�sr$ccsRt|�}t|�}}x.|D]&}|j|jdkr<||fV|}|}qW||fVdS)N�)�iter�next�_ip)�	addresses�it�first�last�iprrr	�_find_address_range�s


r.cCs$|dkr|St|||d@���S)Nrr%)�min�
bit_length)Znumber�bitsrrr	�_count_righthand_zero_bits�sr2ccs�t|t�rt|t�std��|j|jkr8td||f��||krHtd��|jdkrXt}n|jdkrht}ntd��|j}|j}|j}x^||kr�t	t
||�||d��d�}||||f�}|V|d|>7}|d|jkr�Pq�WdS)Nz1first and last must be IP addresses, not networksz%%s and %s are not of the same versionz*last IP address must be greater than firstr�zunknown IP versionr%)
�
isinstance�_BaseAddress�	TypeError�versionr
rr�_max_prefixlenr(r/r2r0�	_ALL_ONES)r+r,r-Zip_bitsZ	first_intZlast_intZnbits�netrrr	�summarize_address_range�s0





r;ccs�t|�}i}xL|rX|��}|��}|�|�}|dkr>|||<q||kr||=|�|�qWd}x4t|���D]$}|dk	r�|j|jkr�ql|V|}qlWdS)N)�list�pop�supernet�get�append�sorted�values�broadcast_address)r)Zto_merge�subnetsr:r>Zexistingr,rrr	�_collapse_addresses_internals$

rEc	Cs8g}g}g}x�|D]�}t|t�rT|rH|dj|jkrHtd||df��|�|�q|j|jkr�|r�|dj|jkr�td||df��y|�|j�Wq�tk
r�|�|j	�Yq�Xq|r�|dj|jkr�td||df��|�|�qWt
t|��}|�r,x&t|�D]\}}|�
t||���qWt||�S)N���z%%s and %s are not of the same version)r4r5�_versionr6r@�
_prefixlenr8r-�AttributeError�network_addressrA�setr.�extendr;rE)r)ZaddrsZipsZnetsr-r+r,rrr	�collapse_addresses2s4

rMcCs(t|t�r|��St|t�r$|��StS)N)r4�_BaseNetwork�_get_networks_keyr5�_get_address_key�NotImplemented)�objrrr	�get_mixed_type_keyhs


rSc@s�eZdZdZedd��Zedd��Zedd��Zedd	��Zd
d�Z	dd
�Z
edd��Zedd��Z
edd��Zedd��Zedd��Zedd��Zdd�ZdS)�_IPAddressBasercCs|��S)N)�_explode_shorthand_ip_string)�selfrrr	�exploded�sz_IPAddressBase.explodedcCst|�S)N)r )rVrrr	�
compressed�sz_IPAddressBase.compressedcCs|��S)N)�_reverse_pointer)rVrrr	�reverse_pointer�s	z_IPAddressBase.reverse_pointercCsdt|�f}t|��dS)Nz%200s has no version specified)�type�NotImplementedError)rV�msgrrr	r7�sz_IPAddressBase.versioncCsF|dkrd}t|||jf��||jkrBd}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)rrGr9r8)rVrr]rrr	�_check_int_address�s

z!_IPAddressBase._check_int_addresscCs.t|�}||kr*d}t|||||jf��dS)Nz6%r (len %d != %d) is not permitted as an IPv%d address)r"rrG)rVrZexpected_lenZaddress_lenr]rrr	�_check_packed_address�s
z$_IPAddressBase._check_packed_addresscCs|j|j|?AS)N)r9)�cls�	prefixlenrrr	�_ip_int_from_prefix�sz"_IPAddressBase._ip_int_from_prefixc	Cs\t||j�}|j|}||?}d|>d}||krX|jd}|�|d�}d}t||��|S)Nr%�rz&Netmask pattern %r mixes zeroes & ones)r2r8rr
)	r`�ip_intZtrailing_zeroesraZleading_onesZall_onesZbyteslenZdetailsr]rrr	�_prefix_from_ip_int�s


z"_IPAddressBase._prefix_from_ip_intcCsd|}t|�d�dS)Nz%r is not a valid netmask)r
)r`Znetmask_strr]rrr	�_report_invalid_netmask�sz&_IPAddressBase._report_invalid_netmaskcCshtj�|�s|�|�yt|�}Wntk
r@|�|�YnXd|krX|jksdn|�|�|S)Nr)�_BaseV4�_DECIMAL_DIGITS�
issupersetrf�intr
r8)r`Z
prefixlen_strrarrr	�_prefix_from_prefix_string�s

z)_IPAddressBase._prefix_from_prefix_stringcCs�y|�|�}Wntk
r,|�|�YnXy
|�|�Stk
rLYnX||jN}y
|�|�Stk
r�|�|�YnXdS)N)�_ip_int_from_stringrrfrer
r9)r`�ip_strrdrrr	�_prefix_from_ip_string�s


z%_IPAddressBase._prefix_from_ip_stringcCsHt|ttf�r||jfSt|t�s*t|�}t|�dkr:|S|d|jfS)Nr%r)r4�bytesrjr8�tupler$r")r`rrrr	�_split_addr_prefixs

z!_IPAddressBase._split_addr_prefixcCs|jt|�ffS)N)�	__class__r )rVrrr	�
__reduce__/sz_IPAddressBase.__reduce__N)rrr�	__slots__�propertyrWrXrZr7r^r_�classmethodrbrerfrkrnrqrsrrrr	rT�s	
"rTc@s`eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS)r5rcCs|jS)N)r()rVrrr	�__int__>sz_BaseAddress.__int__cCs2y|j|jko|j|jkStk
r,tSXdS)N)r(rGrIrQ)rV�otherrrr	�__eq__As
z_BaseAddress.__eq__cCsFt|t�stS|j|jkr*td||f��|j|jkrB|j|jkSdS)Nz%%s and %s are not of the same versionF)r4r5rQrGr6r()rVrxrrr	�__lt__Hs
z_BaseAddress.__lt__cCs t|t�stS|�t|�|�S)N)r4rjrQrr)rVrxrrr	�__add__Ts
z_BaseAddress.__add__cCs t|t�stS|�t|�|�S)N)r4rjrQrr)rVrxrrr	�__sub__Ys
z_BaseAddress.__sub__cCsd|jjt|�fS)Nz%s(%r))rrrr )rVrrr	�__repr__^sz_BaseAddress.__repr__cCst|�|j��S)N)r �_string_from_ip_intr()rVrrr	�__str__asz_BaseAddress.__str__cCsttt|j���S)N)�hash�hexrjr()rVrrr	�__hash__dsz_BaseAddress.__hash__cCs
|j|fS)N)rG)rVrrr	rPgsz_BaseAddress._get_address_keycCs|j|jffS)N)rrr()rVrrr	rsjsz_BaseAddress.__reduce__N)rrrrtrwryrzr{r|r}rr�rPrsrrrr	r53s	r5c@s`eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
edd��Zedd��Zedd��Zedd��Zedd ��Zed!d"��Zed#d$��Zed%d&��Zd'd(�Zd)d*�Zd+d,�ZdGd/d0�ZdHd1d2�Zed3d4��Zed5d6��Zd7d8�Zd9d:�Z ed;d<��Z!ed=d>��Z"ed?d@��Z#edAdB��Z$edCdD��Z%edEdF��Z&d.S)IrNcCs
i|_dS)N)�_cache)rVrrrr	�__init__wsz_BaseNetwork.__init__cCsd|jjt|�fS)Nz%s(%r))rrrr )rVrrr	r}zsz_BaseNetwork.__repr__cCsd|j|jfS)Nz%s/%d)rJra)rVrrr	r}sz_BaseNetwork.__str__ccs<t|j�}t|j�}x"t|d|�D]}|�|�Vq$WdS)Nr%)rjrJrC�range�_address_class)rV�network�	broadcast�xrrr	�hosts�s

z_BaseNetwork.hostsccs<t|j�}t|j�}x"t||d�D]}|�|�Vq$WdS)Nr%)rjrJrCr�r�)rVr�r�r�rrr	�__iter__�s

z_BaseNetwork.__iter__cCslt|j�}t|j�}|dkr>|||kr0td��|�||�S|d7}|||krZtd��|�||�SdS)Nrzaddress out of ranger%)rjrJrC�
IndexErrorr�)rV�nr�r�rrr	�__getitem__�s

z_BaseNetwork.__getitem__cCs^t|t�stS|j|jkr*td||f��|j|jkrB|j|jkS|j|jkrZ|j|jkSdS)Nz%%s and %s are not of the same versionF)r4rNrQrGr6rJ�netmask)rVrxrrr	rz�s
z_BaseNetwork.__lt__cCsFy,|j|jko,|j|jko,t|j�t|j�kStk
r@tSXdS)N)rGrJrjr�rIrQ)rVrxrrr	ry�sz_BaseNetwork.__eq__cCstt|j�t|j�A�S)N)r�rjrJr�)rVrrr	r��sz_BaseNetwork.__hash__cCsL|j|jkrdSt|t�rdSt|j�t|j�koBt|j�kSSdS)NF)rGr4rNrjrJr(rC)rVrxrrr	�__contains__�s
z_BaseNetwork.__contains__cCs(|j|kp&|j|kp&|j|kp&|j|kS)N)rJrC)rVrxrrr	�overlaps�s


z_BaseNetwork.overlapscCs<|j�d�}|dkr8|�t|j�t|j�B�}||jd<|S)NrC)r�r?r�rjrJ�hostmask)rVr�rrr	rC�s
z_BaseNetwork.broadcast_addresscCs8|j�d�}|dkr4|�t|j�|jA�}||jd<|S)Nr�)r�r?r�rjr�r9)rVr�rrr	r��s

z_BaseNetwork.hostmaskcCsd|j|jfS)Nz%s/%d)rJrH)rVrrr	�with_prefixlen�sz_BaseNetwork.with_prefixlencCsd|j|jfS)Nz%s/%s)rJr�)rVrrr	�with_netmask�sz_BaseNetwork.with_netmaskcCsd|j|jfS)Nz%s/%s)rJr�)rVrrr	�
with_hostmask�sz_BaseNetwork.with_hostmaskcCst|j�t|j�dS)Nr%)rjrCrJ)rVrrr	�
num_addresses�sz_BaseNetwork.num_addressescCsdt|�f}t|��dS)Nz%%200s has no associated address class)r[r\)rVr]rrr	r��sz_BaseNetwork._address_classcCs|jS)N)rH)rVrrr	ra�sz_BaseNetwork.prefixlenccs|j|jkstd||f��t|t�s2td|��|�|�sLtd||f��||krXdS|�d|j|jf�}|�	�\}}xb||kr�||kr�|�|�r�|V|�	�\}}q||�|�r�|V|�	�\}}q|t
d|||f��q|W||kr�|Vn"||kr�|Vnt
d|||f��dS)Nz%%s and %s are not of the same versionz%s is not a network objectz%s not contained in %sz%s/%sz3Error performing exclusion: s1: %s s2: %s other: %s)rGr6r4rN�	subnet_ofr
rrrJrarD�AssertionError)rVrx�s1�s2rrr	�address_exclude�s6$




z_BaseNetwork.address_excludecCs`|j|jkrtd||f��|j|jkr,dS|j|jkr<dS|j|jkrLdS|j|jkr\dSdS)Nz"%s and %s are not of the same typerFr%r)rGr6rJr�)rVrxrrr	�compare_networksCs!z_BaseNetwork.compare_networkscCs|j|j|jfS)N)rGrJr�)rVrrr	rOssz_BaseNetwork._get_networks_keyr%Nc	cs�|j|jkr|VdS|dk	rJ||jkr0td��|dkr@td��||j}|dkrZtd��|j|}||jkr~td||f��t|j�}t|j�d}t|j�d|?}x(t|||�D]}|�||f�}|Vq�WdS)Nznew prefix must be longerr%z(cannot set prefixlen_diff and new_prefixrzprefix length diff must be > 0z0prefix length diff %d is invalid for netblock %s)	rHr8r
rjrJrCr�r�rr)	rV�prefixlen_diff�
new_prefix�
new_prefixlen�start�end�stepZnew_addrZcurrentrrr	rD}s,




z_BaseNetwork.subnetscCs�|jdkr|S|dk	rB||jkr(td��|dkr8td��|j|}|j|}|dkrftd|j|f��|�t|j�t|j�|>@|f�S)Nrznew prefix must be shorterr%z(cannot set prefixlen_diff and new_prefixz;current prefixlen is %d, cannot have a prefixlen_diff of %d)rHr
rarrrjrJr�)rVr�r�r�rrr	r>�s 



z_BaseNetwork.supernetcCs|jjo|jjS)N)rJ�is_multicastrC)rVrrr	r��s	z_BaseNetwork.is_multicastcCsfy8|j|jkr"t|�d|�d���|j|jko8|j|jkStk
r`td|�d|����YnXdS)Nz and z are not of the same versionz*Unable to test subnet containment between )rGr6rJrCrI)�a�brrr	�
_is_subnet_of�sz_BaseNetwork._is_subnet_ofcCs|�||�S)N)r�)rVrxrrr	r��sz_BaseNetwork.subnet_ofcCs|�||�S)N)r�)rVrxrrr	�supernet_of�sz_BaseNetwork.supernet_ofcCs|jjo|jjS)N)rJ�is_reservedrC)rVrrr	r��s	z_BaseNetwork.is_reservedcCs|jjo|jjS)N)rJ�
is_link_localrC)rVrrr	r�sz_BaseNetwork.is_link_localcCs|jjo|jjS)N)rJ�
is_privaterC)rVrrr	r�s	z_BaseNetwork.is_privatecCs|jS)N)r�)rVrrr	�	is_globals	z_BaseNetwork.is_globalcCs|jjo|jjS)N)rJ�is_unspecifiedrC)rVrrr	r�)s	z_BaseNetwork.is_unspecifiedcCs|jjo|jjS)N)rJ�is_loopbackrC)rVrrr	r�5s	z_BaseNetwork.is_loopback)r%N)r%N)'rrrr�r}rr�r�r�rzryr�r�r�rurCr�r�r�r�r�r�rar�r�rOrDr>r��staticmethodr�r�r�r�r�r�r�r�r�rrrr	rNnsD	

	K0

5
)rNc
@s�eZdZdZdZdedZed�Zedddd	d
ddd
dh	�Z	eZ
iZdd�Ze
dd��Ze
dd��Ze
dd��Ze
dd��Zdd�Zdd�Zdd�Zedd ��Zed!d"��Zd#S)$rgrrrr%�
0123456789���������rrcCst|�S)N)r )rVrrr	rUYsz$_BaseV4._explode_shorthand_ip_stringcCs�||jkr�t|t�r<|}d|kr.|jksjn|�|�n.y|�|�}Wntk
rh|�|�}YnXt|�	|��}||f|j|<|j|S)Nr)
�_netmask_cacher4rjr8rfrkr
rnrrb)r`�argrar�rrr	�
_make_netmask\s	

z_BaseV4._make_netmaskc
Cs||std��|�d�}t|�dkr.td|��yt�t|j|�d�Stk
rv}ztd||f�d�Wdd}~XYnXdS)NzAddress cannot be empty�.rzExpected 4 octets in %rrz%s in %r)rr!r"rj�
from_bytes�map�_parse_octetr
)r`rmZoctets�excrrr	rlvs
z_BaseV4._ip_int_from_stringcCs�|std��|j�|�s(d}t||��t|�dkrDd}t||��t|d�}|dkrr|ddkrrd	}t||��|d
kr�td|��|S)NzEmpty octet not permittedz#Only decimal digits permitted in %r�z$At most 3 characters permitted in %r�
�r�0z3Ambiguous (octal/decimal) value in %r not permittedr�zOctet %d (> 255) not permitted)r
rhrir"rj)r`Z	octet_strr]Z	octet_intrrr	r��s
z_BaseV4._parse_octetcCsd�tt|�dd���S)Nr�rr)�joinr�r r)r`rdrrr	r~�sz_BaseV4._string_from_ip_intcCs�|�d�}t|�dkr�y$x|D]}t|�|jkrdSqWWntk
rNdSXx0t|�D]$\}}|dkrZ|||dkrZdSqZWdSyt|�}Wntk
r�dSXd|ko�|jkSS)Nr�rFrr%T)r!r"rj�_valid_mask_octetsr
�	enumerater8)rVr��maskr��idx�yrrr	�_is_valid_netmask�s"

z_BaseV4._is_valid_netmaskcsh|�d�}y�fdd�tt|�D�}Wntk
r:dSXt|�t|�krPdS|d|dkrddSdS)Nr�csg|]}|�jkr|�qSr)r�)�.0r�)rVrr	�
<listcomp>�sz(_BaseV4._is_hostmask.<locals>.<listcomp>FrrFT)r!r�rjr
r")rVrmr1�partsr)rVr	�_is_hostmask�s

z_BaseV4._is_hostmaskcCs&t|��d�ddd�}d�|�dS)Nr�rFz
.in-addr.arpa)r r!r�)rVZreverse_octetsrrr	rY�sz_BaseV4._reverse_pointercCs|jS)N)r8)rVrrr	�
max_prefixlen�sz_BaseV4.max_prefixlencCs|jS)N)rG)rVrrr	r7sz_BaseV4.versionN)rrrrtrG�
IPV4LENGTHr9�	frozensetrhr�r8r�rUrvr�rlr�r~r�r�rYrur�r7rrrr	rgBs"	%
	rgc@s�eZdZdZdd�Zedd��Zedd��Zee�	�dd	���Z
ee�	�d
d���Zedd
��Zedd��Z
edd��Zedd��ZdS)r)r(�__weakref__cCsrt|t�r|�|�||_dSt|t�rF|�|d�t�|d�|_dSt|�}d|krbtd|��|�	|�|_dS)NrrrzUnexpected '/' in %r)
r4rjr^r(ror_r�r rrl)rVr�addr_strrrr	r�s


zIPv4Address.__init__cCs
t|j�S)N)rr()rVrrr	�packed1szIPv4Address.packedcCs||jjkS)N)�
_constants�_reserved_network)rVrrr	r�6s	zIPv4Address.is_reservedcst�fdd��jjD��S)Nc3s|]}�|kVqdS)Nr)r�r:)rVrr	�	<genexpr>Ksz)IPv4Address.is_private.<locals>.<genexpr>)�anyr��_private_networks)rVr)rVr	r�As
zIPv4Address.is_privatecCs||jjko|jS)N)r��_public_networkr�)rVrrr	r�MszIPv4Address.is_globalcCs||jjkS)N)r��_multicast_network)rVrrr	r�Rs	zIPv4Address.is_multicastcCs||jjkS)N)r��_unspecified_address)rVrrr	r�]s	zIPv4Address.is_unspecifiedcCs||jjkS)N)r��_loopback_network)rVrrr	r�hszIPv4Address.is_loopbackcCs||jjkS)N)r��_linklocal_network)rVrrr	r�rszIPv4Address.is_link_localN)rrrrtr�rur�r��	functools�	lru_cacher�r�r�r�r�r�rrrr	rs#
rc@sjeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zej	Z	e
dd��Ze
d
d��Ze
dd��Z
e
dd��ZdS)rcCsN|�|�\}}t�||�t||fdd�|_|jj|_|jj|_|jj|_dS)NF)r)rqrr�rr�r�r�rH)rVrr#r�rrr	r�s

zIPv4Interface.__init__cCsd|�|j�|jjfS)Nz%s/%d)r~r(r�ra)rVrrr	r�szIPv4Interface.__str__cCsBt�||�}|r|tkr|Sy|j|jkStk
r<dSXdS)NF)rryrQr�rI)rVrx�
address_equalrrr	ry�szIPv4Interface.__eq__cCsNt�||�}|tkrtSy|j|jkp4|j|jko4|Stk
rHdSXdS)NF)rrzrQr�rI)rVrx�address_lessrrr	rz�szIPv4Interface.__lt__cCst|j|jt|jj�f�S)N)r�r(rHrjr�rJ)rVrrr	r��szIPv4Interface.__hash__cCs
t|j�S)N)rr()rVrrr	r-�szIPv4Interface.ipcCsd|�|j�|jfS)Nz%s/%s)r~r(rH)rVrrr	r��szIPv4Interface.with_prefixlencCsd|�|j�|jfS)Nz%s/%s)r~r(r�)rVrrr	r��szIPv4Interface.with_netmaskcCsd|�|j�|jfS)Nz%s/%s)r~r(r�)rVrrr	r��szIPv4Interface.with_hostmaskN)rrrr�rryrzr�rTrsrur-r�r�r�rrrr	r}s	rc@s.eZdZeZddd�Zee��dd���Z	dS)rTcCs�t�||�|�|�\}}t|�|_|�|�\|_|_t|j�}|t|j�@|krx|rdt	d|��nt|t|j�@�|_|j|j
dkr�|j|_dS)Nz%s has host bits setr%)
rNr�rqrrJr�r�rHrjr
r8r�r�)rVrrr#r�r�rrr	r��s$

zIPv4Network.__init__cCs&|jtd�ko|jtd�ko$|jS)Nz
100.64.0.0/10)rJrrCr�)rVrrr	r�s
zIPv4Network.is_globalN)T)
rrrrr�r�rur�r�r�rrrr	r�s

4rc@s�eZdZed�Zed�Zed�Zed�Zed�ed�ed�ed�ed�ed�ed	�ed
�ed�ed�ed
�ed�ed�ed�gZed�Z	e
d�ZdS)�_IPv4Constantsz169.254.0.0/16z127.0.0.0/8z224.0.0.0/4z
100.64.0.0/10z	0.0.0.0/8z
10.0.0.0/8z
172.16.0.0/12z192.0.0.0/29z192.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/32z0.0.0.0N)rrrrr�r�r�r�r�r�rr�rrrr	r�s(
r�c@s�eZdZdZdZdedZdZed�Z	eZ
iZedd��Z
ed	d
��Zedd��Zed
d��Zeddd��Zdd�Zdd�Zedd��Zedd��ZdS)�_BaseV6rr3rr%rcZ0123456789ABCDEFabcdefcCsl||jkrbt|t�r<|}d|kr.|jksFn|�|�n
|�|�}t|�|��}||f|j|<|j|S)Nr)r�r4rjr8rfrkrrb)r`r�rar�rrr	r�Es	


z_BaseV6._make_netmaskc
Cs�|std��|�d�}d}t|�|kr:d||f}t|��d|dkr�yt|���j}Wn4tk
r�}ztd||f�d�Wdd}~XYnX|�d|d	?d
@�|�d|d
@�|jd}t|�|kr�d|d|f}t|��d}x@tdt|�d�D]*}	||	s�|dk	�r"d
|}t|��|	}q�W|dk	�r�|}
t|�|d}|d�sp|
d8}
|
�rpd}t||��|d�s�|d8}|�r�d}t||��|j|
|}|dk�r6d}t||jd|f��njt|�|jk�r�d}t||j|f��|d�sd}t||��|d�s&d}t||��t|�}
d}d}ytd}
x,t|
�D] }	|
d	K}
|
|�	||	�O}
�qFW|
d	|K}
x0t|d�D] }	|
d	K}
|
|�	||	�O}
�q�W|
St
k
�r�}ztd||f�d�Wdd}~XYnXdS)NzAddress cannot be empty�:r�z At least %d parts expected in %rr�rFz%s in %rz%xri��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"rr=r(r@�
_HEXTET_COUNTr��
_parse_hextetr
)r`rmr�Z
_min_partsr]Zipv4_intr�Z
_max_partsZ
skip_index�iZparts_hiZparts_loZ
parts_skippedrdrrr	rlYs�
$







z_BaseV6._ip_int_from_stringcCs>|j�|�std|��t|�dkr4d}t||��t|d�S)NzOnly hex digits permitted in %rrz$At most 4 characters permitted in %rr)�_HEX_DIGITSrir
r"rj)r`Z
hextet_strr]rrr	r��sz_BaseV6._parse_hextetc	Cs�d}d}d}d}xJt|�D]>\}}|dkrP|d7}|dkr>|}||krX|}|}qd}d}qW|dkr�||}|t|�kr�|dg7}dg|||�<|dkr�dg|}|S)NrFrr�r%�)r�r")	r`�hextetsZbest_doublecolon_startZbest_doublecolon_lenZdoublecolon_startZdoublecolon_len�indexZhextetZbest_doublecolon_endrrr	�_compress_hextets�s.

z_BaseV6._compress_hextetsNcsZ|dkrt|j�}||jkr$td��d|��fdd�tddd�D�}|�|�}d�|�S)	NzIPv6 address is too largez%032xcs&g|]}dt�||d�d��qS)z%xrr)rj)r�r�)�hex_strrr	r� sz/_BaseV6._string_from_ip_int.<locals>.<listcomp>rrrr�)rjr(r9r
r�r�r�)r`rdr�r)r�r	r~s


z_BaseV6._string_from_ip_intcs�t|t�rt|j�}nt|t�r,t|j�}nt|�}|�|�}d|��fdd�tddd�D�}t|ttf�r�dd�	|�|j
fSd�	|�S)	Nz%032xcsg|]}�||d��qS)rr)r�r�)r�rr	r�8sz8_BaseV6._explode_shorthand_ip_string.<locals>.<listcomp>rrrz%s/%dr�)r4rr rJrr-rlr�rNr�rH)rVrmrdr�r)r�r	rU%s



z$_BaseV6._explode_shorthand_ip_stringcCs&|jddd��dd�}d�|�dS)NrFr�r�r�z	.ip6.arpa)rW�replacer�)rVZ
reverse_charsrrr	rY=sz_BaseV6._reverse_pointercCs|jS)N)r8)rVrrr	r�Fsz_BaseV6.max_prefixlencCs|jS)N)rG)rVrrr	r7Jsz_BaseV6.version)N)rrrrtrG�
IPV6LENGTHr9r�r�r�r8r�rvr�rlr�r�r~rUrYrur�r7rrrr	r�1s"	h0	r�c@s�eZdZdZdd�Zedd��Zedd��Zedd	��Zed
d��Z	edd
��Z
ee��dd���Z
edd��Zedd��Zedd��Zedd��Zedd��Zedd��ZdS)r)r(r�cCsrt|t�r|�|�||_dSt|t�rF|�|d�t�|d�|_dSt|�}d|krbtd|��|�	|�|_dS)NrrrzUnexpected '/' in %r)
r4rjr^r(ror_r�r rrl)rVrr�rrr	r�Us


zIPv6Address.__init__cCs
t|j�S)N)rr()rVrrr	r�yszIPv6Address.packedcCs||jjkS)N)r�r�)rVrrr	r�~s	zIPv6Address.is_multicastcst�fdd��jjD��S)Nc3s|]}�|kVqdS)Nr)r�r�)rVrr	r��sz*IPv6Address.is_reserved.<locals>.<genexpr>)r�r��_reserved_networks)rVr)rVr	r��s	zIPv6Address.is_reservedcCs||jjkS)N)r�r�)rVrrr	r��szIPv6Address.is_link_localcCs||jjkS)N)r��_sitelocal_network)rVrrr	�
is_site_local�szIPv6Address.is_site_localcst�fdd��jjD��S)Nc3s|]}�|kVqdS)Nr)r�r:)rVrr	r��sz)IPv6Address.is_private.<locals>.<genexpr>)r�r�r�)rVr)rVr	r��s
zIPv6Address.is_privatecCs|jS)N)r�)rVrrr	r��s	zIPv6Address.is_globalcCs
|jdkS)Nr)r()rVrrr	r��s	zIPv6Address.is_unspecifiedcCs
|jdkS)Nr%)r()rVrrr	r��s	zIPv6Address.is_loopbackcCs |jd?dkrdSt|jd@�S)Nri��l��)r(r)rVrrr	�ipv4_mapped�s	zIPv6Address.ipv4_mappedcCs4|jd?dkrdSt|jd?d@�t|jd@�fS)N�`i �@l��)r(r)rVrrr	�teredo�s
zIPv6Address.teredocCs$|jd?dkrdSt|jd?d@�S)N�pi �Pl��)r(r)rVrrr	�	sixtofour�s	zIPv6Address.sixtofourN)rrrrtr�rur�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr	rOs$

rc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zej	Z	e
dd��Ze
d
d��Ze
dd��Z
e
dd��Ze
dd��Ze
dd��ZdS)rcCsN|�|�\}}t�||�t||fdd�|_|jj|_|jj|_|jj|_dS)NF)r)rqrr�rr�r�r�rH)rVrr#r�rrr	r�s

zIPv6Interface.__init__cCsd|�|j�|jjfS)Nz%s/%d)r~r(r�ra)rVrrr	rszIPv6Interface.__str__cCsBt�||�}|r|tkr|Sy|j|jkStk
r<dSXdS)NF)rryrQr�rI)rVrxr�rrr	ryszIPv6Interface.__eq__cCsNt�||�}|tkrtSy|j|jkp4|j|jko4|Stk
rHdSXdS)NF)rrzrQr�rI)rVrxr�rrr	rzszIPv6Interface.__lt__cCst|j|jt|jj�f�S)N)r�r(rHrjr�rJ)rVrrr	r�*szIPv6Interface.__hash__cCs
t|j�S)N)rr()rVrrr	r-/szIPv6Interface.ipcCsd|�|j�|jfS)Nz%s/%s)r~r(rH)rVrrr	r�3szIPv6Interface.with_prefixlencCsd|�|j�|jfS)Nz%s/%s)r~r(r�)rVrrr	r�8szIPv6Interface.with_netmaskcCsd|�|j�|jfS)Nz%s/%s)r~r(r�)rVrrr	r�=szIPv6Interface.with_hostmaskcCs|jdko|jjS)Nr)r(r�r�)rVrrr	r�BszIPv6Interface.is_unspecifiedcCs|jdko|jjS)Nr%)r(r�r�)rVrrr	r�FszIPv6Interface.is_loopbackN)rrrr�rryrzr�rTrsrur-r�r�r�r�r�rrrr	rs	rc@s.eZdZeZd	dd�Zdd�Zedd��ZdS)
rTcCs�t�||�|�|�\}}t|�|_|�|�\|_|_t|j�}|t|j�@|krx|rdt	d|��nt|t|j�@�|_|j|j
dkr�|j|_dS)Nz%s has host bits setr%)
rNr�rqrrJr�r�rHrjr
r8r�r�)rVrrr#r�r�rrr	r�[s

zIPv6Network.__init__ccs@t|j�}t|j�}x&t|d|d�D]}|�|�Vq(WdS)Nr%)rjrJrCr�r�)rVr�r�r�rrr	r��s

zIPv6Network.hostscCs|jjo|jjS)N)rJr�rC)rVrrr	r��szIPv6Network.is_site_localN)T)	rrrrr�r�r�rur�rrrr	rKs
/rc@s�eZdZed�Zed�Zed�ed�ed�ed�ed�ed�ed	�ed
�ed�ed�g
Zed�ed
�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�gZed�ZdS)�_IPv6Constantsz	fe80::/10zff00::/8z::1/128z::/128z
::ffff:0:0/96z100::/64z	2001::/23z2001:2::/48z
2001:db8::/32z2001:10::/28zfc00::/7z::/8z100::/8z200::/7z400::/6z800::/5z1000::/4z4000::/3z6000::/3z8000::/3zA000::/3zC000::/3zE000::/4zF000::/5zF800::/6zFE00::/9z	fec0::/10N)	rrrrr�r�r�r�r�rrrr	r��s*

r�)T)"�__version__r�r�r�r
rr
rrrrrr$r.r2r;rErMrSrT�total_orderingr5rNrgrrrr�r�r�rrrr�rrrr	�<module>sT
#7163:VGu@R 5H[!

Hacked By AnonymousFox1.0, Coded By AnonymousFox