Viewing File: /opt/alt/python35/lib64/python3.5/encodings/__pycache__/utf_8_sig.cpython-35.opt-1.pyc



¯ÕYf%ã@s¤dZddlZddd„Zddd„ZGdd	„d	ejƒZGd
d„dejƒZGdd
„d
ejƒZGdd„dejƒZdd„Z	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.
éNÚstrictcCs'tjtj||ƒdt|ƒfS)Nr)ÚcodecsÚBOM_UTF8Úutf_8_encodeÚlen)ÚinputÚerrors©r	ú8/opt/alt/python35/lib64/python3.5/encodings/utf_8_sig.pyÚencodesrcCs^d}|dd…tjkr5|dd…}d}tj||dƒ\}}|||fS)NréT)rrÚutf_8_decode)rrÚprefixÚoutputÚconsumedr	r	r
Údecodesrc@sReZdZddd„Zddd„Zdd„Zd	d
„Zdd„Zd
S)ÚIncrementalEncoderrcCs tjj||ƒd|_dS)Né)rrÚ__init__Úfirst)Úselfrr	r	r
rszIncrementalEncoder.__init__FcCsK|jr0d|_tjtj||jƒdStj||jƒdSdS)Nr)rrrrr)rrÚfinalr	r	r
rs
		zIncrementalEncoder.encodecCstjj|ƒd|_dS)Nr)rrÚresetr)rr	r	r
r'szIncrementalEncoder.resetcCs|jS)N)r)rr	r	r
Úgetstate+szIncrementalEncoder.getstatecCs
||_dS)N)r)rÚstater	r	r
Úsetstate.szIncrementalEncoder.setstateN)Ú__name__Ú
__module__Ú__qualname__rrrrrr	r	r	r
rs
rc@sOeZdZddd„Zdd„Zdd„Zdd	„Zd
d„ZdS)
ÚIncrementalDecoderrcCs tjj||ƒd|_dS)Nr)rÚBufferedIncrementalDecoderrr)rrr	r	r
r2szIncrementalDecoder.__init__cCs¥|jr’t|ƒdkr=tjj|ƒr1dSd|_nUd|_|dd…tjkr’tj|dd…||ƒ\}}||dfStj|||ƒ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+eZdZdd„Zddd„ZdS)ÚStreamWritercCs3tjj|ƒ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)rrrrrr	r	r	r
r$Usr$c@s+eZdZdd„Zddd„ZdS)ÚStreamReadercCs3tjj|ƒy
|`Wntk
r.YnXdS)N)rr&rrr%)rr	r	r
rbs


zStreamReader.resetrcCsœt|ƒdkr+tjj|ƒr€dSnU|dd…tjkr€tj|_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&cCs4tjdddtdtdtdtdtdtƒS)	NÚnamez	utf-8-sigrrÚincrementalencoderÚincrementaldecoderÚstreamreaderÚstreamwriter)rÚ	CodecInforrrrr&r$r	r	r	r
Úgetregentryys	r-)
Ú__doc__rrrrr rr$r&r-r	r	r	r
Ú<module>	s$
Back to Directory File Manager