ž ¬’fŸc@sņdZdZddlZdZdZGdd„deƒZGdd „d eƒZd d „Ze d d „Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd„Zdd„Zd d!„ZGd"d#„d#ƒZGd$d%„d%eƒZGd&d'„d'eƒZGd(d)„d)eƒZGd*d+„d+ƒZGd,d-„d-eeƒZGd.d/„d/eƒZGd0d1„d1eeƒZGd2d3„d3ƒZGd4d5„d5eeƒZGd6d7„d7eƒZGd8d9„d9eeƒZ dS(:u•A fast, lightweight IPv4/IPv6 manipulation library in Python. This library is used to create/poke/manipulate IPv4 and IPv6 addresses and networks. u1.0iNi i€cBs|EeZdZdZdS(uAddressValueErroru%A Value Error related to the address.N(u__name__u __module__u __qualname__u__doc__(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuAddressValueErrorsuAddressValueErrorcBs|EeZdZdZdS(uNetmaskValueErroru%A Value Error related to the netmask.N(u__name__u __module__u __qualname__u__doc__(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuNetmaskValueErrorsuNetmaskValueErrorcCsfyt|ƒSWnttfk r(YnXyt|ƒSWnttfk rQYnXtd|ƒ‚dS(u®Take an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Address or IPv6Address object. Raises: ValueError: if the *address* passed isn't either a v4 or a v6 address u0%r does not appear to be an IPv4 or IPv6 addressN(u IPv4AddressuAddressValueErroruNetmaskValueErroru IPv6Addressu ValueError(uaddress((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu ip_addresssu ip_addresscCslyt||ƒSWnttfk r+YnXyt||ƒSWnttfk rWYnXtd|ƒ‚dS(uŠTake an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP network. Either IPv4 or IPv6 networks may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Network or IPv6Network object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address. Or if the network has host bits set. u0%r does not appear to be an IPv4 or IPv6 networkN(u IPv4NetworkuAddressValueErroruNetmaskValueErroru IPv6Networku ValueError(uaddressustrict((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu ip_network9su ip_networkcCsfyt|ƒSWnttfk r(YnXyt|ƒSWnttfk rQYnXtd|ƒ‚dS(ugTake an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Interface or IPv6Interface object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address. Notes: The IPv?Interface classes describe an Address on a particular Network, so they're basically a combination of both the Address and Network classes. u2%r does not appear to be an IPv4 or IPv6 interfaceN(u IPv4InterfaceuAddressValueErroruNetmaskValueErroru IPv6Interfaceu ValueError(uaddress((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu ip_interfaceWsu ip_interfacec Cs/y|jddƒSWntdƒ‚YnXdS(u`Represent an address as 4 packed bytes in network (big-endian) order. Args: address: An integer representation of an IPv4 IP address. Returns: The integer address packed as 4 bytes in network (big-endian) order. Raises: ValueError: If the integer is negative or too large to be an IPv4 IP address. iubigu&Address negative or too large for IPv4N(uto_bytesu ValueError(uaddress((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuv4_int_to_packedzsuv4_int_to_packedc Cs/y|jddƒSWntdƒ‚YnXdS(uõRepresent an address as 16 packed bytes in network (big-endian) order. Args: address: An integer representation of an IPv6 IP address. Returns: The integer address packed as 16 bytes in network (big-endian) order. iubigu&Address negative or too large for IPv6N(uto_bytesu ValueError(uaddress((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuv6_int_to_packedŽs uv6_int_to_packedcCs>t|ƒjdƒ}t|ƒdkr:td|ƒ‚n|S(uAHelper to split the netmask and raise AddressValueError if neededu/iuOnly one '/' permitted in %r(ustrusplitulenuAddressValueError(uaddressuaddr((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_split_optional_netmaskžsu_split_optional_netmaskcCsS|d}}x8|dd…D]&}|j|jdkrD|}qPqW||fS(u¼Find a sequence of IPv#Address. Args: addresses: a list of IPv#Address objects. Returns: A tuple containing the first and last IP addresses in the sequence. iiN(u_ip(u addressesufirstulastuip((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_find_address_range¦s  u_find_address_rangecCs=|dkr|Sx&t|ƒD]}||?d@r|SqW|S(uåCount the number of zero bits on the right hand side. Args: number: an integer. bits: maximum number of bits to count. Returns: The number of zero bits on the right hand side of the number. ii(urange(unumberubitsui((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_count_righthand_zero_bits¹s u_count_righthand_zero_bitsccs^t|tƒot|tƒs-tdƒ‚n|j|jkrXtd||fƒ‚n||krstdƒ‚n|jdkr‹t}n$|jdkr£t}n tdƒ‚|j}|j}|j}x||krYt t ||ƒ||dj ƒdƒ}|d|||fƒ}|V|d|>7}|d|j krGPn|j |ƒ}qĶWd S( u¤Summarize a network range given the first and last IP addresses. Example: >>> list(summarize_address_range(IPv4Address('192.0.2.0'), ... IPv4Address('192.0.2.130'))) ... #doctest: +NORMALIZE_WHITESPACE [IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/31'), IPv4Network('192.0.2.130/32')] Args: first: the first IPv4Address or IPv6Address in the range. last: the last IPv4Address or IPv6Address in the range. Returns: An iterator of the summarized IPv(4|6) network objects. Raise: TypeError: If the first and last objects are not IP addresses. If the first and last objects are not the same version. ValueError: If the last object is not greater than the first. If the version of the first address is not 4 or 6. u1first and last must be IP addresses, not networksu%%s and %s are not of the same versionu*last IP address must be greater than firstiiuunknown IP versioniu%s/%dN(u isinstanceu _BaseAddressu TypeErroruversionu ValueErroru IPv4Networku IPv6Networku_max_prefixlenu_ipuminu_count_righthand_zero_bitsu bit_lengthu _ALL_ONESu __class__(ufirstulastuipuip_bitsu first_intulast_intunbitsunet((u./opt/alt/python33/lib64/python3.3/ipaddress.pyusummarize_address_rangeĶs2       usummarize_address_rangecCsŲxŃd}g}d}x©|D]”}|s>|}|j|ƒq|j|jkrk|j|jkrkd}q|t|jƒjƒƒdkrŖ|jƒ|d<}d}q|}|j|ƒqW|}|s|SqdS(uvLoops through the addresses, collapsing concurrent netblocks. Example: ip1 = IPv4Network('192.0.2.0/26') ip2 = IPv4Network('192.0.2.64/26') ip3 = IPv4Network('192.0.2.128/26') ip4 = IPv4Network('192.0.2.192/26') _collapse_addresses_recursive([ip1, ip2, ip3, ip4]) -> [IPv4Network('192.0.2.0/24')] This shouldn't be called directly; it is called via collapse_addresses([]). Args: addresses: A list of IPv4Network's or IPv6Network's Returns: A list of IPv4Network's or IPv6Network's depending on what we were passed. iNFTi’’’’( uNoneuFalseuappendunetwork_addressubroadcast_addressuTrueulistusupernetusubnets(u addressesu last_addru ret_arrayu optimizeducur_addr((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_collapse_addresses_recursives&  " u_collapse_addresses_recursivec Csód}g}g}g}x3|D]+}t|tƒr}|rm|dj|jkrmtd||dfƒ‚n|j|ƒq|j|jkr|rČ|dj|jkrČtd||d fƒ‚ny|j|jƒWqJtk r|j|j ƒYqJXq|r=|d j|jkr=td||d fƒ‚n|j|ƒqWt t |ƒƒ}t t |ƒƒ}x[|t |ƒkrĻt ||d…ƒ\}}|j|ƒd}|jt||ƒƒquWttt ||dtjƒƒƒS( uĖCollapse a list of IP objects. Example: collapse_addresses([IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/25')]) -> [IPv4Network('192.0.2.0/24')] Args: addresses: An iterator of IPv4Network or IPv6Network objects. Returns: An iterator of the collapsed IPv(4|6)Network objects. Raises: TypeError: If passed a list of mixed version objects. iiu%%s and %s are not of the same versionNukeyi’’’’i’’’’i’’’’i’’’’i’’’’i’’’’(u isinstanceu _BaseAddressu_versionu TypeErroruappendu _prefixlenu_max_prefixlenuipuAttributeErrorunetwork_addressusortedusetulenu_find_address_rangeuindexuextendusummarize_address_rangeuiteru_collapse_addresses_recursiveu _BaseNetworku_get_networks_key(u addressesuiuaddrsuipsunetsuipufirstulast((u./opt/alt/python33/lib64/python3.3/ipaddress.pyucollapse_addresses5s<   ucollapse_addressescCs6t|tƒr|jƒSt|tƒr2|jƒStS(u2Return a key suitable for sorting between networks and addresses. Address and Network objects are not sortable by default; they're fundamentally different so the expression IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24') doesn't make any sense. There are some times however, where you may wish to have ipaddress sort these for you anyway. If you need to do this, you can use this function as the key= argument to sorted(). Args: obj: either a Network or Address object. Returns: appropriate key. (u isinstanceu _BaseNetworku_get_networks_keyu _BaseAddressu_get_address_keyuNotImplemented(uobj((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuget_mixed_type_keyns   uget_mixed_type_keycBs\|EeZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd S(u_TotalOrderingMixincCs t‚dS(N(uNotImplementedError(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__eq__Œsu_TotalOrderingMixin.__eq__cCs$|j|ƒ}|tkrtS| S(N(u__eq__uNotImplemented(uselfuotheruequal((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__ne__Žs u_TotalOrderingMixin.__ne__cCs t‚dS(N(uNotImplementedError(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__lt__“su_TotalOrderingMixin.__lt__cCs3|j|ƒ}|tks"| r/|j|ƒS|S(N(u__lt__uNotImplementedu__eq__(uselfuotheruless((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__le__•s u_TotalOrderingMixin.__le__cCsI|j|ƒ}|tkrtS|j|ƒ}|tkr>tS|pG| S(N(u__lt__uNotImplementedu__eq__(uselfuotherulessuequal((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__gt__šs  u_TotalOrderingMixin.__gt__cCs$|j|ƒ}|tkrtS| S(N(u__lt__uNotImplemented(uselfuotheruless((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__ge__¢s u_TotalOrderingMixin.__ge__N( u__name__u __module__u __qualname__u__eq__u__ne__u__lt__u__le__u__gt__u__ge__(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_TotalOrderingMixin‡s      u_TotalOrderingMixincBs¤|EeZdZdZedd„ƒZedd„ƒZedd„ƒZdd „Zd d „Z d d „Z dd„Z dd„Z dd„Z dd„ZdS(u_IPAddressBaseuThe mother class.cCs |jƒS(u:Return the longhand version of the IP address as a string.(u_explode_shorthand_ip_string(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuexploded¬su_IPAddressBase.explodedcCs t|ƒS(u;Return the shorthand version of the IP address as a string.(ustr(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu compressed±su_IPAddressBase.compressedcCs#dt|ƒf}t|ƒ‚dS(Nu%200s has no version specified(utypeuNotImplementedError(uselfumsg((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuversion¶su_IPAddressBase.versioncCsi|dkr.d}t|||jfƒ‚n||jkred}t|||j|jfƒ‚ndS(Niu-%d (< 0) is not permitted as an IPv%d addressu2%d (>= 2**%d) is not permitted as an IPv%d address(uAddressValueErroru_versionu _ALL_ONESu_max_prefixlen(uselfuaddressumsg((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_check_int_address»s u!_IPAddressBase._check_int_addresscCsDt|ƒ}||kr@d}t|||||jfƒ‚ndS(Nu6%r (len %d != %d) is not permitted as an IPv%d address(ulenuAddressValueErroru_version(uselfuaddressu expected_lenu address_lenumsg((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_check_packed_addressÄs    u$_IPAddressBase._check_packed_addresscCs|j|j|?AS(u¦Turn the prefix length into a bitwise netmask Args: prefixlen: An integer, the prefix length. Returns: An integer. (u _ALL_ONES(uselfu prefixlen((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_ip_int_from_prefixĖs u"_IPAddressBase._ip_int_from_prefixc Cst||jƒ}|j|}||?}d|>d}||kr{|jd}|j|dƒ}d}t||ƒ‚n|S(uReturn prefix length from the bitwise netmask. Args: ip_int: An integer, the netmask in axpanded bitwise format Returns: An integer, the prefix length. Raises: ValueError: If the input intermingles zeroes & ones iiubigu&Netmask pattern %r mixes zeroes & ones(u_count_righthand_zero_bitsu_max_prefixlenuto_bytesu ValueError( uselfuip_intutrailing_zeroesu prefixlenu leading_onesuall_onesubyteslenudetailsumsg((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_prefix_from_ip_int×s      u"_IPAddressBase._prefix_from_ip_intcCsd|}t|ƒd‚dS(Nu%r is not a valid netmask(uNetmaskValueErroruNone(uselfu netmask_strumsg((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_report_invalid_netmaskļs u&_IPAddressBase._report_invalid_netmaskc Cs‡tjj|ƒs"|j|ƒnyt|ƒ}Wntk rS|j|ƒYnXd|kon|jknsƒ|j|ƒn|S(u Return prefix length from a numeric string Args: prefixlen_str: The string to be converted Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is not a valid netmask i(u_BaseV4u_DECIMAL_DIGITSu issupersetu_report_invalid_netmaskuintu ValueErroru_max_prefixlen(uselfu prefixlen_stru prefixlen((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_prefix_from_prefix_stringós u)_IPAddressBase._prefix_from_prefix_stringcCsŸy|j|ƒ}Wntk r4|j|ƒYnXy|j|ƒSWntk rZYnX||jN}y|j|ƒSWntk rš|j|ƒYnXdS(uTurn a netmask/hostmask string into a prefix length Args: ip_str: The netmask/hostmask to be converted Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is not a valid netmask/hostmask N(u_ip_int_from_stringuAddressValueErroru_report_invalid_netmasku_prefix_from_ip_intu ValueErroru _ALL_ONES(uselfuip_struip_int((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_prefix_from_ip_string s     u%_IPAddressBase._prefix_from_ip_stringN(u__name__u __module__u __qualname__u__doc__upropertyuexplodedu compresseduversionu_check_int_addressu_check_packed_addressu_ip_int_from_prefixu_prefix_from_ip_intu_report_invalid_netmasku_prefix_from_prefix_stringu_prefix_from_ip_string(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_IPAddressBaseØs    u_IPAddressBasecBs’|EeZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z dd„Z dd„Z dd„Z dS(u _BaseAddressu€A generic IP object. This IP class contains the version independent methods which are used by single IP addresses. cCs9t|tƒ r5dt|ƒkr5td|ƒ‚ndS(Nu/uUnexpected '/' in %r(u isinstanceubytesustruAddressValueError(uselfuaddress((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__5su_BaseAddress.__init__cCs|jS(N(u_ip(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__int__:su_BaseAddress.__int__c CsCy&|j|jko$|j|jkSWntk r>tSYnXdS(N(u_ipu_versionuAttributeErroruNotImplemented(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__eq__=s  u_BaseAddress.__eq__cCsy|j|jkr+td||fƒ‚nt|tƒsStd||fƒ‚n|j|jkru|j|jkSdS(Nu%%s and %s are not of the same versionu"%s and %s are not of the same typeF(u_versionu TypeErroru isinstanceu _BaseAddressu_ipuFalse(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__lt__Dsu_BaseAddress.__lt__cCs*t|tƒstS|jt|ƒ|ƒS(N(u isinstanceuintuNotImplementedu __class__(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__add__Qsu_BaseAddress.__add__cCs*t|tƒstS|jt|ƒ|ƒS(N(u isinstanceuintuNotImplementedu __class__(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__sub__Vsu_BaseAddress.__sub__cCsd|jjt|ƒfS(Nu%s(%r)(u __class__u__name__ustr(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__repr__[su_BaseAddress.__repr__cCst|j|jƒƒS(N(ustru_string_from_ip_intu_ip(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__str__^su_BaseAddress.__str__cCsttt|jƒƒƒS(N(uhashuhexuintu_ip(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__hash__asu_BaseAddress.__hash__cCs |j|fS(N(u_version(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_get_address_keydsu_BaseAddress._get_address_keyN(u__name__u __module__u __qualname__u__doc__u__init__u__int__u__eq__u__lt__u__add__u__sub__u__repr__u__str__u__hash__u_get_address_key(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu _BaseAddress-s        u _BaseAddresscBsā|EeZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z dd„Z dd„Z dd„Z dd„Zedd„ƒZedd„ƒZedd„ƒZedd„ƒZed d!„ƒZed"d#„ƒZed$d%„ƒZed&d'„ƒZd(d)„Zd*d+„Zd,d-„Zd.d?d/d0„Zd.d?d1d2„Zed3d4„ƒZed5d6„ƒZed7d8„ƒZ ed9d:„ƒZ!ed;d<„ƒZ"ed=d>„ƒZ#d?S(@u _BaseNetworku~A generic IP network object. This IP class contains the version independent methods which are used by networks. cCs i|_dS(N(u_cache(uselfuaddress((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__psu_BaseNetwork.__init__cCsd|jjt|ƒfS(Nu%s(%r)(u __class__u__name__ustr(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__repr__ssu_BaseNetwork.__repr__cCsd|j|jfS(Nu%s/%d(unetwork_addressu prefixlen(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__str__vsu_BaseNetwork.__str__ccsNt|jƒ}t|jƒ}x)t|d|ƒD]}|j|ƒVq2WdS(uŸGenerate Iterator over usable hosts in a network. This is like __iter__ except it doesn't return the network or broadcast addresses. iN(uintunetwork_addressubroadcast_addressurangeu_address_class(uselfunetworku broadcastux((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuhostsysu_BaseNetwork.hostsccsNt|jƒ}t|jƒ}x)t||dƒD]}|j|ƒVq2WdS(Ni(uintunetwork_addressubroadcast_addressurangeu_address_class(uselfunetworku broadcastux((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__iter__…su_BaseNetwork.__iter__cCsŒt|jƒ}t|jƒ}|dkrT|||krCt‚n|j||ƒS|d7}|||krwt‚n|j||ƒSdS(Nii(uintunetwork_addressubroadcast_addressu IndexErroru_address_class(uselfununetworku broadcast((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu __getitem__‹s    u_BaseNetwork.__getitem__cCs›|j|jkr+td||fƒ‚nt|tƒsStd||fƒ‚n|j|jkru|j|jkS|j|jkr—|j|jkSdS(Nu%%s and %s are not of the same versionu"%s and %s are not of the same typeF(u_versionu TypeErroru isinstanceu _BaseNetworkunetwork_addressunetmaskuFalse(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__lt__˜su_BaseNetwork.__lt__c CsayD|j|jkoB|j|jkoBt|jƒt|jƒkSWntk r\tSYnXdS(N(u_versionunetwork_addressuintunetmaskuAttributeErroruNotImplemented(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__eq__„s   u_BaseNetwork.__eq__cCs tt|jƒt|jƒAƒS(N(uhashuintunetwork_addressunetmask(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__hash__­su_BaseNetwork.__hash__cCs`|j|jkrdSt|tƒr)dSt|jƒt|jƒkoYt|jƒkSSdS(NF(u_versionuFalseu isinstanceu _BaseNetworkuintunetwork_addressu_ipubroadcast_address(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu __contains__°s  u_BaseNetwork.__contains__cCs:|j|kp9|j|kp9|j|kp9|j|kS(u*Tell if self is partly contained in other.(unetwork_addressubroadcast_address(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuoverlaps½su_BaseNetwork.overlapscCsW|jjdƒ}|dkrS|jt|jƒt|jƒBƒ}||jd other eg: IPv4Network('192.0.2.128/25') > IPv4Network('192.0.2.0/25') IPv6Network('2001:db8::2000/124') > IPv6Network('2001:db8::1000/124') Raises: TypeError if the IP versions are different. u"%s and %s are not of the same typeiii’’’’i’’’’(u_versionu TypeErrorunetwork_addressunetmask(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyucompare_networks@s!u_BaseNetwork.compare_networkscCs|j|j|jfS(uĖNetwork-only key function. Returns an object that identifies this address' network and netmask. This function is a suitable "key" argument for sorted() and list.sort(). (u_versionunetwork_addressunetmask(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_get_networks_keypsu_BaseNetwork._get_networks_keyiccsK|j|jkr|VdS|dk rp||jkrEtdƒ‚n|dkr`tdƒ‚n||j}n|dkr‹tdƒ‚n|j|}||jkrĄtd||fƒ‚n|jd|j|j|fƒ}|V|}xV|j}||jkr dS|jt|ƒdƒ}|jd||fƒ}|VqńdS( uÓThe subnets which join to make the current subnet. In the case that self contains only one IP (self._prefixlen == 32 for IPv4 or self._prefixlen == 128 for IPv6), yield an iterator with just ourself. Args: prefixlen_diff: An integer, the amount the prefix length should be increased by. This should not be set if new_prefix is also set. new_prefix: The desired new prefix length. This must be a larger number (smaller prefix) than the existing prefix. This should not be set if prefixlen_diff is also set. Returns: An iterator of IPv(4|6) objects. Raises: ValueError: The prefixlen_diff is too small or too large. OR prefixlen_diff and new_prefix are both set or new_prefix is a smaller number than the current prefix (smaller number means a larger network) Nunew prefix must be longeriu(cannot set prefixlen_diff and new_prefixiuprefix length diff must be > 0u0prefix length diff %d is invalid for netblock %su%s/%s( u _prefixlenu_max_prefixlenuNoneu ValueErroru __class__unetwork_addressubroadcast_addressu_address_classuint(uselfuprefixlen_diffu new_prefixu new_prefixlenufirstucurrentu broadcastunew_addr((u./opt/alt/python33/lib64/python3.3/ipaddress.pyusubnetszs:        u_BaseNetwork.subnetscCsŻ|jdkr|S|dk rh||jkr=tdƒ‚n|dkrXtdƒ‚n|j|}n|j|dkr—td|j|fƒ‚n|jd|j|j|fdd ƒ}|jd|j|jfƒS( uĖThe supernet containing the current network. Args: prefixlen_diff: An integer, the amount the prefix length of the network should be decreased by. For example, given a /24 network and a prefixlen_diff of 3, a supernet with a /21 netmask is returned. Returns: An IPv4 network object. Raises: ValueError: If self.prefixlen - prefixlen_diff < 0. I.e., you have a negative prefix length. OR If prefixlen_diff and new_prefix are both set or new_prefix is a larger number than the current prefix (larger number means a smaller network) iunew prefix must be shorteriu(cannot set prefixlen_diff and new_prefixu;current prefixlen is %d, cannot have a prefixlen_diff of %du%s/%dustrictNF(u _prefixlenuNoneu ValueErroru prefixlenu __class__unetwork_addressuFalse(uselfuprefixlen_diffu new_prefixut((u./opt/alt/python33/lib64/python3.3/ipaddress.pyusupernetøs    u_BaseNetwork.supernetcCs|jjo|jjS(u»Test if the address is reserved for multicast use. Returns: A boolean, True if the address is a multicast address. See RFC 2373 2.7 for details. (unetwork_addressu is_multicastubroadcast_address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_multicastįs u_BaseNetwork.is_multicastcCs|jjo|jjS(uµTest if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within one of the reserved IPv6 Network ranges. (unetwork_addressu is_reservedubroadcast_address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_reservedķs u_BaseNetwork.is_reservedcCs|jjo|jjS(uTest if the address is reserved for link-local. Returns: A boolean, True if the address is reserved per RFC 4291. (unetwork_addressu is_link_localubroadcast_address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_link_localłs u_BaseNetwork.is_link_localcCs|jjo|jjS(u˜Test if this address is allocated for private networks. Returns: A boolean, True if the address is reserved per RFC 4193. (unetwork_addressu is_privateubroadcast_address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_privates u_BaseNetwork.is_privatecCs|jjo|jjS(uØTest if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 2373 2.5.2. (unetwork_addressuis_unspecifiedubroadcast_address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuis_unspecifieds u_BaseNetwork.is_unspecifiedcCs|jjo|jjS(u±Test if the address is a loopback address. Returns: A boolean, True if the address is a loopback address as defined in RFC 2373 2.5.3. (unetwork_addressu is_loopbackubroadcast_address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_loopbacks u_BaseNetwork.is_loopbackN($u__name__u __module__u __qualname__u__doc__u__init__u__repr__u__str__uhostsu__iter__u __getitem__u__lt__u__eq__u__hash__u __contains__uoverlapsupropertyubroadcast_addressuhostmaskuwith_prefixlenu with_netmasku with_hostmasku num_addressesu_address_classu prefixlenuaddress_excludeucompare_networksu_get_networks_keyuNoneusubnetsusupernetu is_multicastu is_reservedu is_link_localu is_privateuis_unspecifiedu is_loopback(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu _BaseNetworkhs>         N 0 >)     u _BaseNetworkc Bsø|EeZdZdZdedZedƒZed!ƒZdd„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zedd„ƒZedd„ƒZd S("u_BaseV4uyBase IPv4 object. The following methods are used by IPv4 objects in both single IP addresses and networks. iiu 0123456789i’ižiüiųišiąiĄi€icCsd|_t|_dS(Ni(u_versionu IPV4LENGTHu_max_prefixlen(uselfuaddress((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__8s u_BaseV4.__init__cCs t|ƒS(N(ustr(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_explode_shorthand_ip_string<su$_BaseV4._explode_shorthand_ip_stringcCs®|stdƒ‚n|jdƒ}t|ƒdkrItd|ƒ‚ny tjt|j|ƒdƒSWn>tk r©}ztd||fƒd‚WYdd}~XnXdS(uTurn the given IP string into an integer for comparison. Args: ip_str: A string, the IP ip_str. Returns: The IP ip_str as an integer. Raises: AddressValueError: if ip_str isn't a valid IPv4 Address. uAddress cannot be emptyu.iuExpected 4 octets in %rubigu%s in %rN( uAddressValueErrorusplitulenuintu from_bytesumapu _parse_octetu ValueErroruNone(uselfuip_struoctetsuexc((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_ip_int_from_string?s  u_BaseV4._ip_int_from_stringcCsŅ|stdƒ‚n|jj|ƒs@d}t||ƒ‚nt|ƒdkrkd}t||ƒ‚nt|dƒ}|dkrÆ|ddkrÆd }t||ƒ‚n|d krĪtd |ƒ‚n|S( u Convert a decimal octet into an integer. Args: octet_str: A string, the number to parse. Returns: The octet as an integer. Raises: ValueError: if the octet isn't strictly a decimal from [0..255]. uEmpty octet not permittedu#Only decimal digits permitted in %riu$At most 3 characters permitted in %ri iiu0u3Ambiguous (octal/decimal) value in %r not permittedi’uOctet %d (> 255) not permitted(u ValueErroru_DECIMAL_DIGITSu issupersetulenuint(uselfu octet_strumsgu octet_int((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu _parse_octetXs  u_BaseV4._parse_octetcCs"djtt|jddƒƒƒS(uŅTurns a 32-bit integer into dotted decimal notation. Args: ip_int: An integer, the IP address. Returns: The IP address as a string in dotted decimal notation. u.iubig(ujoinumapustruto_bytes(uselfuip_int((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_string_from_ip_int|s u_BaseV4._string_from_ip_intcCsń|jdƒ}t|ƒdkr­y.x'|D]}t|ƒ|jkr+dSq+WWntk rgdSYnXx>t|ƒD]0\}}|dkru|||dkrudSquWdSyt|ƒ}Wntk rÕdSYnXd|koī|jkSS(uūVerify that the netmask is valid. Args: netmask: A string, either a prefix or dotted decimal netmask. Returns: A boolean, True if the prefix represents a valid IPv4 netmask. u.iiiFT( usplitulenuintu_valid_mask_octetsuFalseu ValueErroru enumerateuTrueu_max_prefixlen(uselfunetmaskumaskuxuidxuy((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_is_valid_netmaskˆs"        u_BaseV4._is_valid_netmaskc s†|jdƒ}y&‡fdd†tt|ƒDƒ}Wntk rMdSYnXt|ƒt|ƒkrjdS|d|dkr‚dSdS( uŁTest if the IP string is a hostmask (rather than a netmask). Args: ip_str: A string, the potential hostmask. Returns: A boolean, True if the IP string is a hostmask. u.cs%g|]}|ˆjkr|‘qS((u_valid_mask_octets(u.0ux(uself(u./opt/alt/python33/lib64/python3.3/ipaddress.pyu ³s u(_BaseV4._is_hostmask..iiFi’’’’T(usplitumapuintu ValueErroruFalseulenuTrue(uselfuip_strubitsuparts((uselfu./opt/alt/python33/lib64/python3.3/ipaddress.pyu _is_hostmask§s &  u_BaseV4._is_hostmaskcCs|jS(N(u_max_prefixlen(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu max_prefixlen¼su_BaseV4.max_prefixlencCs|jS(N(u_version(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuversionĄsu_BaseV4.versionN( i’ižiüiųišiąiĄi€i(u__name__u __module__u __qualname__u__doc__u IPV4LENGTHu _ALL_ONESu frozensetu_DECIMAL_DIGITSu_valid_mask_octetsu__init__u_explode_shorthand_ip_stringu_ip_int_from_stringu _parse_octetu_string_from_ip_intu_is_valid_netmasku _is_hostmaskupropertyu max_prefixlenuversion(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_BaseV4(s      $  u_BaseV4cBs¤|EeZdZdZdd„Zedd„ƒZedd„ƒZedd „ƒZed d „ƒZ ed d „ƒZ edd„ƒZ edd„ƒZ dS(u IPv4Addressu/Represent and manipulate single IPv4 Addresses.cCs£tj||ƒtj||ƒt|tƒrI|j|ƒ||_dSt|tƒr|j|dƒtj |dƒ|_dSt |ƒ}|j |ƒ|_dS(u± Args: address: A string or integer representing the IP Additionally, an integer can be passed, so IPv4Address('192.0.2.1') == IPv4Address(3221225985). or, more generally IPv4Address(int(IPv4Address('192.0.2.1'))) == IPv4Address('192.0.2.1') Raises: AddressValueError: If ipaddress isn't a valid IPv4 address. Niubig( u _BaseAddressu__init__u_BaseV4u isinstanceuintu_check_int_addressu_ipubytesu_check_packed_addressu from_bytesustru_ip_int_from_string(uselfuaddressuaddr_str((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__És   uIPv4Address.__init__cCs t|jƒS(u*The binary representation of this address.(uv4_int_to_packedu_ip(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyupackedķsuIPv4Address.packedcCstdƒ}||kS(u°Test if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within the reserved IPv4 Network range. u 240.0.0.0/4(u IPv4Network(uselfureserved_network((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_reservedņs uIPv4Address.is_reservedcCsFtdƒ}tdƒ}tdƒ}||kpE||kpE||kS(u˜Test if this address is allocated for private networks. Returns: A boolean, True if the address is reserved per RFC 1918. u 10.0.0.0/8u 172.16.0.0/12u192.168.0.0/16(u IPv4Network(uselfu private_10u private_172u private_192((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_privatežs      uIPv4Address.is_privatecCstdƒ}||kS(u­Test if the address is reserved for multicast use. Returns: A boolean, True if the address is multicast. See RFC 3171 for details. u 224.0.0.0/4(u IPv4Network(uselfumulticast_network((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_multicast s uIPv4Address.is_multicastcCstdƒ}||kS(u¤Test if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 5735 3. u0.0.0.0(u IPv4Address(uselfuunspecified_address((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuis_unspecifieds uIPv4Address.is_unspecifiedcCstdƒ}||kS(uTest if the address is a loopback address. Returns: A boolean, True if the address is a loopback per RFC 3330. u 127.0.0.0/8(u IPv4Network(uselfuloopback_network((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_loopback%s uIPv4Address.is_loopbackcCstdƒ}||kS(u’Test if the address is reserved for link-local. Returns: A boolean, True if the address is link-local per RFC 3927. u169.254.0.0/16(u IPv4Network(uselfulinklocal_network((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_link_local0s uIPv4Address.is_link_localN( u__name__u __module__u __qualname__u__doc__u__init__upropertyupackedu is_reservedu is_privateu is_multicastuis_unspecifiedu is_loopbacku is_link_local(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu IPv4AddressÅs $    u IPv4AddresscBs˜|EeZdZdd„Zdd„Zdd„Zdd„Zd d „Zed d „ƒZ ed d„ƒZ edd„ƒZ edd„ƒZ dS(u IPv4InterfacecCs­t|ttfƒrGtj||ƒt|jƒ|_|j|_ dSt |ƒ}tj||dƒt|ddƒ|_|jj |_ |jj |_ |jj |_ dS(NiustrictF(u isinstanceubytesuintu IPv4Addressu__init__u IPv4Networku_ipunetworku_max_prefixlenu _prefixlenu_split_optional_netmaskuFalseunetmaskuhostmask(uselfuaddressuaddr((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__>s  uIPv4Interface.__init__cCs d|j|jƒ|jjfS(Nu%s/%d(u_string_from_ip_intu_ipunetworku prefixlen(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__str__NsuIPv4Interface.__str__c CsZtj||ƒ}| s%|tkr)|Sy|j|jkSWntk rUdSYnXdS(NF(u IPv4Addressu__eq__uNotImplementedunetworkuAttributeErroruFalse(uselfuotheru address_equal((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__eq__Rs uIPv4Interface.__eq__c CsStj||ƒ}|tkr"tSy|j|jkSWntk rNdSYnXdS(NF(u IPv4Addressu__lt__uNotImplementedunetworkuAttributeErroruFalse(uselfuotheru address_less((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__lt__^s  uIPv4Interface.__lt__cCs|j|jAt|jjƒAS(N(u_ipu _prefixlenuintunetworkunetwork_address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__hash__isuIPv4Interface.__hash__cCs t|jƒS(N(u IPv4Addressu_ip(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuiplsuIPv4Interface.ipcCsd|j|jƒ|jfS(Nu%s/%s(u_string_from_ip_intu_ipu _prefixlen(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuwith_prefixlenpsuIPv4Interface.with_prefixlencCsd|j|jƒ|jfS(Nu%s/%s(u_string_from_ip_intu_ipunetmask(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu with_netmaskusuIPv4Interface.with_netmaskcCsd|j|jƒ|jfS(Nu%s/%s(u_string_from_ip_intu_ipuhostmask(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu with_hostmaskzsuIPv4Interface.with_hostmaskN( u__name__u __module__u __qualname__u__init__u__str__u__eq__u__lt__u__hash__upropertyuipuwith_prefixlenu with_netmasku with_hostmask(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu IPv4Interface<s   u IPv4InterfacecBs/|EeZdZdZeZddd„ZdS(u IPv4NetworkueThis class represents and manipulates 32-bit IPv4 network + addresses.. Attributes: [examples for IPv4Network('192.0.2.0/27')] .network_address: IPv4Address('192.0.2.0') .hostmask: IPv4Address('0.0.0.31') .broadcast_address: IPv4Address('192.0.2.32') .netmask: IPv4Address('255.255.255.224') .prefixlen: 27 c CsŽtj||ƒtj||ƒt|tƒr`t|ƒ|_|j|_t|j ƒ|_ dSt|t ƒr t|ƒ|_|j|_t|j ƒ|_ dSt |ƒ}t|j |dƒƒ|_t|ƒdkr"y|j|dƒ|_Wq.tk r|j|dƒ|_Yq.Xn |j|_t|j|jƒƒ|_ |rtt |jƒt |j ƒ@ƒ|jkrtd|ƒ‚qntt |jƒt |j ƒ@ƒ|_|j|jdkrŚ|j|_ndS(uInstantiate a new IPv4 network object. Args: address: A string or integer representing the IP [& network]. '192.0.2.0/24' '192.0.2.0/255.255.255.0' '192.0.0.2/0.0.0.255' are all functionally the same in IPv4. Similarly, '192.0.2.1' '192.0.2.1/255.255.255.255' '192.0.2.1/32' are also functionally equivalent. That is to say, failing to provide a subnetmask will create an object with a mask of /32. If the mask (portion after the / in the argument) is given in dotted quad form, it is treated as a netmask if it starts with a non-zero field (e.g. /255.0.0.0 == /8) and as a hostmask if it starts with a zero field (e.g. 0.255.255.255 == /8), with the single exception of an all-zero mask which is treated as a netmask == /0. If no mask is given, a default of /32 is used. Additionally, an integer can be passed, so IPv4Network('192.0.2.1') == IPv4Network(3221225985) or, more generally IPv4Interface(int(IPv4Interface('192.0.2.1'))) == IPv4Interface('192.0.2.1') Raises: AddressValueError: If ipaddress isn't a valid IPv4 address. NetmaskValueError: If the netmask isn't valid for an IPv4 address. ValueError: If strict is True and a network address is not supplied. Niiiu%s has host bits set(u_BaseV4u__init__u _BaseNetworku isinstanceubytesu IPv4Addressunetwork_addressu_max_prefixlenu _prefixlenu _ALL_ONESunetmaskuintu_split_optional_netmasku_ip_int_from_stringulenu_prefix_from_prefix_stringuNetmaskValueErroru_prefix_from_ip_stringu_ip_int_from_prefixu ValueErroru__iter__uhosts(uselfuaddressustrictuaddr((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__s:&      uIPv4Network.__init__NT(u__name__u __module__u __qualname__u__doc__u IPv4Addressu_address_classuTrueu__init__(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu IPv4Network€s u IPv4NetworkcBs©|EeZdZdZdedZdZedƒZdd„Z dd „Z d d „Z d d „Z ddd„Zdd„Zedd„ƒZedd„ƒZdS(u_BaseV6uyBase IPv6 object. The following methods are used by IPv6 objects in both single IP addresses and networks. iiiu0123456789ABCDEFabcdefcCsd|_t|_dS(Ni(u_versionu IPV6LENGTHu_max_prefixlen(uselfuaddress((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__ńs u_BaseV6.__init__cCsÜ|stdƒ‚n|jdƒ}d}t|ƒ|kr[d||f}t|ƒ‚nd|dkröyt|jƒƒj}Wn>tk rÄ}ztd||fƒd‚WYdd}~XnX|jd |d ?d @ƒ|jd |d @ƒn|jd}t|ƒ|kr8d |d|f}t|ƒ‚nd}xYt dt|ƒdƒD]>} || sX|dk rd |}t|ƒ‚n| }qXqXW|dk rr|} t|ƒ|d} |dsö| d8} | röd}t||ƒ‚qön|ds,| d8} | r,d}t||ƒ‚q,n|j| | } | dkrd}t||jd|fƒ‚qn•t|ƒ|jkr©d}t||j|fƒ‚n|dsĢd}t||ƒ‚n|dsļd}t||ƒ‚nt|ƒ} d} d} yd} x5t | ƒD]'} | d K} | |j || ƒO} qW| d | K} x9t | dƒD]'} | d K} | |j || ƒO} qgW| SWn>t k r×}ztd||fƒd‚WYdd}~XnXdS(ułTurn an IPv6 ip_str into an integer. Args: ip_str: A string, the IPv6 ip_str. Returns: An int, the IPv6 address Raises: AddressValueError: if ip_str isn't a valid IPv6 Address. uAddress cannot be emptyu:iu At least %d parts expected in %ru.iu%s in %rNu%xii’’u!At most %d colons permitted in %ru At most one '::' permitted in %riu0Leading ':' only permitted as part of '::' in %ru1Trailing ':' only permitted as part of '::' in %ru/Expected at most %d other parts with '::' in %ru,Exactly %d parts expected without '::' in %ri’’’’i’’’’i’’’’( uAddressValueErrorusplitulenu IPv4Addressupopu_ipuNoneuappendu _HEXTET_COUNTurangeu _parse_hextetu ValueError(uselfuip_strupartsu _min_partsumsguipv4_intuexcu _max_partsu skip_indexuiuparts_hiuparts_lou parts_skippeduip_int((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_ip_int_from_stringõs„ ,            #     u_BaseV6._ip_int_from_stringcCs]|jj|ƒs%td|ƒ‚nt|ƒdkrPd}t||ƒ‚nt|dƒS(u&Convert an IPv6 hextet string into an integer. Args: hextet_str: A string, the number to parse. Returns: The hextet as an integer. Raises: ValueError: if the input isn't strictly a hex number from [0..FFFF]. uOnly hex digits permitted in %riu$At most 4 characters permitted in %ri(u _HEX_DIGITSu issupersetu ValueErrorulenuint(uselfu hextet_strumsg((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu _parse_hextet\s u_BaseV6._parse_hextetc Csųd}d}d}d}xot|ƒD]a\}}|dkrz|d7}|dkr\|}n||kr†|}|}q†q%d}d}q%W|dkrō||}|t|ƒkrĀ|dg7}ndg|||…<|dkrōdg|}qōn|S( uäCompresses a list of hextets. Compresses a list of strings, replacing the longest continuous sequence of "0" in the list with "" and adding empty strings at the beginning or at the end of the string such that subsequently calling ":".join(hextets) will produce the compressed version of the IPv6 address. Args: hextets: A list of strings, the hextets to compress. Returns: A list of strings. iiu0ui’’’’i’’’’i’’’’i’’’’(u enumerateulen( uselfuhextetsubest_doublecolon_startubest_doublecolon_lenudoublecolon_startudoublecolon_lenuindexuhextetubest_doublecolon_end((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_compress_hextetsus.         u_BaseV6._compress_hextetscs‡|d krt|jƒ}n||jkr<tdƒ‚nd|‰‡fdd†tdddƒDƒ}|j|ƒ}dj|ƒS( u,Turns a 128-bit integer into hexadecimal notation. Args: ip_int: An integer, the IP address. Returns: A string, the hexadecimal representation of the address. Raises: ValueError: The address is bigger than 128 bits of all ones. uIPv6 address is too largeu%032xcs1g|]'}dtˆ||d…dƒ‘qS(u%xii(uint(u.0ux(uhex_str(u./opt/alt/python33/lib64/python3.3/ipaddress.pyu øs u/_BaseV6._string_from_ip_int..ii iu:N(uNoneuintu_ipu _ALL_ONESu ValueErrorurangeu_compress_hextetsujoin(uselfuip_intuhextets((uhex_stru./opt/alt/python33/lib64/python3.3/ipaddress.pyu_string_from_ip_int¤s  %u_BaseV6._string_from_ip_intcsČt|tƒr!t|jƒ}n-t|tƒrBt|jƒ}n t|ƒ}|j|ƒ}d|‰‡fdd†tdddƒDƒ}t|ttfƒr»ddj |ƒ|j fSdj |ƒS( u¬Expand a shortened IPv6 address. Args: ip_str: A string, the IPv6 address. Returns: A string, the expanded IPv6 address. u%032xcs$g|]}ˆ||d…‘qS(i((u.0ux(uhex_str(u./opt/alt/python33/lib64/python3.3/ipaddress.pyu Šs u8_BaseV6._explode_shorthand_ip_string..ii iu%s/%du:( u isinstanceu IPv6Networkustrunetwork_addressu IPv6Interfaceuipu_ip_int_from_stringurangeu _BaseNetworkujoinu _prefixlen(uselfuip_struip_intuparts((uhex_stru./opt/alt/python33/lib64/python3.3/ipaddress.pyu_explode_shorthand_ip_string½s   %u$_BaseV6._explode_shorthand_ip_stringcCs|jS(N(u_max_prefixlen(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu max_prefixlenÕsu_BaseV6.max_prefixlencCs|jS(N(u_version(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuversionŁsu_BaseV6.versionN(u__name__u __module__u __qualname__u__doc__u IPV6LENGTHu _ALL_ONESu _HEXTET_COUNTu frozensetu _HEX_DIGITSu__init__u_ip_int_from_stringu _parse_hextetu_compress_hextetsuNoneu_string_from_ip_intu_explode_shorthand_ip_stringupropertyu max_prefixlenuversion(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_BaseV6äs   g  / u_BaseV6cBsģ|EeZdZdZdd„Zedd„ƒZedd„ƒZedd „ƒZed d „ƒZ ed d „ƒZ edd„ƒZ edd„ƒZ edd„ƒZ edd„ƒZedd„ƒZedd„ƒZdS(u IPv6Addressu/Represent and manipulate single IPv6 Addresses.cCs£tj||ƒtj||ƒt|tƒrI|j|ƒ||_dSt|tƒr|j|dƒtj |dƒ|_dSt |ƒ}|j |ƒ|_dS(uInstantiate a new IPv6 address object. Args: address: A string or integer representing the IP Additionally, an integer can be passed, so IPv6Address('2001:db8::') == IPv6Address(42540766411282592856903984951653826560) or, more generally IPv6Address(int(IPv6Address('2001:db8::'))) == IPv6Address('2001:db8::') Raises: AddressValueError: If address isn't a valid IPv6 address. Niubig( u _BaseAddressu__init__u_BaseV6u isinstanceuintu_check_int_addressu_ipubytesu_check_packed_addressu from_bytesustru_ip_int_from_string(uselfuaddressuaddr_str((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__ās   uIPv6Address.__init__cCs t|jƒS(u*The binary representation of this address.(uv6_int_to_packedu_ip(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyupackedsuIPv6Address.packedcCstdƒ}||kS(u»Test if the address is reserved for multicast use. Returns: A boolean, True if the address is a multicast address. See RFC 2373 2.7 for details. uff00::/8(u IPv6Network(uselfumulticast_network((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_multicast s uIPv6Address.is_multicastcsŖtdƒtdƒtdƒtdƒtdƒtdƒtdƒtdƒtd ƒtd ƒtd ƒtd ƒtd ƒtdƒtdƒg}t‡fdd†|DƒƒS(uµTest if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within one of the reserved IPv6 Network ranges. u::/8u100::/8u200::/7u400::/6u800::/5u1000::/4u4000::/3u6000::/3u8000::/3uA000::/3uC000::/3uE000::/4uF000::/5uF800::/6uFE00::/9c3s|]}ˆ|kVqdS(N((u.0ux(uself(u./opt/alt/python33/lib64/python3.3/ipaddress.pyu *su*IPv6Address.is_reserved..(u IPv6Networkuany(uselfureserved_networks((uselfu./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_reserveds uIPv6Address.is_reservedcCstdƒ}||kS(uTest if the address is reserved for link-local. Returns: A boolean, True if the address is reserved per RFC 4291. u fe80::/10(u IPv6Network(uselfulinklocal_network((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_link_local,s uIPv6Address.is_link_localcCstdƒ}||kS(u`Test if the address is reserved for site-local. Note that the site-local address space has been deprecated by RFC 3879. Use is_private to test if this address is in the space of unique local addresses as defined by RFC 4193. Returns: A boolean, True if the address is reserved per RFC 3513 2.5.6. u fec0::/10(u IPv6Network(uselfusitelocal_network((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_site_local7s uIPv6Address.is_site_localcCstdƒ}||kS(u˜Test if this address is allocated for private networks. Returns: A boolean, True if the address is reserved per RFC 4193. ufc00::/7(u IPv6Network(uselfuprivate_network((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_privateFs uIPv6Address.is_privatecCs |jdkS(uØTest if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 2373 2.5.2. i(u_ip(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuis_unspecifiedQs uIPv6Address.is_unspecifiedcCs |jdkS(u±Test if the address is a loopback address. Returns: A boolean, True if the address is a loopback address as defined in RFC 2373 2.5.3. i(u_ip(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_loopback\s uIPv6Address.is_loopbackcCs(|jd?dkrdSt|jd@ƒS(u¶Return the IPv4 mapped address. Returns: If the IPv6 address is a v4 mapped address, return the IPv4 mapped address. Return None otherwise. i i’’l’’N(u_ipuNoneu IPv4Address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu ipv4_mappedgs uIPv6Address.ipv4_mappedcCs@|jd?dkrdSt|jd?d@ƒt|jd@ƒfS(uŪTuple of embedded teredo IPs. Returns: Tuple of the (server, client) IPs or None if the address doesn't appear to be a teredo address (doesn't start with 2001::/32) i`i i@l’’N(u_ipuNoneu IPv4Address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuteredots uIPv6Address.teredocCs,|jd?dkrdSt|jd?d@ƒS(uĪReturn the IPv4 6to4 embedded address. Returns: The IPv4 6to4-embedded address if present or None if the address doesn't appear to contain a 6to4 embedded address. ipi iPl’’N(u_ipuNoneu IPv4Address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu sixtofourƒs uIPv6Address.sixtofourN(u__name__u __module__u __qualname__u__doc__u__init__upropertyupackedu is_multicastu is_reservedu is_link_localu is_site_localu is_privateuis_unspecifiedu is_loopbacku ipv4_mappeduteredou sixtofour(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu IPv6AddressŽs %      u IPv6AddresscBs¼|EeZdZdd„Zdd„Zdd„Zdd„Zd d „Zed d „ƒZ ed d„ƒZ edd„ƒZ edd„ƒZ edd„ƒZ edd„ƒZdS(u IPv6InterfacecCs­t|ttfƒrGtj||ƒt|jƒ|_|j|_ dSt |ƒ}tj||dƒt|ddƒ|_|jj |_ |jj |_ |jj |_ dS(NiustrictF(u isinstanceubytesuintu IPv6Addressu__init__u IPv6Networku_ipunetworku_max_prefixlenu _prefixlenu_split_optional_netmaskuFalseunetmaskuhostmask(uselfuaddressuaddr((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__“s  uIPv6Interface.__init__cCs d|j|jƒ|jjfS(Nu%s/%d(u_string_from_ip_intu_ipunetworku prefixlen(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__str__”suIPv6Interface.__str__c CsZtj||ƒ}| s%|tkr)|Sy|j|jkSWntk rUdSYnXdS(NF(u IPv6Addressu__eq__uNotImplementedunetworkuAttributeErroruFalse(uselfuotheru address_equal((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__eq__„s uIPv6Interface.__eq__c CsStj||ƒ}|tkr"tSy|j|jkSWntk rNdSYnXdS(NF(u IPv6Addressu__lt__uNotImplementedunetworkuAttributeErroruFalse(uselfuotheru address_less((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__lt__±s  uIPv6Interface.__lt__cCs|j|jAt|jjƒAS(N(u_ipu _prefixlenuintunetworkunetwork_address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__hash__¼suIPv6Interface.__hash__cCs t|jƒS(N(u IPv6Addressu_ip(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuipæsuIPv6Interface.ipcCsd|j|jƒ|jfS(Nu%s/%s(u_string_from_ip_intu_ipu _prefixlen(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuwith_prefixlenĆsuIPv6Interface.with_prefixlencCsd|j|jƒ|jfS(Nu%s/%s(u_string_from_ip_intu_ipunetmask(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu with_netmaskČsuIPv6Interface.with_netmaskcCsd|j|jƒ|jfS(Nu%s/%s(u_string_from_ip_intu_ipuhostmask(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu with_hostmaskĶsuIPv6Interface.with_hostmaskcCs|jdko|jjS(Ni(u_ipunetworkuis_unspecified(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuis_unspecifiedŅsuIPv6Interface.is_unspecifiedcCs|jdko|jjS(Ni(u_ipunetworku is_loopback(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_loopbackÖsuIPv6Interface.is_loopbackN(u__name__u __module__u __qualname__u__init__u__str__u__eq__u__lt__u__hash__upropertyuipuwith_prefixlenu with_netmasku with_hostmaskuis_unspecifiedu is_loopback(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu IPv6Interface‘s   u IPv6InterfacecBsA|EeZdZdZeZddd„Zedd„ƒZ dS(u IPv6NetworkuvThis class represents and manipulates 128-bit IPv6 networks. Attributes: [examples for IPv6('2001:db8::1000/124')] .network_address: IPv6Address('2001:db8::1000') .hostmask: IPv6Address('::f') .broadcast_address: IPv6Address('2001:db8::100f') .netmask: IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff0') .prefixlen: 124 cCsÆtj||ƒtj||ƒt|tƒr`t|ƒ|_|j|_t|j ƒ|_ dSt|t ƒr t|ƒ|_|j|_t|j ƒ|_ dSt |ƒ}t|j |dƒƒ|_t|ƒdkró|j|dƒ|_n |j|_t|j|jƒƒ|_ |ratt|jƒt|j ƒ@ƒ|jkratd|ƒ‚qantt|jƒt|j ƒ@ƒ|_|j|jdkr«|j|_ndS(uēInstantiate a new IPv6 Network object. Args: address: A string or integer representing the IPv6 network or the IP and prefix/netmask. '2001:db8::/128' '2001:db8:0000:0000:0000:0000:0000:0000/128' '2001:db8::' are all functionally the same in IPv6. That is to say, failing to provide a subnetmask will create an object with a mask of /128. Additionally, an integer can be passed, so IPv6Network('2001:db8::') == IPv6Network(42540766411282592856903984951653826560) or, more generally IPv6Network(int(IPv6Network('2001:db8::'))) == IPv6Network('2001:db8::') strict: A boolean. If true, ensure that we have been passed A true network address, eg, 2001:db8::1000/124 and not an IP address on a network, eg, 2001:db8::1/124. Raises: AddressValueError: If address isn't a valid IPv6 address. NetmaskValueError: If the netmask isn't valid for an IPv6 address. ValueError: If strict was True and a network address was not supplied. Niiiu%s has host bits set(u_BaseV6u__init__u _BaseNetworku isinstanceuintu IPv6Addressunetwork_addressu_max_prefixlenu _prefixlenu _ALL_ONESunetmaskubytesu_split_optional_netmasku_ip_int_from_stringulenu_prefix_from_prefix_stringu_ip_int_from_prefixu ValueErroru__iter__uhosts(uselfuaddressustrictuaddr((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__ės4      uIPv6Network.__init__cCs|jjo|jjS(u`Test if the address is reserved for site-local. Note that the site-local address space has been deprecated by RFC 3879. Use is_private to test if this address is in the space of unique local addresses as defined by RFC 4193. Returns: A boolean, True if the address is reserved per RFC 3513 2.5.6. (unetwork_addressu is_site_localubroadcast_address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_site_local3s uIPv6Network.is_site_localNT( u__name__u __module__u __qualname__u__doc__u IPv6Addressu_address_classuTrueu__init__upropertyu is_site_local(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu IPv6NetworkŪs Hu IPv6Network(!u__doc__u __version__u functoolsu IPV4LENGTHu IPV6LENGTHu ValueErroruAddressValueErroruNetmaskValueErroru ip_addressuTrueu ip_networku ip_interfaceuv4_int_to_packeduv6_int_to_packedu_split_optional_netmasku_find_address_rangeu_count_righthand_zero_bitsusummarize_address_rangeu_collapse_addresses_recursiveucollapse_addressesuget_mixed_type_keyu_TotalOrderingMixinu_IPAddressBaseu _BaseAddressu _BaseNetworku_BaseV4u IPv4Addressu IPv4Interfaceu IPv4Networku_BaseV6u IPv6Addressu IPv6Interfaceu IPv6Network(((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu s>   #      8 0 9 !…;’ĮwDdś³J