%PDF- %PDF-
Direktori : /proc/227033/root/opt/alt/python27/lib/python2.7/site-packages/paste/util/ |
Current File : //proc/227033/root/opt/alt/python27/lib/python2.7/site-packages/paste/util/ip4.pyo |
� b�Nc @ s+ d Z d Z d Z d Z d Z d d l Z d d l Z d e j f d � � YZ e d � Z e d � Z e d k r'e d � Z e d d d � Z e GHx e j � D] Z e GHq� Wx e j � D] Z e GHq� Wx e e Bj � D] Z e GHq� Wx e e Aj � D] Z e GHq� Wx e D] Z e GHqWn d S( s� IP4 address range set implementation. Implements an IPv4-range type. Copyright (C) 2006, Heiko Wundram. Released under the MIT-license. s Heiko Wundram <me@modelnine.org>s 0.2t 3s 2006-01-20i����Nt IP4Rangec B s� e Z d Z d Z d Z d j g e d � D] Z e e � ^ q+ � Z d Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z e Z d � Z RS( sb IP4 address range class with efficient storage of address ranges. Supports all set operations.i i i t i s 0123456789.c G s+ t | � d k rC t | d t � rC t t | � j | d � d St | � } x�t t | � � D]�} | | } t | t � r� d | k r� | j | j d d � � | | <qb q�d | k r� | j | j d d � � | | <q�| j | � | | <qb t | t � r�t t � d k r&t d � � n | \ } } t | t � rW| j | � d } n$ t | t t f � s{t d � � n t | t � r�| j | � d } n$ t | t t f � s�t d � � n | | f | | <qb t | t t f � sb t d � � qb qb Wt t | � j d | j d | j | � d S( sH Initialize an ip4range class. The constructor accepts an unlimited number of arguments that may either be tuples in the form (start,stop), integers, longs or strings, where start and stop in a tuple may also be of the form integer, long or string. Passing an integer or long means passing an IPv4-address that's already been converted to integer notation, whereas passing a string specifies an address where this conversion still has to be done. A string address may be in the following formats: - 1.2.3.4 - a plain address, interpreted as a single address - 1.2.3 - a set of addresses, interpreted as 1.2.3.0-1.2.3.255 - localhost - hostname to look up, interpreted as single address - 1.2.3<->5 - a set of addresses, interpreted as 1.2.3.0-1.2.5.255 - 1.2.0.0/16 - a set of addresses, interpreted as 1.2.0.0-1.2.255.255 Only the first three notations are valid if you use a string address in a tuple, whereby notation 2 is interpreted as 1.2.3.0 if specified as lower bound and 1.2.3.255 if specified as upper bound, not as a range of addresses. Specifying a range is done with the <-> operator. This is necessary because '-' might be present in a hostname. '<->' shouldn't be, ever. i i Ns <->s /i s Tuple is of invalid length.s Invalid argument.t mint max( t lent isinstanceR t supert __init__t listt ranget strt _parseRanget splitt _parseMaskt _parseAddrRanget tuplet ValueErrort intt longt TypeErrort _MINIP4t _MAXIP4( t selft argst it argvalt addr1t addr2( ( s? /opt/alt/python27/lib/python2.7/site-packages/paste/util/ip4.pyR &