<s> """<STR_LIT>""" <EOL> import codecs <EOL> def encode ( input , errors = '<STR_LIT:strict>' ) : <EOL> return ( codecs . BOM_UTF8 + codecs . utf_8_encode ( input , errors ) [ <NUM_LIT:0> ] , len ( input ) ) <EOL> def decode ( input , errors = '<STR_LIT:strict>' ) : <EOL> prefix = <NUM_LIT:0> <EOL> if input [ : <NUM_LIT:3> ] == codecs . BOM_UTF8 : <EOL> input = input [ <NUM_LIT:3> : ] <EOL> prefix = <NUM_LIT:3> <EOL> ( output , consumed ) = codecs . utf_8_decode ( input , errors , True ) <EOL> return ( output , consumed + prefix ) <EOL> class IncrementalEncoder ( codecs . IncrementalEncoder ) : <EOL> def __init__ ( self , errors = '<STR_LIT:strict>' ) : <EOL> codecs . IncrementalEncoder . __init__ ( self , errors ) <EOL> self . first = <NUM_LIT:1> <EOL> def encode ( self , input , final = False ) : <EOL> if self . first : <EOL> self . first = <NUM_LIT:0> <EOL> return codecs . BOM_UTF8 + codecs . utf_8_encode ( input , self . errors ) [ <NUM_LIT:0> ] <EOL> else : <EOL> return codecs . utf_8_encode ( input , self . errors ) [ <NUM_LIT:0> ] <EOL> def reset ( self ) : <EOL> codecs . IncrementalEncoder . reset ( self ) <EOL> self . first = <NUM_LIT:1> <EOL> def getstate ( self ) : <EOL> return self . first <EOL> def setstate ( self , state ) : <EOL> self . first = state <EOL> class IncrementalDecoder ( codecs . BufferedIncrementalDecoder ) : <EOL> def __init__ ( self , errors = '<STR_LIT:strict>' ) : <EOL> codecs . BufferedIncrementalDecoder . __init__ ( self , errors ) <EOL> self . first = True <EOL> def _buffer_decode ( self , input , errors , final ) : <EOL> if self . first : <EOL> if len ( input ) < <NUM_LIT:3> : <EOL> if codecs . BOM_UTF8 . startswith ( input ) : <EOL> return ( u"<STR_LIT>" , <NUM_LIT:0> ) <EOL> else : <EOL> self . first = None <EOL> else : <EOL> self . first = None <EOL> if input [ : <NUM_LIT:3> ] == codecs . BOM_UTF8 : <EOL> ( output , consumed ) = codecs . utf_8_decode ( input [ <NUM_LIT:3> : ] , errors , final ) <EOL> return ( output , consumed + <NUM_LIT:3> ) <EOL> return codecs . utf_8_decode ( input , errors , final ) <EOL> def reset ( self ) : <EOL> codecs . BufferedIncrementalDecoder . reset ( self ) <EOL> self . first = True <EOL> class StreamWriter ( codecs . StreamWriter ) : <EOL> def reset ( self ) : <EOL> codecs . StreamWriter . reset ( self ) <EOL> try : <EOL> del self . encode <EOL> except AttributeError : <EOL> pass <EOL> def encode ( self , input , errors = '<STR_LIT:strict>' ) : <EOL> self . encode = codecs . utf_8_encode <EOL> return encode ( input , errors ) <EOL> class StreamReader ( codecs . StreamReader ) : <EOL> def reset ( self ) : <EOL> codecs . StreamReader . reset ( self ) <EOL> try : <EOL> del self . decode <EOL> except AttributeError : <EOL> pass <EOL> def decode ( self , input , errors = '<STR_LIT:strict>' ) : <EOL> if len ( input ) < <NUM_LIT:3> : <EOL> if codecs . BOM_UTF8 . startswith ( input ) : <EOL> return ( u"<STR_LIT>" , <NUM_LIT:0> ) <EOL> elif input [ : <NUM_LIT:3> ] == codecs . BOM_UTF8 : <EOL> self . decode = codecs . utf_8_decode <EOL> ( output , consumed ) = codecs . utf_8_decode ( input [ <NUM_LIT:3> : ] , errors ) <EOL> return ( output , consumed + <NUM_LIT:3> ) <EOL> self . decode = codecs . utf_8_decode <EOL> return codecs . utf_8_decode ( input , errors ) <EOL> def getregentry ( ) : <EOL> return codecs . CodecInfo ( <EOL> name = '<STR_LIT>' , <EOL> encode = encode , <EOL> decode = decode , <EOL> incrementalencoder = IncrementalEncoder , <EOL> incrementaldecoder = IncrementalDecoder , <EOL> streamreader = StreamReader , <EOL> streamwriter = StreamWriter , <EOL> ) </s>
