PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  w{Zc@sdZddlZddlmZdZeZdZdZdZ dd Z dd Z dd Z d Z d ZdZdS(s) Shared logic for various address types. iN(t_rangecCsg}tddd}xdtdD]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. iiiit01itN(RtrangetNonetappendtjoin(tlookupt bits_per_bytetnumtbitsti((s=/usr/lib/python2.7/site-packages/netaddr/strategy/__init__.pyt bytes_to_bitss  cCslt|dstSt||kr)tSd|d}x.|D]&}d|ko[|kns>tSq>WtS(s4 @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: C{True} if word sequence is valid for this address type, C{False} otherwise. t__iter__iii(thasattrtFalsetlentTrue(twordst word_sizet num_wordstmax_wordR ((s=/usr/lib/python2.7/site-packages/netaddr/strategy/__init__.pyt valid_words!s  cCsd||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=/usr/lib/python2.7/site-packages/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=/usr/lib/python2.7/site-packages/netaddr/strategy/__init__.pyt words_to_intVs RcCst|dstS|dkr4|j|d}nt||krJtSd|d}y-dt|dko{|knrtSWntk rnXtS(sj @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: C{True} if network address is valid, C{False} otherwise. treplaceRiii(RRR$RRRR!(R twidthtword_sepR((s=/usr/lib/python2.7/site-packages/netaddr/strategy/__init__.pyt valid_bitsms  % cCsSt|||s%td|n|dkrF|j|d}nt|dS(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=/usr/lib/python2.7/site-packages/netaddr/strategy/__init__.pyt bits_to_ints  cCsg}xt|||D]{}g}x)|rP|jt|d@|dL}q(W|jdj|pqd|}d||| }|j|qW|dk rt|dstd|qn|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. iiRt0Rs#word separator is not a string: %r!(R Rt BYTES_TO_BITStreverseRRR!(RRRR&t bit_wordsRR tbit_str((s=/usr/lib/python2.7/site-packages/netaddr/strategy/__init__.pyt int_to_bitss   cCst|dstS|jds&tS|jdd}t||krNtSd|d}y-dt|dko|knrtSWntk rnXtS(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: C{True} if network address is valid, C{False} otherwise. t startswitht0bRiii(RRR/R$RRRR!(tbin_valR%R((s=/usr/lib/python2.7/site-packages/netaddr/strategy/__init__.pyt valid_bins % cCsg}yt|}Wn{tk r|}x5|dkrc|d@}|jt||dL}q/W|jdtjdddj|}nXt|d|krt 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'). iiiR0s ^[0]+([01]+)$s\1Ris binary string out of bounds: %s!( tbint NameErrorRR*R+t_retsubRRR(RR%t bin_tokensR1R R((s=/usr/lib/python2.7/site-packages/netaddr/strategy/__init__.pyt int_to_bins    &cCs;t||s"td|nt|jdddS(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(R2R!RR$(R1R%((s=/usr/lib/python2.7/site-packages/netaddr/strategy/__init__.pyt bin_to_ints (t__doc__treR5tnetaddr.compatRR R*RR R#R'R(R.R2R8R9(((s=/usr/lib/python2.7/site-packages/netaddr/strategy/__init__.pyts        "