<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import <EOL> import weakref <EOL> import operator <EOL> from . compat import threading , itertools_filterfalse <EOL> from . import py2k <EOL> import types <EOL> EMPTY_SET = frozenset ( ) <EOL> class KeyedTuple ( tuple ) : <EOL> """<STR_LIT>""" <EOL> def __new__ ( cls , vals , labels = None ) : <EOL> t = tuple . __new__ ( cls , vals ) <EOL> t . _labels = [ ] <EOL> if labels : <EOL> t . __dict__ . update ( zip ( labels , vals ) ) <EOL> t . _labels = labels <EOL> return t <EOL> def keys ( self ) : <EOL> """<STR_LIT>""" <EOL> return [ l for l in self . _labels if l is not None ] <EOL> @ property <EOL> def _fields ( self ) : <EOL> """<STR_LIT>""" <EOL> return tuple ( self . keys ( ) ) <EOL> def _asdict ( self ) : <EOL> """<STR_LIT>""" <EOL> return dict ( ( key , self . __dict__ [ key ] ) for key in self . keys ( ) ) <EOL> class ImmutableContainer ( object ) : <EOL> def _immutable ( self , * arg , ** kw ) : <EOL> raise TypeError ( "<STR_LIT>" % self . __class__ . __name__ ) <EOL> __delitem__ = __setitem__ = __setattr__ = _immutable <EOL> class immutabledict ( ImmutableContainer , dict ) : <EOL> clear = pop = popitem = setdefault = update = ImmutableContainer . _immutable <EOL> def __new__ ( cls , * args ) : <EOL> new = dict . __new__ ( cls ) <EOL> dict . __init__ ( new , * args ) <EOL> return new <EOL> def __init__ ( self , * args ) : <EOL> pass <EOL> def __reduce__ ( self ) : <EOL> return immutabledict , ( dict ( self ) , ) <EOL> def union ( self , d ) : <EOL> if not self : <EOL> return immutabledict ( d ) <EOL> else : <EOL> d2 = immutabledict ( self ) <EOL> dict . update ( d2 , d ) <EOL> return d2 <EOL> def __repr__ ( self ) : <EOL> return "<STR_LIT>" % dict . __repr__ ( self ) <EOL> class Properties ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , data ) : <EOL> self . __dict__ [ '<STR_LIT>' ] = data <EOL> def __len__ ( self ) : <EOL> return len ( self . _data ) <EOL> def __iter__ ( self ) : <EOL> return iter ( list ( self . _data . values ( ) ) ) <EOL> def __add__ ( self , other ) : <EOL> return list ( self ) + list ( other ) <EOL> def __setitem__ ( self , key , object ) : <EOL> self . _data [ key ] = object <EOL> def __getitem__ ( self , key ) : <EOL> return self . _data [ key ] <EOL> def __delitem__ ( self , key ) : <EOL> del self . _data [ key ] <EOL> def __setattr__ ( self , key , object ) : <EOL> self . _data [ key ] = object <EOL> def __getstate__ ( self ) : <EOL> return { '<STR_LIT>' : self . __dict__ [ '<STR_LIT>' ] } <EOL> def __setstate__ ( self , state ) : <EOL> self . __dict__ [ '<STR_LIT>' ] = state [ '<STR_LIT>' ] <EOL> def __getattr__ ( self , key ) : <EOL> try : <EOL> return self . _data [ key ] <EOL> except KeyError : <EOL> raise AttributeError ( key ) <EOL> def __contains__ ( self , key ) : <EOL> return key in self . _data <EOL> def as_immutable ( self ) : <EOL> """<STR_LIT>""" <EOL> return ImmutableProperties ( self . _data ) <EOL> def update ( self , value ) : <EOL> self . _data . update ( value ) <EOL> def get ( self , key , default = None ) : <EOL> if key in self : <EOL> return self [ key ] <EOL> else : <EOL> return default <EOL> def keys ( self ) : <EOL> return list ( self . _data ) <EOL> def values ( self ) : <EOL> return list ( self . _data . values ( ) ) <EOL> def items ( self ) : <EOL> return list ( self . _data . items ( ) ) <EOL> def has_key ( self , key ) : <EOL> return key in self . _data <EOL> def clear ( self ) : <EOL> self . _data . clear ( ) <EOL> class OrderedProperties ( Properties ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> Properties . __init__ ( self , OrderedDict ( ) ) <EOL> class ImmutableProperties ( ImmutableContainer , Properties ) : <EOL> """<STR_LIT>""" <EOL> class OrderedDict ( dict ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , ____sequence = None , ** kwargs ) : <EOL> self . _list = [ ] <EOL> if ____sequence is None : <EOL> if kwargs : <EOL> self . update ( ** kwargs ) <EOL> else : <EOL> self . update ( ____sequence , ** kwargs ) <EOL> def clear ( self ) : <EOL> self . _list = [ ] <EOL> dict . clear ( self ) <EOL> def copy ( self ) : <EOL> return self . __copy__ ( ) <EOL> def __copy__ ( self ) : <EOL> return OrderedDict ( self ) <EOL> def sort ( self , * arg , ** kw ) : <EOL> self . _list . sort ( * arg , ** kw ) <EOL> def update ( self , ____sequence = None , ** kwargs ) : <EOL> if ____sequence is not None : <EOL> if hasattr ( ____sequence , '<STR_LIT>' ) : <EOL> for key in ____sequence . keys ( ) : <EOL> self . __setitem__ ( key , ____sequence [ key ] ) <EOL> else : <EOL> for key , value in ____sequence : <EOL> self [ key ] = value <EOL> if kwargs : <EOL> self . update ( kwargs ) <EOL> def setdefault ( self , key , value ) : <EOL> if key not in self : <EOL> self . __setitem__ ( key , value ) <EOL> return value <EOL> else : <EOL> return self . __getitem__ ( key ) <EOL> def __iter__ ( self ) : <EOL> return iter ( self . _list ) <EOL> def keys ( self ) : <EOL> return list ( self ) <EOL> def values ( self ) : <EOL> return [ self [ key ] for key in self . _list ] <EOL> def items ( self ) : <EOL> return [ ( key , self [ key ] ) for key in self . _list ] <EOL> if py2k : <EOL> def itervalues ( self ) : <EOL> return iter ( self . values ( ) ) <EOL> def iterkeys ( self ) : <EOL> return iter ( self ) <EOL> def iteritems ( self ) : <EOL> return iter ( self . items ( ) ) <EOL> def __setitem__ ( self , key , object ) : <EOL> if key not in self : <EOL> try : <EOL> self . _list . append ( key ) <EOL> except AttributeError : <EOL> self . _list = [ key ] <EOL> dict . __setitem__ ( self , key , object ) <EOL> def __delitem__ ( self , key ) : <EOL> dict . __delitem__ ( self , key ) <EOL> self . _list . remove ( key ) <EOL> def pop ( self , key , * default ) : <EOL> present = key in self <EOL> value = dict . pop ( self , key , * default ) <EOL> if present : <EOL> self . _list . remove ( key ) <EOL> return value <EOL> def popitem ( self ) : <EOL> item = dict . popitem ( self ) <EOL> self . _list . remove ( item [ <NUM_LIT:0> ] ) <EOL> return item <EOL> class OrderedSet ( set ) : <EOL> def __init__ ( self , d = None ) : <EOL> set . __init__ ( self ) <EOL> self . _list = [ ] <EOL> if d is not None : <EOL> self . update ( d ) <EOL> def add ( self , element ) : <EOL> if element not in self : <EOL> self . _list . append ( element ) <EOL> set . add ( self , element ) <EOL> def remove ( self , element ) : <EOL> set . remove ( self , element ) <EOL> self . _list . remove ( element ) <EOL> def insert ( self , pos , element ) : <EOL> if element not in self : <EOL> self . _list . insert ( pos , element ) <EOL> set . add ( self , element ) <EOL> def discard ( self , element ) : <EOL> if element in self : <EOL> self . _list . remove ( element ) <EOL> set . remove ( self , element ) <EOL> def clear ( self ) : <EOL> set . clear ( self ) <EOL> self . _list = [ ] <EOL> def __getitem__ ( self , key ) : <EOL> return self . _list [ key ] <EOL> def __iter__ ( self ) : <EOL> return iter ( self . _list ) <EOL> def __add__ ( self , other ) : <EOL> return self . union ( other ) <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % ( self . __class__ . __name__ , self . _list ) <EOL> __str__ = __repr__ <EOL> def update ( self , iterable ) : <EOL> for e in iterable : <EOL> if e not in self : <EOL> self . _list . append ( e ) <EOL> set . add ( self , e ) <EOL> return self <EOL> __ior__ = update <EOL> def union ( self , other ) : <EOL> result = self . __class__ ( self ) <EOL> result . update ( other ) <EOL> return result <EOL> __or__ = union <EOL> def intersection ( self , other ) : <EOL> other = set ( other ) <EOL> return self . __class__ ( a for a in self if a in other ) <EOL> __and__ = intersection <EOL> def symmetric_difference ( self , other ) : <EOL> other = set ( other ) <EOL> result = self . __class__ ( a for a in self if a not in other ) <EOL> result . update ( a for a in other if a not in self ) <EOL> return result <EOL> __xor__ = symmetric_difference <EOL> def difference ( self , other ) : <EOL> other = set ( other ) <EOL> return self . __class__ ( a for a in self if a not in other ) <EOL> __sub__ = difference <EOL> def intersection_update ( self , other ) : <EOL> other = set ( other ) <EOL> set . intersection_update ( self , other ) <EOL> self . _list = [ a for a in self . _list if a in other ] <EOL> return self <EOL> __iand__ = intersection_update <EOL> def symmetric_difference_update ( self , other ) : <EOL> set . symmetric_difference_update ( self , other ) <EOL> self . _list = [ a for a in self . _list if a in self ] <EOL> self . _list += [ a for a in other . _list if a in self ] <EOL> return self <EOL> __ixor__ = symmetric_difference_update <EOL> def difference_update ( self , other ) : <EOL> set . difference_update ( self , other ) <EOL> self . _list = [ a for a in self . _list if a in self ] <EOL> return self <EOL> __isub__ = difference_update <EOL> class IdentitySet ( object ) : <EOL> """<STR_LIT>""" <EOL> _working_set = set <EOL> def __init__ ( self , iterable = None ) : <EOL> self . _members = dict ( ) <EOL> if iterable : <EOL> for o in iterable : <EOL> self . add ( o ) <EOL> def add ( self , value ) : <EOL> self . _members [ id ( value ) ] = value <EOL> def __contains__ ( self , value ) : <EOL> return id ( value ) in self . _members <EOL> def remove ( self , value ) : <EOL> del self . _members [ id ( value ) ] <EOL> def discard ( self , value ) : <EOL> try : <EOL> self . remove ( value ) <EOL> except KeyError : <EOL> pass <EOL> def pop ( self ) : <EOL> try : <EOL> pair = self . _members . popitem ( ) <EOL> return pair [ <NUM_LIT:1> ] <EOL> except KeyError : <EOL> raise KeyError ( '<STR_LIT>' ) <EOL> def clear ( self ) : <EOL> self . _members . clear ( ) <EOL> def __cmp__ ( self , other ) : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> def __eq__ ( self , other ) : <EOL> if isinstance ( other , IdentitySet ) : <EOL> return self . _members == other . _members <EOL> else : <EOL> return False <EOL> def __ne__ ( self , other ) : <EOL> if isinstance ( other , IdentitySet ) : <EOL> return self . _members != other . _members <EOL> else : <EOL> return True <EOL> def issubset ( self , iterable ) : <EOL> other = type ( self ) ( iterable ) <EOL> if len ( self ) > len ( other ) : <EOL> return False <EOL> for m in itertools_filterfalse ( other . _members . __contains__ , <EOL> iter ( self . _members . keys ( ) ) ) : <EOL> return False <EOL> return True <EOL> def __le__ ( self , other ) : <EOL> if not isinstance ( other , IdentitySet ) : <EOL> return NotImplemented <EOL> return self . issubset ( other ) <EOL> def __lt__ ( self , other ) : <EOL> if not isinstance ( other , IdentitySet ) : <EOL> return NotImplemented <EOL> return len ( self ) < len ( other ) and self . issubset ( other ) <EOL> def issuperset ( self , iterable ) : <EOL> other = type ( self ) ( iterable ) <EOL> if len ( self ) < len ( other ) : <EOL> return False <EOL> for m in itertools_filterfalse ( self . _members . __contains__ , <EOL> iter ( other . _members . keys ( ) ) ) : <EOL> return False <EOL> return True <EOL> def __ge__ ( self , other ) : <EOL> if not isinstance ( other , IdentitySet ) : <EOL> return NotImplemented <EOL> return self . issuperset ( other ) <EOL> def __gt__ ( self , other ) : <EOL> if not isinstance ( other , IdentitySet ) : <EOL> return NotImplemented <EOL> return len ( self ) > len ( other ) and self . issuperset ( other ) <EOL> def union ( self , iterable ) : <EOL> result = type ( self ) ( ) <EOL> members = self . _member_id_tuples ( ) <EOL> other = _iter_id ( iterable ) <EOL> result . _members . update ( self . _working_set ( members ) . union ( other ) ) <EOL> return result <EOL> def __or__ ( self , other ) : <EOL> if not isinstance ( other , IdentitySet ) : <EOL> return NotImplemented <EOL> return self . union ( other ) <EOL> def update ( self , iterable ) : <EOL> self . _members = self . union ( iterable ) . _members <EOL> def __ior__ ( self , other ) : <EOL> if not isinstance ( other , IdentitySet ) : <EOL> return NotImplemented <EOL> self . update ( other ) <EOL> return self <EOL> def difference ( self , iterable ) : <EOL> result = type ( self ) ( ) <EOL> members = self . _member_id_tuples ( ) <EOL> other = _iter_id ( iterable ) <EOL> result . _members . update ( self . _working_set ( members ) . difference ( other ) ) <EOL> return result <EOL> def __sub__ ( self , other ) : <EOL> if not isinstance ( other , IdentitySet ) : <EOL> return NotImplemented <EOL> return self . difference ( other ) <EOL> def difference_update ( self , iterable ) : <EOL> self . _members = self . difference ( iterable ) . _members <EOL> def __isub__ ( self , other ) : <EOL> if not isinstance ( other , IdentitySet ) : <EOL> return NotImplemented <EOL> self . difference_update ( other ) <EOL> return self <EOL> def intersection ( self , iterable ) : <EOL> result = type ( self ) ( ) <EOL> members = self . _member_id_tuples ( ) <EOL> other = _iter_id ( iterable ) <EOL> result . _members . update ( self . _working_set ( members ) . intersection ( other ) ) <EOL> return result <EOL> def __and__ ( self , other ) : <EOL> if not isinstance ( other , IdentitySet ) : <EOL> return NotImplemented <EOL> return self . intersection ( other ) <EOL> def intersection_update ( self , iterable ) : <EOL> self . _members = self . intersection ( iterable ) . _members <EOL> def __iand__ ( self , other ) : <EOL> if not isinstance ( other , IdentitySet ) : <EOL> return NotImplemented <EOL> self . intersection_update ( other ) <EOL> return self <EOL> def symmetric_difference ( self , iterable ) : <EOL> result = type ( self ) ( ) <EOL> members = self . _member_id_tuples ( ) <EOL> other = _iter_id ( iterable ) <EOL> result . _members . update ( <EOL> self . _working_set ( members ) . symmetric_difference ( other ) ) <EOL> return result <EOL> def _member_id_tuples ( self ) : <EOL> return ( ( id ( v ) , v ) for v in self . _members . values ( ) ) <EOL> def __xor__ ( self , other ) : <EOL> if not isinstance ( other , IdentitySet ) : <EOL> return NotImplemented <EOL> return self . symmetric_difference ( other ) <EOL> def symmetric_difference_update ( self , iterable ) : <EOL> self . _members = self . symmetric_difference ( iterable ) . _members <EOL> def __ixor__ ( self , other ) : <EOL> if not isinstance ( other , IdentitySet ) : <EOL> return NotImplemented <EOL> self . symmetric_difference ( other ) <EOL> return self <EOL> def copy ( self ) : <EOL> return type ( self ) ( iter ( self . _members . values ( ) ) ) <EOL> __copy__ = copy <EOL> def __len__ ( self ) : <EOL> return len ( self . _members ) <EOL> def __iter__ ( self ) : <EOL> return iter ( self . _members . values ( ) ) <EOL> def __hash__ ( self ) : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % ( type ( self ) . __name__ , list ( self . _members . values ( ) ) ) <EOL> class WeakSequence ( object ) : <EOL> def __init__ ( self , __elements = ( ) ) : <EOL> self . _storage = [ <EOL> weakref . ref ( element , self . _remove ) for element in __elements <EOL> ] <EOL> def append ( self , item ) : <EOL> self . _storage . append ( weakref . ref ( item , self . _remove ) ) <EOL> def _remove ( self , ref ) : <EOL> self . _storage . remove ( ref ) <EOL> def __len__ ( self ) : <EOL> return len ( self . _storage ) <EOL> def __iter__ ( self ) : <EOL> return ( obj for obj in <EOL> ( ref ( ) for ref in self . _storage ) if obj is not None ) <EOL> def __getitem__ ( self , index ) : <EOL> try : <EOL> obj = self . _storage [ index ] <EOL> except KeyError : <EOL> raise IndexError ( "<STR_LIT>" % index ) <EOL> else : <EOL> return obj ( ) <EOL> class OrderedIdentitySet ( IdentitySet ) : <EOL> class _working_set ( OrderedSet ) : <EOL> __sa_hash_exempt__ = True <EOL> def __init__ ( self , iterable = None ) : <EOL> IdentitySet . __init__ ( self ) <EOL> self . _members = OrderedDict ( ) <EOL> if iterable : <EOL> for o in iterable : <EOL> self . add ( o ) <EOL> class PopulateDict ( dict ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , creator ) : <EOL> self . creator = creator <EOL> def __missing__ ( self , key ) : <EOL> self [ key ] = val = self . creator ( key ) <EOL> return val <EOL> column_set = set <EOL> column_dict = dict <EOL> ordered_column_set = OrderedSet <EOL> populate_column_dict = PopulateDict <EOL> def unique_list ( seq , hashfunc = None ) : <EOL> seen = { } <EOL> if not hashfunc : <EOL> return [ x for x in seq <EOL> if x not in seen <EOL> and not seen . __setitem__ ( x , True ) ] <EOL> else : <EOL> return [ x for x in seq <EOL> if hashfunc ( x ) not in seen <EOL> and not seen . __setitem__ ( hashfunc ( x ) , True ) ] <EOL> class UniqueAppender ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , data , via = None ) : <EOL> self . data = data <EOL> self . _unique = { } <EOL> if via : <EOL> self . _data_appender = getattr ( data , via ) <EOL> elif hasattr ( data , '<STR_LIT>' ) : <EOL> self . _data_appender = data . append <EOL> elif hasattr ( data , '<STR_LIT>' ) : <EOL> self . _data_appender = data . add <EOL> def append ( self , item ) : <EOL> id_ = id ( item ) <EOL> if id_ not in self . _unique : <EOL> self . _data_appender ( item ) <EOL> self . _unique [ id_ ] = True <EOL> def __iter__ ( self ) : <EOL> return iter ( self . data ) <EOL> def coerce_generator_arg ( arg ) : <EOL> if len ( arg ) == <NUM_LIT:1> and isinstance ( arg [ <NUM_LIT:0> ] , types . GeneratorType ) : <EOL> return list ( arg [ <NUM_LIT:0> ] ) <EOL> else : <EOL> return arg <EOL> def to_list ( x , default = None ) : <EOL> if x is None : <EOL> return default <EOL> if not isinstance ( x , ( list , tuple ) ) : <EOL> return [ x ] <EOL> else : <EOL> return x <EOL> def to_set ( x ) : <EOL> if x is None : <EOL> return set ( ) <EOL> if not isinstance ( x , set ) : <EOL> return set ( to_list ( x ) ) <EOL> else : <EOL> return x <EOL> def to_column_set ( x ) : <EOL> if x is None : <EOL> return column_set ( ) <EOL> if not isinstance ( x , column_set ) : <EOL> return column_set ( to_list ( x ) ) <EOL> else : <EOL> return x <EOL> def update_copy ( d , _new = None , ** kw ) : <EOL> """<STR_LIT>""" <EOL> d = d . copy ( ) <EOL> if _new : <EOL> d . update ( _new ) <EOL> d . update ( ** kw ) <EOL> return d <EOL> def flatten_iterator ( x ) : <EOL> """<STR_LIT>""" <EOL> for elem in x : <EOL> if not isinstance ( elem , str ) and hasattr ( elem , '<STR_LIT>' ) : <EOL> for y in flatten_iterator ( elem ) : <EOL> yield y <EOL> else : <EOL> yield elem <EOL> class LRUCache ( dict ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , capacity = <NUM_LIT:100> , threshold = <NUM_LIT> ) : <EOL> self . capacity = capacity <EOL> self . threshold = threshold <EOL> self . _counter = <NUM_LIT:0> <EOL> def _inc_counter ( self ) : <EOL> self . _counter += <NUM_LIT:1> <EOL> return self . _counter <EOL> def __getitem__ ( self , key ) : <EOL> item = dict . __getitem__ ( self , key ) <EOL> item [ <NUM_LIT:2> ] = self . _inc_counter ( ) <EOL> return item [ <NUM_LIT:1> ] <EOL> def values ( self ) : <EOL> return [ i [ <NUM_LIT:1> ] for i in dict . values ( self ) ] <EOL> def setdefault ( self , key , value ) : <EOL> if key in self : <EOL> return self [ key ] <EOL> else : <EOL> self [ key ] = value <EOL> return value <EOL> def __setitem__ ( self , key , value ) : <EOL> item = dict . get ( self , key ) <EOL> if item is None : <EOL> item = [ key , value , self . _inc_counter ( ) ] <EOL> dict . __setitem__ ( self , key , item ) <EOL> else : <EOL> item [ <NUM_LIT:1> ] = value <EOL> self . _manage_size ( ) <EOL> def _manage_size ( self ) : <EOL> while len ( self ) > self . capacity + self . capacity * self . threshold : <EOL> by_counter = sorted ( dict . values ( self ) , <EOL> key = operator . itemgetter ( <NUM_LIT:2> ) , <EOL> reverse = True ) <EOL> for item in by_counter [ self . capacity : ] : <EOL> try : <EOL> del self [ item [ <NUM_LIT:0> ] ] <EOL> except KeyError : <EOL> break <EOL> class ScopedRegistry ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , createfunc , scopefunc ) : <EOL> """<STR_LIT>""" <EOL> self . createfunc = createfunc <EOL> self . scopefunc = scopefunc <EOL> self . registry = { } <EOL> def __call__ ( self ) : <EOL> key = self . scopefunc ( ) <EOL> try : <EOL> return self . registry [ key ] <EOL> except KeyError : <EOL> return self . registry . setdefault ( key , self . createfunc ( ) ) <EOL> def has ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . scopefunc ( ) in self . registry <EOL> def set ( self , obj ) : <EOL> """<STR_LIT>""" <EOL> self . registry [ self . scopefunc ( ) ] = obj <EOL> def clear ( self ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> del self . registry [ self . scopefunc ( ) ] <EOL> except KeyError : <EOL> pass <EOL> class ThreadLocalRegistry ( ScopedRegistry ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , createfunc ) : <EOL> self . createfunc = createfunc <EOL> self . registry = threading . local ( ) <EOL> def __call__ ( self ) : <EOL> try : <EOL> return self . registry . value <EOL> except AttributeError : <EOL> val = self . registry . value = self . createfunc ( ) <EOL> return val <EOL> def has ( self ) : <EOL> return hasattr ( self . registry , "<STR_LIT:value>" ) <EOL> def set ( self , obj ) : <EOL> self . registry . value = obj <EOL> def clear ( self ) : <EOL> try : <EOL> del self . registry . value <EOL> except AttributeError : <EOL> pass <EOL> def _iter_id ( iterable ) : <EOL> """<STR_LIT>""" <EOL> for item in iterable : <EOL> yield id ( item ) , item </s>
