/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/eui48.pyc (9197B)
Ñò }DVc@s!dZddkZddkZyddklZWnej o dZnXddkl Z ddk l Z ddk l ZlZlZlZlZlZlZlZlZdZeZ dZ!dZ"d ed Z#d e$fd „ƒYZ%d e%fd„ƒYZ&de&fd„ƒYZ'de%fd„ƒYZ(de%fd„ƒYZ)de%fd„ƒYZ*e%Z+ddi,dgdƒdddi,dgdƒdddi,dgdƒdddi,dgdƒdddi,dgdƒdddi,d gd ƒdddi,d gd ƒdd!d"i,d#gd$ƒd%d!d"i,d#gd&ƒd%f Z-gZ.e-D]Z/e.ei0e/ei1ƒqb[.Z-d'„Z2d(„Z3dd)„Z5d*„Z6d+„Z7dd,„Z dd-„Zdd.„Zdd/„Zdd0„Zdd1„Zdd2„Zd3„Zd4„ZdS(5s› IEEE 48-bit EUI (MAC address) logic. Supports numerous MAC string formats including Cisco's triple hextet as well as bare MACs containing no delimiters. iÿÿÿÿN(tAF_LINKi0(tAddrFormatError(t_is_str( t valid_wordst int_to_wordst words_to_intt valid_bitst bits_to_intt int_to_bitst valid_bint int_to_bint bin_to_inttMACiit mac_eui48cBs>eZdZdZeeZdedZdZdZdZ RS(s%A standard IEEE EUI-48 dialect class.iiit-s%.2Xi( t__name__t __module__t__doc__t word_sizetwidtht num_wordstmax_wordtword_septword_fmtt word_base(((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyR 1s tmac_unixcBs0eZdZdZeeZdZdZdZRS(s'A UNIX-style MAC address dialect class.it:s%xi( RRRRRRRRR(((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyRFs  tmac_unix_expandedcBseZdZdZRS(s;A UNIX-style MAC address dialect class with leading zeroes.s%.2x(RRRR(((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyROst mac_ciscocBs0eZdZdZeeZdZdZdZRS(s2A Cisco 'triple hextet' MAC address dialect class.it.s%.4x( RRRRRRRRR(((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyRTs  tmac_barecBs0eZdZdZeeZdZdZdZRS(s1A bare (no delimiters) MAC address dialect class.i0ts%.12Xi( RRRRRRRRR(((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyR]s  t mac_pgsqlcBs0eZdZdZeeZdZdZdZRS(s@A PostgreSQL style (2 x 24-bit words) MAC address dialect class.iRs%.6xi( RRRRRRRRR(((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyR fs  t^Rs([0-9A-F]{1,2})it$Rs([0-9A-F]{1,4})is\.s([0-9A-F]{5,6})s^(Rs[0-9A-F]i s)$i cCsVxOtD]G}y+|i|ƒ}t|ƒdjotSWqtj oqXqWtS(s :param addr: An IEEE EUI-48 (MAC) address in string form. :return: ``True`` if MAC address string is valid, ``False`` otherwise. i(tRE_MAC_FORMATStfindalltlentTruet TypeErrortFalse(taddrtregexpt match_result((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyt valid_strŠs  c Cs g}t|ƒo’t}xjtD]b}|i|ƒ}t|ƒdjo:t}t|dtƒo|d}n|df}Pq q W|ptd|ƒ‚qµnt d|ƒ‚d}t|ƒdjoDt di g}|D]}|dt |dƒqâ~ƒdƒ}nöt|ƒdjoDt di g}|D]}|d t |dƒq9~ƒdƒ}nŸt|ƒd joDt di g} |D]}| d t |dƒq~ ƒdƒ}nHt|ƒd jo$t d t |ddƒdƒ}ntd|ƒ‚|S(sç :param addr: An IEEE EUI-48 (MAC) address in string form. :return: An unsigned integer that is equivalent to value represented by EUI-48/MAC string address formatted according to the dialect settings. is!%r is not a supported MAC format!s%r is not str() or unicode()!iRs%.2xiis%.4xis%.6xis%012xs(unexpected word count in MAC address %r!N( RR(R#R$R%R&t isinstancettupleRR'tNonetinttjoin( R)twordst found_matchR*R+tint_valt_[1]twt_[2]t_[3]((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyt str_to_int›s4   DDD$cCsd|djo t}nt||ƒ}g}|D]}||i|q1~}|ii|ƒ}|S(s :param int_val: An unsigned integer. :param dialect: (optional) a Python class defining formatting options. :return: An IEEE EUI-48 (MAC) address string that is equivalent to unsigned integer formatted according to the dialect settings. N(R/R RRRR1(R4tdialectR2R5tittokensR)((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyt int_to_strÈs  (cCstid|d?|d@ƒ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>HIi Iÿÿÿÿ(t_structtpack(R4((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyt int_to_packedÛscCscttid|ƒƒ}d}x>tt|ƒƒD]*\}}|}|d|>}||B}q1W|S(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>6Bii(tlistR>tunpackt enumeratetreversed(t packed_intR2R4R;tnumtword((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyt packed_to_intås cCs-|djo t}nt||i|iƒS(N(R/tDEFAULT_DIALECTt _valid_wordsRR(R2R:((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyRøs  cCs-|djo t}nt||i|iƒS(N(R/RIt _int_to_wordsRR(R4R:((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyRþs  cCs-|djo t}nt||i|iƒS(N(R/RIt _words_to_intRR(R2R:((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyRs  cCs*|djo t}nt|t|iƒS(N(R/RIt _valid_bitsRR(tbitsR:((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyR s  cCs*|djo t}nt|t|iƒS(N(R/RIt _bits_to_intRR(RNR:((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyRs  cCs3|djo t}nt||i|i|iƒS(N(R/RIt _int_to_bitsRRR(R4R:((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyRs  cCs$|djo t}nt|tƒS(N(R/RIt _valid_binR(tbin_valR:((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyR s  cCs t|tƒS(N(t _int_to_binR(R4((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyR #scCs t|tƒS(N(t _bin_to_intR(RR((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyR 's(8RtstructR>tret_retsocketRt ImportErrort netaddr.coreRtnetaddr.compatRtnetaddr.strategyRRJRRKRRLRRMRRORRPR RQR RSR RTRtfamilyt family_nametversiontmax_inttobjectR RRRRR RIR1R#R5t_tcompilet IGNORECASER,R9R/R=R@RH(((s7/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/eui48.pyt sZ   @    !0  -