/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/ipv4.pyc (8659B)
Ñò }DVc@sädZddkZddkZddklZeid$joddk l Z l Z nddkl Z l Z ddk lZlZlZddklZlZlZlZlZlZlZdd k l!Z!d Z"d Z#d Z$d Z%e Z&dZ'dZ(dZ)de"dZ*e"e#Z+de#dZ,e-gZ.e/de"dƒD]#Z0e.e0e*de"e0dAfq?[.ƒZ1e-gZ2e/de"dƒD]#Z0e2e*de"e0dAe0fq‰[2ƒZ3e-gZ4e/de"dƒD]Z0e4e0de"e0dfqÓ[4ƒZ5e-gZ6e/de"dƒD]Z0e6de"e0de0fq[6ƒZ7dd„Z8dd„Z9dd„Z;d„Z<d„Z=d„Z>d„Zd„Z?d„Z@d„Zd„Zdd„Zd „Zd!„Zd"„Zd#„ZAdS(%sIPv4 address logic.iÿÿÿÿN(t inet_atontwin32tcygwin(t inet_ptontAF_INET(tAddrFormatErrortZEROFILLt INET_PTON(t valid_wordst valid_bitst bits_to_intt int_to_bitst valid_bint int_to_bint bin_to_int(t _str_typei is%dt.tIPv4ii iiicCs¹|djotdƒ‚nt}|t@oAdig}|idƒD]}|dt|ƒqH~ƒ}ny*|t@ott|ƒn t |ƒWnt j o t }nX|S(sP :param addr: An IPv4 address in presentation (string) format. :param flags: decides which rules are applied to the interpretation of the addr value. Supported constants are INET_PTON and ZEROFILL. See the netaddr.core docs for details. :return: ``True`` if IPv4 address is valid, ``False`` otherwise. ts Empty strings are not supported!Rs%d( RtTrueRtjointsplittintRt _inet_ptonRt _inet_atont ExceptiontFalse(taddrtflagstvalidityt_[1]ti((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv4.pyt valid_strQs  A  c Cs½|t@oAdig}|idƒD]}|dt|ƒq%~ƒ}nyG|t@otidtt|ƒƒdStidt |ƒƒdSWn#t j ot d|ƒ‚nXdS(sP :param addr: An IPv4 dotted decimal address in string form. :param flags: decides which rules are applied to the interpretation of the addr value. Supported constants are INET_PTON and ZEROFILL. See the netaddr.core docs for details. :return: The equivalent unsigned integer for a given IPv4 address. Rs%ds>Iis&%r is not a valid IPv4 address string!N( RRRRRt_structtunpackRRRRR(RRRR((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv4.pyt str_to_intns A cCs_d|jo tjno-d|d?|d?d@|d?d@|d@fStd|ƒ‚dS( sÝ :param int_val: An unsigned integer. :param dialect: (unused) Any value passed in is ignored. :return: The IPv4 presentation (string) format address equivalent to the unsigned integer provided. is %d.%d.%d.%diiiÿis*%r is not a valid 32-bit unsigned integer!N(tmax_intt ValueError(tint_valtdialect((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv4.pyt int_to_str„s    cCsXg}t|ƒD]}|d|q~}|iƒ|idddgƒdi|ƒS(s“ :param int_val: An unsigned integer. :return: The reverse DNS lookup for an IPv4 address in network byte order integer form. s%dsin-addrtarpaRR(t int_to_wordstreversetextendR(R&RRtwords((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv4.pyt int_to_arpa—s+ cCstid|ƒS(s• :param int_val: the integer to be packed. :return: a packed string that is equivalent to value represented by an unsigned integer. s>I(R!tpack(R&((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv4.pyt int_to_packed¤scCstid|ƒdS(s :param packed_int: a packed string containing an unsigned integer. It is assumed that string is packed in network byte order. :return: An unsigned integer equivalent to value of network address represented by packed binary string. s>Ii(R!R"(t packed_int((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv4.pyt packed_to_int®scCst|ttƒS(N(t _valid_wordst word_sizet num_words(R-((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv4.pyR¹scCsZd|jo tjnptd|ƒ‚n|d?|d?d@|d?d@|d@fS(s¥ :param int_val: An unsigned integer. :return: An integer word (octet) sequence that is equivalent to value represented by an unsigned integer. is>%r is not a valid integer value supported bythis address type!iiiÿi(R$R%(R&((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv4.pyR*½s  cCsAt|ƒptd|ƒ‚ntidtid|ŒƒdS(s® :param words: A list or tuple containing integer octets. :return: An unsigned integer that is equivalent to value represented by word (octet) sequence. s1%r is not a valid octet list for an IPv4 address!s>It4Bi(RR%R!R"R/(R-((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv4.pyt words_to_intÍs cCst|ttƒS(N(t _valid_bitstwidthtword_sep(tbits((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv4.pyR ÙscCst|ttƒS(N(t _bits_to_intR9R:(R;((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv4.pyR ÝscCs1|djotƒd}nt|tt|ƒS(NR:(tNonetglobalst _int_to_bitsR4R5(R&R:((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv4.pyR ás cCs t|tƒS(N(t _valid_binR9(tbin_val((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv4.pyR çscCs t|tƒS(N(t _int_to_binR9(R&((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv4.pyR ëscCs t|tƒS(N(t _bin_to_intR9(RA((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv4.pyRïsc Cs4g}td|ƒ}t|tƒoïd|jo |‚ny\d|jo8g}|idƒD]}|dt|ƒqa~}ndt|ƒg}Wntj o |‚nXdt|ƒjo djno2x5tdt|ƒƒD]}|idƒqðWq|‚n|p |‚ndt |ƒS( sÅ Expands a partial IPv4 address into a full 4-octet version. :param addr: an partial or abbreviated IPv4 address :return: an expanded IP address in presentation format (x.x.x.x) s!invalid partial IPv4 address: %r!t:Rs%diit0s %s.%s.%s.%s( Rt isinstanceRRRR%tlentrangetappendttuple(RttokensterrorRtoR((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv4.pytexpand_partial_addressós&    8 $  (swin32scygwin(Bt__doc__tsyst_syststructR!tsocketRRtplatformtnetaddr.fbsocketRRRt netaddr.coreRRRtnetaddr.strategyRR3R R8R R<R R?R R@R RBRRCtnetaddr.compatRR9R4tword_fmtR:tfamilyt family_nametversiont word_baseR$R5tmax_wordtdictRRHRtprefix_to_netmaskt_[2]tnetmask_to_prefixt_[3]tprefix_to_hostmaskt_[4]thostmask_to_prefixR R#R=R(R.R0R2R*R7RN(((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv4.pytsX  4 GGCC