Ñò î¡ßNc @ s d Z d d k Z d d k Z d d k Z d d k l Z l Z e i d j Z d Z Z d Z Z d Z Z d e f d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d „ Z d e f d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d „ Z d S( s6 Common code shared between various netaddr sub modulesiÿÿÿÿN( t _callablet _iter_dict_keyst bigi i i t AddrFormatErrorc B s e Z d Z RS( sO An Exception indicating a network address is not correctly formatted. ( t __name__t __module__t __doc__( ( ( s0 /usr/lib/python2.6/site-packages/netaddr/core.pyR s t AddrConversionErrorc B s e Z d Z RS( s^ An Exception indicating a failure to convert between address types or notations. ( R R R ( ( ( s0 /usr/lib/python2.6/site-packages/netaddr/core.pyR $ s t NotRegisteredErrorc B s e Z d Z RS( s\ An Exception indicating that an OUI or IAB was not found in the IEEE Registry. ( R R R ( ( ( s0 /usr/lib/python2.6/site-packages/netaddr/core.pyR , s c C s9 t | ƒ } d } x | o | d 7} | d L} q W| S( s{ @param int_val: an unsigned integer. @return: the minimum number of bits needed to represent value provided. i i ( t abs( t int_valt numbits( ( s0 /usr/lib/python2.6/site-packages/netaddr/core.pyt num_bits4 s t Subscriberc B s e Z d Z d „ Z RS( sK An abstract class defining the interface expected by a Publisher. c C s t d ƒ ‚ d S( sµ A callback method used by a Publisher to notify this Subscriber about updates. @param data: a Python object containing data provided by Publisher. s cannot invoke virtual method!N( t NotImplementedError( t selft data( ( s0 /usr/lib/python2.6/site-packages/netaddr/core.pyt updateF s ( R R R R ( ( ( s0 /usr/lib/python2.6/site-packages/netaddr/core.pyR B s t PrettyPrinterc B s) e Z d Z e i e d „ Z d „ Z RS( sÅ 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. c C s | | _ | | _ d S( sò Constructor. @param fh: a file-like object to write updates to. Default: sys.stdout. @param write_eol: if C{True} this object will write newlines to output, if C{False} it will not. N( t fht write_eol( R R R ( ( s0 /usr/lib/python2.6/site-packages/netaddr/core.pyt __init__X s c C s; | i i t i | ƒ ƒ | i o | i i d ƒ n d S( sµ A callback method used by a Publisher to notify this Subscriber about updates. @param data: a Python object containing data provided by Publisher. s N( R t writet _pprintt pformatR ( R R ( ( s0 /usr/lib/python2.6/site-packages/netaddr/core.pyR f s ( R R R t _syst stdoutt TrueR R ( ( ( s0 /usr/lib/python2.6/site-packages/netaddr/core.pyR P s t Publisherc B s2 e Z d Z d „ Z d „ Z d „ Z d „ Z RS( s² 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. c C s g | _ d S( t ConstructorN( t subscribers( R ( ( s0 /usr/lib/python2.6/site-packages/netaddr/core.pyR x s c C s_ t | d ƒ o; t t d ƒ ƒ o( | | i j o | i i | ƒ q[ n t d | ƒ ‚ d S( s Add a new subscriber. @param subscriber: a new object that implements the Subscriber object interface. R s subscriber.updates' %r does not support required interface!N( t hasattrR t evalR t appendt TypeError( R t subscriber( ( s0 /usr/lib/python2.6/site-packages/netaddr/core.pyt attach| s c C s. y | i i | ƒ Wn t j o n Xd S( s– Remove an existing subscriber. @param subscriber: a new object that implements the Subscriber object interface. N( R t removet ValueError( R R# ( ( s0 /usr/lib/python2.6/site-packages/netaddr/core.pyt detach‹ s c C s% x | i D] } | i | ƒ q Wd S( s Send update data to to all registered Subscribers. @param data: the data to be passed to each registered Subscriber. N( R R ( R R R# ( ( s0 /usr/lib/python2.6/site-packages/netaddr/core.pyt notify— s ( R R R R R$ R' R( ( ( ( s0 /usr/lib/python2.6/site-packages/netaddr/core.pyR r s t DictDotLookupc B s2 e Z d Z d „ Z d „ Z d „ Z d „ Z RS( s 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/ c C sÏ xÈ | D]À } t | | t ƒ o t | | ƒ | i |