<s> """<STR_LIT>""" <EOL> import sys <EOL> from gitdb . utils . compat import ( <EOL> PY3 , <EOL> xrange , <EOL> MAXSIZE , <EOL> izip , <EOL> ) <EOL> from gitdb . utils . encoding import ( <EOL> string_types , <EOL> text_type , <EOL> force_bytes , <EOL> force_text <EOL> ) <EOL> defenc = sys . getdefaultencoding ( ) <EOL> if PY3 : <EOL> import io <EOL> FileType = io . IOBase <EOL> def byte_ord ( b ) : <EOL> return b <EOL> def bchr ( n ) : <EOL> return bytes ( [ n ] ) <EOL> def mviter ( d ) : <EOL> return d . values ( ) <EOL> range = xrange <EOL> unicode = str <EOL> else : <EOL> FileType = file <EOL> if defenc == '<STR_LIT:ascii>' : <EOL> defenc = '<STR_LIT:utf-8>' <EOL> byte_ord = ord <EOL> bchr = chr <EOL> unicode = unicode <EOL> range = xrange <EOL> def mviter ( d ) : <EOL> return d . itervalues ( ) <EOL> def safe_decode ( s ) : <EOL> """<STR_LIT>""" <EOL> if isinstance ( s , unicode ) : <EOL> return s <EOL> elif isinstance ( s , bytes ) : <EOL> return s . decode ( defenc , errors = '<STR_LIT:replace>' ) <EOL> raise TypeError ( '<STR_LIT>' % ( s , ) ) <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 , nbases , d ) : <EOL> if nbases is None : <EOL> return type . __new__ ( cls , name , ( ) , d ) <EOL> if not PY3 and '<STR_LIT>' not in d : <EOL> d [ '<STR_LIT>' ] = meta <EOL> return meta ( name , bases , d ) <EOL> return metaclass ( meta . __name__ + '<STR_LIT>' , None , { } ) </s>
