/usr/lib/python2.6/site-packages/netaddr/strategy
NameSizeModeActions
eui48.py86330644editdlrm
eui48.pyc91970644editdlrm
eui64.py77100644editdlrm
eui64.pyc83220644editdlrm
ipv4.py80860644editdlrm
ipv4.pyc86590644editdlrm
ipv6.py76290644editdlrm
ipv6.pyc79030644editdlrm
__init__.py74710644editdlrm
__init__.pyc79450644editdlrm
Edit: /usr/lib/python2.6/site-packages/netaddr/strategy/__init__.pyc (7945B)
Ñò }DVc@s˜dZddkZddklZlZd„ZeƒZd„Zd„Z d„Z dd „Z dd „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|idi|ƒƒ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-build-lt8jXN/netaddr/netaddr/strategy/__init__.pyt bytes_to_bitss  cCsst|dƒptSt|ƒ|jotSd|d}x1|D])}d|jo |jnptSqBWtS(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-build-lt8jXN/netaddr/netaddr/strategy/__init__.pyt valid_words!s  cCs¬d||d}d|jo |jnptdt|ƒƒ‚nd|d}g}x;t|ƒD]-}||@}|it|ƒƒ||L}qkWtt|ƒƒ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-build-lt8jXN/netaddr/netaddr/strategy/__init__.pyt int_to_words;s   cCsrt|||ƒptd|ƒ‚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-build-lt8jXN/netaddr/netaddr/strategy/__init__.pyt words_to_intVs  RcCs¥t|ƒptS|djo|i|dƒ}nt|ƒ|jotSd|d}y0dt|dƒjo |jnotSWntj onXtS(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"(R twidthtword_sepR((s:/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/__init__.pyt valid_bitsms  ' cCsWt|||ƒptd|ƒ‚n|djo|i|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(R R&R'((s:/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/__init__.pyt bits_to_ints  cCsÚg}x’t|||ƒD]~}g}x+|o#|it|d@ƒ|dL}q(W|iƒdi|ƒpd|}d||| }|i|ƒqW|dj o%t|ƒptd|ƒ‚qÍn|i|ƒ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 R tbit_str((s:/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/__init__.pyt int_to_bits£s    cCs©t|ƒptS|idƒptS|iddƒ}t|ƒ|jotSd|d}y0dt|dƒjo |jnotSWntj onXtS(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-build-lt8jXN/netaddr/netaddr/strategy/__init__.pyt valid_binÅs ' cCsÇg}yt|ƒ}Wntj os|}x7|djo)|d@}|it|ƒ|dL}q0W|iƒdtidddi|ƒƒ}nXt|dƒ|jot 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-build-lt8jXN/netaddr/netaddr/strategy/__init__.pyt int_to_binås    'cCs=t||ƒptd|ƒ‚nt|iddƒ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-build-lt8jXN/netaddr/netaddr/strategy/__init__.pyt bin_to_ints (t__doc__treR6tnetaddr.compatRRR R+RR!R$R(R)R/R3R9R:(((s:/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/__init__.pyts        "