<s> """<STR_LIT>""" <EOL> import sys <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> PYPY = hasattr ( sys , '<STR_LIT>' ) <EOL> _identity = lambda x : x <EOL> if not PY2 : <EOL> unichr = chr <EOL> range = range <EOL> string_types = ( str , ) <EOL> iterkeys = lambda d : iter ( d . keys ( ) ) <EOL> itervalues = lambda d : iter ( d . values ( ) ) <EOL> iteritems = lambda d : iter ( d . items ( ) ) <EOL> import pickle <EOL> def reraise ( tp , value , tb = None ) : <EOL> if value . __traceback__ is not tb : <EOL> raise value . with_traceback ( tb ) <EOL> raise value <EOL> implements_iterator = _identity <EOL> python_2_unicode_compatible = _identity <EOL> ifilter = filter <EOL> imap = map <EOL> izip = zip <EOL> def u ( s , encoding = '<STR_LIT:utf8>' ) : <EOL> if isinstance ( s , str ) : <EOL> return s <EOL> else : <EOL> return str ( s ) <EOL> def b ( s ) : <EOL> if isinstance ( s , bytes ) : <EOL> return s <EOL> else : <EOL> if isinstance ( s , str ) : <EOL> return s . encode ( encoding ) <EOL> else : <EOL> return bytes ( s ) <EOL> import builtins <EOL> exec_ = getattr ( builtins , "<STR_LIT>" ) <EOL> get_next = lambda x : x . next <EOL> input = input <EOL> open = open <EOL> else : <EOL> unichr = unichr <EOL> range = xrange <EOL> string_types = ( str , unicode ) <EOL> iterkeys = lambda d : d . iterkeys ( ) <EOL> itervalues = lambda d : d . itervalues ( ) <EOL> iteritems = lambda d : d . iteritems ( ) <EOL> import cPickle as pickle <EOL> from io import BytesIO , StringIO <EOL> exec ( '<STR_LIT>' ) <EOL> from itertools import imap , izip , ifilter <EOL> def implements_iterator ( cls ) : <EOL> cls . next = cls . __next__ <EOL> del cls . __next__ <EOL> return cls <EOL> def python_2_unicode_compatible ( cls ) : <EOL> cls . __unicode__ = cls . __str__ <EOL> cls . __str__ = lambda x : x . __unicode__ ( ) . encode ( '<STR_LIT:utf-8>' ) <EOL> return cls <EOL> def u ( s , encoding = '<STR_LIT:utf8>' ) : <EOL> if isinstance ( s , unicode ) : <EOL> return s <EOL> else : <EOL> return unicode ( str ( s ) , encoding ) <EOL> def b ( s , encoding = '<STR_LIT:utf8>' ) : <EOL> if isinstance ( s , unicode ) : <EOL> return s . decode ( encoding ) <EOL> else : <EOL> return str ( s ) <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> get_next = lambda x : x . __next__ <EOL> input = raw_input <EOL> from io import open <EOL> try : <EOL> next = next <EOL> except NameError : <EOL> def next ( it ) : <EOL> return it . next ( ) <EOL> def with_metaclass ( meta , * bases ) : <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> modules_mapping = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ '<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>' : [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> def import_ ( module , objects = None , via = None ) : <EOL> """<STR_LIT>""" <EOL> if PY3 : <EOL> mod = __import__ ( module , fromlist = [ '<STR_LIT:*>' ] ) <EOL> else : <EOL> path = modules_mapping . get ( module ) <EOL> if not path : <EOL> raise Exception ( "<STR_LIT>" % module ) <EOL> if isinstance ( path , list ) : <EOL> if not via : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> path = via <EOL> mod = __import__ ( path , fromlist = [ '<STR_LIT:*>' ] ) <EOL> if objects : <EOL> if not isinstance ( objects , ( list , tuple ) ) : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> r = [ ] <EOL> for x in objects : <EOL> r . append ( getattr ( mod , x ) ) <EOL> if len ( r ) > <NUM_LIT:1> : <EOL> return tuple ( r ) <EOL> else : <EOL> return r [ <NUM_LIT:0> ] <EOL> else : <EOL> return mod </s>
