JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrJFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr j f%@sdZddlZdddZdddZGdd d ejZGd d d ejZGd d d ejZGdddejZddZ dS)a Python 'utf-8-sig' Codec This work similar to UTF-8 with the following changes: * On encoding/writing a UTF-8 encoded BOM will be prepended/written as the first three bytes. * On decoding/reading if the first three bytes are a UTF-8 encoded BOM, these bytes will be skipped. NstrictcCs'tjtj||dt|fS)Nr)codecsBOM_UTF8 utf_8_encodelen)inputerrorsr 8/opt/alt/python34/lib64/python3.4/encodings/utf_8_sig.pyencodesr cCsad}|ddtjkr8|dd}d}ntj||d\}}|||fS)NrT)rr utf_8_decode)rrprefixoutputconsumedr r r decodes  rc@sReZdZdddZdddZddZd d Zd d Zd S)IncrementalEncoderrcCs tjj||d|_dS)N)rr__init__first)selfrr r r rszIncrementalEncoder.__init__FcCsK|jr0d|_tjtj||jdStj||jdSdS)Nr)rrrrr)rrfinalr r r r s   zIncrementalEncoder.encodecCstjj|d|_dS)Nr)rrresetr)rr r r r'szIncrementalEncoder.resetcCs|jS)N)r)rr r r getstate+szIncrementalEncoder.getstatecCs ||_dS)N)r)rstater r r setstate.szIncrementalEncoder.setstateN)__name__ __module__ __qualname__rr rrrr r r r rs   rc@sOeZdZdddZddZddZdd Zd d Zd S) IncrementalDecoderrcCs tjj||d|_dS)Nr)rBufferedIncrementalDecoderrr)rrr r r r2szIncrementalDecoder.__init__cCs|jrt|dkr=tjj|r1dSd|_qd|_|ddtjkrtj|dd||\}}||dfSntj|||S)Nr r)r!r)rrrr startswithr )rrrrrrr r r _buffer_decode6s   %z!IncrementalDecoder._buffer_decodecCstjj|d|_dS)Nr)rr rr)rr r r rGszIncrementalDecoder.resetcCs#tjj|}|d|jfS)Nr)rr rr)rrr r r rKszIncrementalDecoder.getstatecCs$tjj|||d|_dS)Nr)rr rr)rrr r r rPszIncrementalDecoder.setstateN)rrrrr#rrrr r r r r1s    rc@s+eZdZddZdddZdS) StreamWriterc Cs3tjj|y |`Wntk r.YnXdS)N)rr$rr AttributeError)rr r r rVs   zStreamWriter.resetrcCstj|_t||S)N)rrr )rrrr r r r ]s zStreamWriter.encodeN)rrrrr r r r r r$Us  r$c@s+eZdZddZdddZdS) StreamReaderc Cs3tjj|y |`Wntk r.YnXdS)N)rr&rrr%)rr r r rbs   zStreamReader.resetrcCst|dkr+tjj|rdSnU|ddtjkrtj|_tj|dd|\}}||dfStj|_tj||S)Nr r!r)r!r)rrrr"r r)rrrrrr r r ris " zStreamReader.decodeN)rrrrrr r r r r&as  r&cCs4tjdddtdtdtdtdtdtS) Nnamez utf-8-sigr rincrementalencoderincrementaldecoder streamreader streamwriter)r CodecInfor rrrr&r$r r r r getregentryys r-) __doc__rr rrr rr$r&r-r r r r  s $