https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /usr/lib/python2.7/site-packages/netaddr/strategy/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib/python2.7/site-packages/netaddr/strategy/__init__.pyc
�
o�\c@s�dZddlZddlmZmZd�Ze�Zd�Zd�Z	d�Z
dd	�Zdd
�Zdd�Z
d�Zd
�Zd�ZdS(s)
Shared logic for various address types.
i����N(t_ranget_is_strcCs�g}tddd�}xdtd�D]V}ddg}x*|D]"}d|d@||<|dL}q?W|jdj|��q%W|S(	s�
    :return: A 256 element list containing 8-bit binary digit strings. The
        list index value is equivalent to its bit string value.
    ii����iit01itN(RtrangetNonetappendtjoin(tlookupt
bits_per_bytetnumtbitsti((s</tmp/pip-install-zM1pc4/netaddr/netaddr/strategy/__init__.pyt
bytes_to_bitss

cCslt|d�stSt|�|kr)tSd|d}x.|D]&}d|ko[|kns>tSq>WtS(s6
    :param words: A sequence of unsigned integer word values.

    :param word_size: Width (in bits) of each unsigned integer word value.

    :param num_words: Number of unsigned integer words expected.

    :return: ``True`` if word sequence is valid for this address type,
        ``False`` otherwise.
    t__iter__iii(thasattrtFalsetlentTrue(twordst	word_sizet	num_wordstmax_wordR((s</tmp/pip-install-zM1pc4/netaddr/netaddr/strategy/__init__.pytvalid_words!s
cCs�d||d}d|ko)|knsGtdt|���nd|d}g}x;t|�D]-}||@}|jt|��||L}qhWtt|��S(sJ
    :param int_val: Unsigned integer to be divided into words of equal size.

    :param word_size: Width (in bits) of each unsigned integer word value.

    :param num_words: Number of unsigned integer words expected.

    :return: A tuple contain unsigned integer word values split according
        to provided arguments.
    iiisinteger out of bounds: %r!(t
IndexErrorthexRRtintttupletreversed(tint_valRRtmax_intRRt_tword((s</tmp/pip-install-zM1pc4/netaddr/netaddr/strategy/__init__.pytint_to_words;s
cCspt|||�s%td|��nd}x>tt|��D]*\}}|}|||>}||B}q>W|S(s5
    :param words: A sequence of unsigned integer word values.

    :param word_size: Width (in bits) of each unsigned integer word value.

    :param num_words: Number of unsigned integer words expected.

    :return: An unsigned integer that is equivalent to value represented
        by word sequence.
    s"invalid integer word sequence: %r!i(Rt
ValueErrort	enumerateR(RRRRRR
R ((s</tmp/pip-install-zM1pc4/netaddr/netaddr/strategy/__init__.pytwords_to_intVsRcCs�t|�stS|dkr1|j|d�}nt|�|krGtSd|d}y-dt|d�kox|knr�tSWntk
r�nXtS(sl
    :param bits: A network address in a delimited binary string format.

    :param width: Maximum width (in bits) of a network address (excluding
        delimiters).

    :param word_sep: (optional) character or string used to delimit word
        groups (default: '', no separator).

    :return: ``True`` if network address is valid, ``False`` otherwise.
    Riii(RRtreplaceRRRR"(Rtwidthtword_sepR((s</tmp/pip-install-zM1pc4/netaddr/netaddr/strategy/__init__.pyt
valid_bitsms%
cCsSt|||�s%td|��n|dkrF|j|d�}nt|d�S(s�
    :param bits: A network address in a delimited binary string format.

    :param width: Maximum width (in bits) of a network address (excluding
        delimiters).

    :param word_sep: (optional) character or string used to delimit word
        groups (default: '', no separator).

    :return: An unsigned integer that is equivalent to value represented
        by network address in readable binary form.
    s#invalid readable binary string: %r!Ri(R(R"R%R(RR&R'((s</tmp/pip-install-zM1pc4/netaddr/netaddr/strategy/__init__.pytbits_to_int�s

cCs�g}x�t|||�D]{}g}x)|rP|jt|d@�|dL}q(W|j�dj|�pqd|}d|||}|j|�qW|dk	r�t|�s�td|��q�n|j|�S(s�
    :param int_val: An unsigned integer.

    :param word_size: Width (in bits) of each unsigned integer word value.

    :param num_words: Number of unsigned integer words expected.

    :param word_sep: (optional) character or string used to delimit word
        groups (default: '', no separator).

    :return: A network address in a delimited binary string format that is
        equivalent in value to unsigned integer.
    i�iRt0s#word separator is not a string: %r!(R!Rt
BYTES_TO_BITStreverseRRR"(RRRR't	bit_wordsR Rtbit_str((s</tmp/pip-install-zM1pc4/netaddr/netaddr/strategy/__init__.pytint_to_bits�s	
cCs�t|�stS|jd�s#tS|jdd�}t|�|krKtSd|d}y-dt|d�ko||knr�tSWntk
r�nXtS(s
    :param bin_val: A network address in Python's binary representation format
        ('0bxxx').

    :param width: Maximum width (in bits) of a network address (excluding
        delimiters).

    :return: ``True`` if network address is valid, ``False`` otherwise.
    t0bRiii(RRt
startswithR%RRRR"(tbin_valR&R((s</tmp/pip-install-zM1pc4/netaddr/netaddr/strategy/__init__.pyt	valid_bin�s
%
cCs�g}yt|�}Wn{tk
r�|}x5|dkrc|d@}|jt|�|dL}q/W|j�dtjdddj|��}nXt|d�|kr�t	d	|��n|S(
s�
    :param int_val: An unsigned integer.

    :param width: Maximum allowed width (in bits) of a unsigned integer.

    :return: Equivalent string value in Python's binary representation format
        ('0bxxx').
    ii�iR0s
^[0]+([01]+)$s\1Ris binary string out of bounds: %s!(
tbint	NameErrorRR+R,t_retsubRRR(RR&t
bin_tokensR2RR ((s</tmp/pip-install-zM1pc4/netaddr/netaddr/strategy/__init__.pyt
int_to_bin�s	


&cCs;t||�s"td|��nt|jdd�d�S(s9
    :param bin_val: A string containing an unsigned integer in Python's binary
        representation format ('0bxxx').

    :param width: Maximum allowed width (in bits) of a unsigned integer.

    :return: An unsigned integer that is equivalent to value represented
        by Python binary string format.
    s%not a valid Python binary string: %r!R0Ri(R3R"RR%(R2R&((s</tmp/pip-install-zM1pc4/netaddr/netaddr/strategy/__init__.pyt
bin_to_ints
(t__doc__treR6tnetaddr.compatRRR
R+RR!R$R(R)R/R3R9R:(((s</tmp/pip-install-zM1pc4/netaddr/netaddr/strategy/__init__.pyt<module>s					 "	 	

https://t.me/AnonymousX5 - 2025