<s> """<STR_LIT>""" <EOL> import types <EOL> import sys <EOL> import numbers <EOL> import functools <EOL> import copy <EOL> import inspect <EOL> PY3 = sys . version_info [ <NUM_LIT:0> ] == <NUM_LIT:3> <EOL> PY2 = sys . version_info [ <NUM_LIT:0> ] == <NUM_LIT:2> <EOL> PY26 = sys . version_info [ <NUM_LIT:0> : <NUM_LIT:2> ] == ( <NUM_LIT:2> , <NUM_LIT:6> ) <EOL> PY27 = sys . version_info [ <NUM_LIT:0> : <NUM_LIT:2> ] == ( <NUM_LIT:2> , <NUM_LIT:7> ) <EOL> PYPY = hasattr ( sys , '<STR_LIT>' ) <EOL> def python_2_unicode_compatible ( cls ) : <EOL> """<STR_LIT>""" <EOL> if not PY3 : <EOL> cls . __unicode__ = cls . __str__ <EOL> cls . __str__ = lambda self : self . __unicode__ ( ) . encode ( '<STR_LIT:utf-8>' ) <EOL> return cls <EOL> def with_metaclass ( meta , * bases ) : <EOL> """<STR_LIT>""" <EOL> class metaclass ( meta ) : <EOL> __call__ = type . __call__ <EOL> __init__ = type . __init__ <EOL> def __new__ ( cls , name , this_bases , d ) : <EOL> if this_bases is None : <EOL> return type . __new__ ( cls , name , ( ) , d ) <EOL> return meta ( name , bases , d ) <EOL> return metaclass ( '<STR_LIT>' , None , { } ) <EOL> if PY3 : <EOL> def bchr ( s ) : <EOL> return bytes ( [ s ] ) <EOL> def bstr ( s ) : <EOL> if isinstance ( s , str ) : <EOL> return bytes ( s , '<STR_LIT>' ) <EOL> else : <EOL> return bytes ( s ) <EOL> def bord ( s ) : <EOL> return s <EOL> string_types = str , <EOL> integer_types = int , <EOL> class_types = type , <EOL> text_type = str <EOL> binary_type = bytes <EOL> else : <EOL> def bchr ( s ) : <EOL> return chr ( s ) <EOL> def bstr ( s ) : <EOL> return str ( s ) <EOL> def bord ( s ) : <EOL> return ord ( s ) <EOL> string_types = basestring , <EOL> integer_types = ( int , long ) <EOL> class_types = ( type , types . ClassType ) <EOL> text_type = unicode <EOL> binary_type = str <EOL> if PY3 : <EOL> def tobytes ( s ) : <EOL> if isinstance ( s , bytes ) : <EOL> return s <EOL> else : <EOL> if isinstance ( s , str ) : <EOL> return s . encode ( '<STR_LIT>' ) <EOL> else : <EOL> return bytes ( s ) <EOL> else : <EOL> def tobytes ( s ) : <EOL> if isinstance ( s , unicode ) : <EOL> return s . encode ( '<STR_LIT>' ) <EOL> else : <EOL> return '<STR_LIT>' . join ( s ) <EOL> tobytes . __doc__ = """<STR_LIT>""" <EOL> if PY3 : <EOL> def native_str_to_bytes ( s , encoding = '<STR_LIT:utf-8>' ) : <EOL> return s . encode ( encoding ) <EOL> def bytes_to_native_str ( b , encoding = '<STR_LIT:utf-8>' ) : <EOL> return b . decode ( encoding ) <EOL> def text_to_native_str ( t , encoding = None ) : <EOL> return t <EOL> else : <EOL> def native_str_to_bytes ( s , encoding = None ) : <EOL> from future . types import newbytes <EOL> return newbytes ( s ) <EOL> def bytes_to_native_str ( b , encoding = None ) : <EOL> return native ( b ) <EOL> def text_to_native_str ( t , encoding = '<STR_LIT:ascii>' ) : <EOL> """<STR_LIT>""" <EOL> return unicode ( t ) . encode ( encoding ) <EOL> native_str_to_bytes . __doc__ = """<STR_LIT>""" <EOL> if PY3 : <EOL> def lrange ( * args , ** kwargs ) : <EOL> return list ( range ( * args , ** kwargs ) ) <EOL> def lzip ( * args , ** kwargs ) : <EOL> return list ( zip ( * args , ** kwargs ) ) <EOL> def lmap ( * args , ** kwargs ) : <EOL> return list ( map ( * args , ** kwargs ) ) <EOL> def lfilter ( * args , ** kwargs ) : <EOL> return list ( filter ( * args , ** kwargs ) ) <EOL> else : <EOL> import __builtin__ <EOL> lrange = __builtin__ . range <EOL> lzip = __builtin__ . zip <EOL> lmap = __builtin__ . map <EOL> lfilter = __builtin__ . filter <EOL> def isidentifier ( s , dotted = False ) : <EOL> '''<STR_LIT>''' <EOL> if dotted : <EOL> return all ( isidentifier ( a ) for a in s . split ( '<STR_LIT:.>' ) ) <EOL> if PY3 : <EOL> return s . isidentifier ( ) <EOL> else : <EOL> import re <EOL> _name_re = re . compile ( r"<STR_LIT>" ) <EOL> return bool ( _name_re . match ( s ) ) <EOL> def viewitems ( obj , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> func = getattr ( obj , "<STR_LIT>" , None ) <EOL> if not func : <EOL> func = obj . items <EOL> return func ( ** kwargs ) <EOL> def viewkeys ( obj , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> func = getattr ( obj , "<STR_LIT>" , None ) <EOL> if not func : <EOL> func = obj . keys <EOL> return func ( ** kwargs ) <EOL> def viewvalues ( obj , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> func = getattr ( obj , "<STR_LIT>" , None ) <EOL> if not func : <EOL> func = obj . values <EOL> return func ( ** kwargs ) <EOL> def iteritems ( obj , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> func = getattr ( obj , "<STR_LIT>" , None ) <EOL> if not func : <EOL> func = obj . items <EOL> return func ( ** kwargs ) <EOL> def iterkeys ( obj , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> func = getattr ( obj , "<STR_LIT>" , None ) <EOL> if not func : <EOL> func = obj . keys <EOL> return func ( ** kwargs ) <EOL> def itervalues ( obj , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> func = getattr ( obj , "<STR_LIT>" , None ) <EOL> if not func : <EOL> func = obj . values <EOL> return func ( ** kwargs ) <EOL> def bind_method ( cls , name , func ) : <EOL> """<STR_LIT>""" <EOL> if not PY3 : <EOL> setattr ( cls , name , types . MethodType ( func , None , cls ) ) <EOL> else : <EOL> setattr ( cls , name , func ) <EOL> def getexception ( ) : <EOL> return sys . exc_info ( ) [ <NUM_LIT:1> ] <EOL> def _get_caller_globals_and_locals ( ) : <EOL> """<STR_LIT>""" <EOL> caller_frame = inspect . stack ( ) [ <NUM_LIT:2> ] <EOL> myglobals = caller_frame [ <NUM_LIT:0> ] . f_globals <EOL> mylocals = caller_frame [ <NUM_LIT:0> ] . f_locals <EOL> return myglobals , mylocals <EOL> def _repr_strip ( mystring ) : <EOL> """<STR_LIT>""" <EOL> r = repr ( mystring ) <EOL> if r . startswith ( "<STR_LIT:'>" ) and r . endswith ( "<STR_LIT:'>" ) : <EOL> return r [ <NUM_LIT:1> : - <NUM_LIT:1> ] <EOL> else : <EOL> return r <EOL> if PY3 : <EOL> def raise_from ( exc , cause ) : <EOL> """<STR_LIT>""" <EOL> if isinstance ( exc , type ) and issubclass ( exc , Exception ) : <EOL> exc = exc . __name__ <EOL> if isinstance ( cause , type ) and issubclass ( cause , Exception ) : <EOL> cause = cause . __name__ <EOL> execstr = "<STR_LIT>" + _repr_strip ( exc ) + "<STR_LIT>" + _repr_strip ( cause ) <EOL> myglobals , mylocals = _get_caller_globals_and_locals ( ) <EOL> exec ( execstr , myglobals , mylocals ) <EOL> def raise_ ( tp , value = None , tb = None ) : <EOL> """<STR_LIT>""" <EOL> if value is not None and isinstance ( tp , Exception ) : <EOL> raise TypeError ( "<STR_LIT>" ) <EOL> if value is not None : <EOL> exc = tp ( value ) <EOL> else : <EOL> exc = tp <EOL> if exc . __traceback__ is not tb : <EOL> raise exc . with_traceback ( tb ) <EOL> raise exc <EOL> def raise_with_traceback ( exc , traceback = Ellipsis ) : <EOL> if traceback == Ellipsis : <EOL> _ , _ , traceback = sys . exc_info ( ) <EOL> raise exc . with_traceback ( traceback ) <EOL> else : <EOL> def raise_from ( exc , cause ) : <EOL> """<STR_LIT>""" <EOL> if isinstance ( exc , type ) and issubclass ( exc , Exception ) : <EOL> e = exc ( ) <EOL> else : <EOL> e = exc <EOL> e . __suppress_context__ = False <EOL> if isinstance ( cause , type ) and issubclass ( cause , Exception ) : <EOL> e . __cause__ = cause ( ) <EOL> e . __suppress_context__ = True <EOL> elif cause is None : <EOL> e . __cause__ = None <EOL> e . __suppress_context__ = True <EOL> elif isinstance ( cause , BaseException ) : <EOL> e . __cause__ = cause <EOL> e . __suppress_context__ = True <EOL> else : <EOL> raise TypeError ( "<STR_LIT>" ) <EOL> e . __context__ = sys . exc_info ( ) [ <NUM_LIT:1> ] <EOL> raise e <EOL> exec ( '''<STR_LIT>''' . strip ( ) ) <EOL> raise_with_traceback . __doc__ = ( <EOL> """<STR_LIT>""" <EOL> ) <EOL> reraise = raise_ <EOL> def implements_iterator ( cls ) : <EOL> '''<STR_LIT>''' <EOL> if PY3 : <EOL> return cls <EOL> else : <EOL> cls . next = cls . __next__ <EOL> del cls . __next__ <EOL> return cls <EOL> if PY3 : <EOL> get_next = lambda x : x . next <EOL> else : <EOL> get_next = lambda x : x . __next__ <EOL> def encode_filename ( filename ) : <EOL> if PY3 : <EOL> return filename <EOL> else : <EOL> if isinstance ( filename , unicode ) : <EOL> return filename . encode ( '<STR_LIT:utf-8>' ) <EOL> return filename <EOL> def is_new_style ( cls ) : <EOL> """<STR_LIT>""" <EOL> return hasattr ( cls , '<STR_LIT>' ) and ( '<STR_LIT>' in dir ( cls ) <EOL> or hasattr ( cls , '<STR_LIT>' ) ) <EOL> native_str = str <EOL> native_bytes = bytes <EOL> def istext ( obj ) : <EOL> """<STR_LIT>""" <EOL> return isinstance ( obj , type ( u'<STR_LIT>' ) ) <EOL> def isbytes ( obj ) : <EOL> """<STR_LIT>""" <EOL> return isinstance ( obj , type ( b'<STR_LIT>' ) ) <EOL> def isnewbytes ( obj ) : <EOL> """<STR_LIT>""" <EOL> from future . types . newbytes import newbytes <EOL> return type ( obj ) == newbytes <EOL> def isint ( obj ) : <EOL> """<STR_LIT>""" <EOL> return isinstance ( obj , numbers . Integral ) <EOL> def native ( obj ) : <EOL> """<STR_LIT>""" <EOL> if hasattr ( obj , '<STR_LIT>' ) : <EOL> return obj . __native__ ( ) <EOL> else : <EOL> return obj <EOL> if PY3 : <EOL> import builtins <EOL> exec_ = getattr ( builtins , "<STR_LIT>" ) <EOL> else : <EOL> def exec_ ( code , globs = None , locs = None ) : <EOL> """<STR_LIT>""" <EOL> if globs is None : <EOL> frame = sys . _getframe ( <NUM_LIT:1> ) <EOL> globs = frame . f_globals <EOL> if locs is None : <EOL> locs = frame . f_locals <EOL> del frame <EOL> elif locs is None : <EOL> locs = globs <EOL> exec ( """<STR_LIT>""" ) <EOL> def old_div ( a , b ) : <EOL> """<STR_LIT>""" <EOL> if isinstance ( a , numbers . Integral ) and isinstance ( b , numbers . Integral ) : <EOL> return a // b <EOL> else : <EOL> return a / b <EOL> def as_native_str ( encoding = '<STR_LIT:utf-8>' ) : <EOL> '''<STR_LIT>''' <EOL> if PY3 : <EOL> return lambda f : f <EOL> else : <EOL> def encoder ( f ) : <EOL> @ functools . wraps ( f ) <EOL> def wrapper ( * args , ** kwargs ) : <EOL> return f ( * args , ** kwargs ) . encode ( encoding = encoding ) <EOL> return wrapper <EOL> return encoder <EOL> try : <EOL> dict . iteritems <EOL> except AttributeError : <EOL> def listvalues ( d ) : <EOL> return list ( d . values ( ) ) <EOL> def listitems ( d ) : <EOL> return list ( d . items ( ) ) <EOL> else : <EOL> def listvalues ( d ) : <EOL> return d . values ( ) <EOL> def listitems ( d ) : <EOL> return d . items ( ) <EOL> if PY3 : <EOL> def ensure_new_type ( obj ) : <EOL> return obj <EOL> else : <EOL> def ensure_new_type ( obj ) : <EOL> from future . types . newbytes import newbytes <EOL> from future . types . newstr import newstr <EOL> from future . types . newint import newint <EOL> from future . types . newdict import newdict <EOL> native_type = type ( native ( obj ) ) <EOL> if issubclass ( native_type , type ( obj ) ) : <EOL> if native_type == str : <EOL> return newbytes ( obj ) <EOL> elif native_type == unicode : <EOL> return newstr ( obj ) <EOL> elif native_type == int : <EOL> return newint ( obj ) <EOL> elif native_type == long : <EOL> return newint ( obj ) <EOL> elif native_type == dict : <EOL> return newdict ( obj ) <EOL> else : <EOL> return NotImplementedError ( '<STR_LIT>' % type ( obj ) ) <EOL> else : <EOL> assert type ( obj ) in [ newbytes , newstr ] <EOL> return obj <EOL> __all__ = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] </s>
