HEX
Server: LiteSpeed
System: Linux premium71.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User: consovgw (933)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //proc/self/root/usr/lib/python3.6/site-packages/netaddr/__pycache__/core.cpython-36.pyc
3

��]
�@s�dZddlZddlZddlmZmZejdkZ	dZ
ZdZZ
dZZGdd	�d	e�ZGd
d�de�ZGdd
�d
e�ZydZej�dd�ZWnek
r�dd�ZYnXGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)z6Common code shared between various netaddr sub modules�N)�	_callable�_iter_dict_keysZbig���c@seZdZdZdS)�AddrFormatErrorzO
    An Exception indicating a network address is not correctly formatted.
    N)�__name__�
__module__�__qualname__�__doc__�rr�/usr/lib/python3.6/core.pyrsrc@seZdZdZdS)�AddrConversionErrorz^
    An Exception indicating a failure to convert between address types or
    notations.
    N)rr	r
rrrrr
r#src@seZdZdZdS)�NotRegisteredErrorz\
    An Exception indicating that an OUI or IAB was not found in the IEEE
    Registry.
    N)rr	r
rrrrr
r+sr�*cCs|j�S)z�
        :param int_val: an unsigned integer.

        :return: the minimum number of bits needed to represent value provided.
        )�
bit_length)�int_valrrr
�num_bits7srcCs"d}x|r|d7}|dL}qW|S)z�
        :param int_val: an unsigned integer.

        :return: the minimum number of bits needed to represent value provided.
        rrr)rZnumbitsrrr
r@s
c@seZdZdZdd�ZdS)�
SubscriberzK
    An abstract class defining the interface expected by a Publisher.
    cCstd��dS)z�
        A callback method used by a Publisher to notify this Subscriber about
        updates.

        :param data: a Python object containing data provided by Publisher.
        zcannot invoke virtual method!N)�NotImplementedError)�self�datarrr
�updateRszSubscriber.updateN)rr	r
rrrrrr
rMsrc@s(eZdZdZejdfdd�Zdd�ZdS)�
PrettyPrinterz�
    A concrete Subscriber that employs the pprint in the standard library to
    format all data from updates received, writing them to a file-like
    object.

    Useful as a debugging aid.
    TcCs||_||_dS)z�
        Constructor.

        :param fh: a file-like object to write updates to.
            Default: sys.stdout.


        :param write_eol: if ``True`` this object will write newlines to
            output, if ``False`` it will not.
        N)�fh�	write_eol)rrrrrr
�__init__eszPrettyPrinter.__init__cCs(|jjtj|��|jr$|jjd�dS)z�
        A callback method used by a Publisher to notify this Subscriber about
        updates.

        :param data: a Python object containing data provided by Publisher.
        �
N)r�write�_pprint�pformatr)rrrrr
rsszPrettyPrinter.updateN)rr	r
r�_sys�stdoutrrrrrr
r\src@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�	Publisherz�
    A 'push' Publisher that maintains a list of Subscriber objects notifying
    them of state changes by passing them update data when it encounter events
    of interest.
    cCs
g|_dS)ZConstructorN)�subscribers)rrrr
r�szPublisher.__init__cCs>t|d�r.ttd��r.||jkr:|jj|�ntd|��dS)z�
        Add a new subscriber.

        :param subscriber: a new object that implements the Subscriber object
            interface.
        rzsubscriber.updatez'%r does not support required interface!N)�hasattrr�evalr$�append�	TypeError)r�
subscriberrrr
�attach�s
zPublisher.attachcCs*y|jj|�Wntk
r$YnXdS)z�
        Remove an existing subscriber.

        :param subscriber: a new object that implements the Subscriber object
            interface.
        N)r$�remove�
ValueError)rr)rrr
�detach�szPublisher.detachcCsx|jD]}|j|�qWdS)z�
        Send update data to to all registered Subscribers.

        :param data: the data to be passed to each registered Subscriber.
        N)r$r)rrr)rrr
�notify�szPublisher.notifyN)rr	r
rrr*r-r.rrrr
r#s

r#c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
DictDotLookupa
    Creates objects that behave much like a dictionaries, but allow nested
    key access using object '.' (dot) lookups.

    Recipe 576586: Dot-style nested lookups over dictionary based data
    structures - http://code.activestate.com/recipes/576586/

    cCs�x�|D]�}t||t�r,t||�|j|<qt||ttf�r�g}x4||D](}t|t�rj|jt|��qL|j|�qLW||j|<q|||j|<qWdS)N)�
isinstance�dictr/�__dict__�list�tupler')r�d�k�l�vrrr
r�s

zDictDotLookup.__init__cCs||jkr|j|SdS)N)r2)r�namerrr
�__getitem__�s
zDictDotLookup.__getitem__cCs
t|j�S)N)rr2)rrrr
�__iter__�szDictDotLookup.__iter__cCstj|j�S)N)rr r2)rrrr
�__repr__�szDictDotLookup.__repr__N)rr	r
rrr:r;r<rrrr
r/�s
r/)r�sysr!�pprintrZnetaddr.compatrr�	byteorderZBIG_ENDIAN_PLATFORM�PZ	INET_PTON�ZZZEROFILL�NZNOHOST�	Exceptionrrr�arr�AttributeError�objectrrr#r/rrrr
�<module>s(

#.