/snap/core20/2769/usr/lib/python3.8/__pycache__
NameSizeModeActions
abc.cpython-38.pyc53340644editdlrm
aifc.cpython-38.pyc254740644editdlrm
antigravity.cpython-38.pyc7970644editdlrm
argparse.cpython-38.pyc625910644editdlrm
ast.cpython-38.pyc167630644editdlrm
asynchat.cpython-38.pyc68510644editdlrm
asyncore.cpython-38.pyc160280644editdlrm
base64.cpython-38.pyc170710644editdlrm
bdb.cpython-38.pyc249210644editdlrm
binhex.cpython-38.pyc121340644editdlrm
bisect.cpython-38.pyc23540644editdlrm
bz2.cpython-38.pyc114450644editdlrm
calendar.cpython-38.pyc270640644editdlrm
cgi.cpython-38.pyc265440644editdlrm
cgitb.cpython-38.pyc101500644editdlrm
chunk.cpython-38.pyc48390644editdlrm
cmd.cpython-38.pyc126260644editdlrm
code.cpython-38.pyc99130644editdlrm
codecs.cpython-38.pyc339560644editdlrm
codeop.cpython-38.pyc64170644editdlrm
colorsys.cpython-38.pyc32400644editdlrm
compileall.cpython-38.pyc94100644editdlrm
configparser.cpython-38.pyc457180644editdlrm
contextlib.cpython-38.pyc202290644editdlrm
contextvars.cpython-38.pyc2430644editdlrm
copy.cpython-38.pyc69870644editdlrm
copyreg.cpython-38.pyc43180644editdlrm
cProfile.cpython-38.pyc54800644editdlrm
crypt.cpython-38.pyc33870644editdlrm
csv.cpython-38.pyc119100644editdlrm
dataclasses.cpython-38.pyc236530644editdlrm
datetime.cpython-38.pyc571730644editdlrm
decimal.cpython-38.pyc3590644editdlrm
difflib.cpython-38.pyc594380644editdlrm
dis.cpython-38.pyc158080644editdlrm
doctest.cpython-38.pyc759740644editdlrm
dummy_threading.cpython-38.pyc11100644editdlrm
enum.cpython-38.pyc259620644editdlrm
filecmp.cpython-38.pyc84270644editdlrm
fileinput.cpython-38.pyc133730644editdlrm
fnmatch.cpython-38.pyc33550644editdlrm
formatter.cpython-38.pyc175450644editdlrm
fractions.cpython-38.pyc187390644editdlrm
ftplib.cpython-38.pyc280070644editdlrm
functools.cpython-38.pyc279010644editdlrm
genericpath.cpython-38.pyc40010644editdlrm
getopt.cpython-38.pyc62710644editdlrm
getpass.cpython-38.pyc41780644editdlrm
gettext.cpython-38.pyc180000644editdlrm
glob.cpython-38.pyc43430644editdlrm
gzip.cpython-38.pyc181840644editdlrm
hashlib.cpython-38.pyc67270644editdlrm
heapq.cpython-38.pyc140700644editdlrm
hmac.cpython-38.pyc63880644editdlrm
imaplib.cpython-38.pyc414640644editdlrm
imghdr.cpython-38.pyc41180644editdlrm
imp.cpython-38.pyc98090644editdlrm
inspect.cpython-38.pyc805930644editdlrm
io.cpython-38.pyc34540644editdlrm
ipaddress.cpython-38.pyc628290644editdlrm
keyword.cpython-38.pyc9980644editdlrm
linecache.cpython-38.pyc38670644editdlrm
locale.cpython-38.pyc346740644editdlrm
lzma.cpython-38.pyc120180644editdlrm
mailbox.cpython-38.pyc602640644editdlrm
mailcap.cpython-38.pyc72060644editdlrm
mimetypes.cpython-38.pyc160310644editdlrm
modulefinder.cpython-38.pyc161150644editdlrm
netrc.cpython-38.pyc37770644editdlrm
nntplib.cpython-38.pyc339740644editdlrm
ntpath.cpython-38.pyc140910644editdlrm
nturl2path.cpython-38.pyc17440644editdlrm
numbers.cpython-38.pyc122020644editdlrm
opcode.cpython-38.pyc54200644editdlrm
operator.cpython-38.pyc136910644editdlrm
optparse.cpython-38.pyc480570644editdlrm
os.cpython-38.pyc313970644editdlrm
pathlib.cpython-38.pyc442090644editdlrm
pdb.cpython-38.pyc472260644editdlrm
pickle.cpython-38.pyc469080644editdlrm
pickletools.cpython-38.pyc672040644editdlrm
pipes.cpython-38.pyc77950644editdlrm
pkgutil.cpython-38.pyc163090644editdlrm
platform.cpython-38.pyc243260644editdlrm
plistlib.cpython-38.pyc273740644editdlrm
poplib.cpython-38.pyc135560644editdlrm
posixpath.cpython-38.pyc104610644editdlrm
pprint.cpython-38.pyc162810644editdlrm
profile.cpython-38.pyc147580644editdlrm
pstats.cpython-38.pyc220660644editdlrm
pty.cpython-38.pyc39550644editdlrm
pyclbr.cpython-38.pyc104510644editdlrm
pydoc.cpython-38.pyc836460644editdlrm
py_compile.cpython-38.pyc73520644editdlrm
queue.cpython-38.pyc106260644editdlrm
quopri.cpython-38.pyc57480644editdlrm
random.cpython-38.pyc201080644editdlrm
re.cpython-38.pyc144220644editdlrm
reprlib.cpython-38.pyc53030644editdlrm
rlcompleter.cpython-38.pyc57550644editdlrm
runpy.cpython-38.pyc81810644editdlrm
sched.cpython-38.pyc65320644editdlrm
secrets.cpython-38.pyc21900644editdlrm
selectors.cpython-38.pyc169350644editdlrm
shelve.cpython-38.pyc94900644editdlrm
shlex.cpython-38.pyc75360644editdlrm
shutil.cpython-38.pyc372190644editdlrm
signal.cpython-38.pyc28430644editdlrm
site.cpython-38.pyc171680644editdlrm
sitecustomize.cpython-38.pyc2200644editdlrm
smtpd.cpython-38.pyc264630644editdlrm
smtplib.cpython-38.pyc355320644editdlrm
sndhdr.cpython-38.pyc69890644editdlrm
socket.cpython-38.pyc277870644editdlrm
socketserver.cpython-38.pyc253610644editdlrm
sre_compile.cpython-38.pyc151420644editdlrm
sre_constants.cpython-38.pyc63590644editdlrm
sre_parse.cpython-38.pyc216470644editdlrm
ssl.cpython-38.pyc450370644editdlrm
stat.cpython-38.pyc43720644editdlrm
statistics.cpython-38.pyc336530644editdlrm
string.cpython-38.pyc73000644editdlrm
stringprep.cpython-38.pyc110170644editdlrm
struct.cpython-38.pyc3300644editdlrm
subprocess.cpython-38.pyc419670644editdlrm
sunau.cpython-38.pyc170800644editdlrm
symbol.cpython-38.pyc24040644editdlrm
symtable.cpython-38.pyc113220644editdlrm
sysconfig.cpython-38.pyc158370644editdlrm
tabnanny.cpython-38.pyc70300644editdlrm
tarfile.cpython-38.pyc630430644editdlrm
telnetlib.cpython-38.pyc182370644editdlrm
tempfile.cpython-38.pyc266530644editdlrm
textwrap.cpython-38.pyc135190644editdlrm
this.cpython-38.pyc12610644editdlrm
threading.cpython-38.pyc399760644editdlrm
timeit.cpython-38.pyc117770644editdlrm
token.cpython-38.pyc24850644editdlrm
tokenize.cpython-38.pyc171600644editdlrm
trace.cpython-38.pyc200260644editdlrm
traceback.cpython-38.pyc199380644editdlrm
tracemalloc.cpython-38.pyc173630644editdlrm
tty.cpython-38.pyc10760644editdlrm
turtle.cpython-38.pyc1300220644editdlrm
types.cpython-38.pyc91770644editdlrm
typing.cpython-38.pyc624200644editdlrm
uu.cpython-38.pyc36050644editdlrm
uuid.cpython-38.pyc236830644editdlrm
warnings.cpython-38.pyc136520644editdlrm
wave.cpython-38.pyc181490644editdlrm
weakref.cpython-38.pyc195180644editdlrm
webbrowser.cpython-38.pyc171200644editdlrm
xdrlib.cpython-38.pyc82210644editdlrm
zipapp.cpython-38.pyc58540644editdlrm
zipfile.cpython-38.pyc593360644editdlrm
zipimport.cpython-38.pyc172750644editdlrm
_bootlocale.cpython-38.pyc12430644editdlrm
_collections_abc.cpython-38.pyc287410644editdlrm
_compat_pickle.cpython-38.pyc55010644editdlrm
_compression.cpython-38.pyc41460644editdlrm
_dummy_thread.cpython-38.pyc60370644editdlrm
_markupbase.cpython-38.pyc77900644editdlrm
_osx_support.cpython-38.pyc115930644editdlrm
_pydecimal.cpython-38.pyc1607350644editdlrm
_pyio.cpython-38.pyc740790644editdlrm
_py_abc.cpython-38.pyc46700644editdlrm
_sitebuiltins.cpython-38.pyc34810644editdlrm
_strptime.cpython-38.pyc160440644editdlrm
_sysconfigdata__linux_x86_64-linux-gnu.cpython-38.pyc211210644editdlrm
_sysconfigdata__x86_64-linux-gnu.cpython-38.pyc211150644editdlrm
_threading_local.cpython-38.pyc64460644editdlrm
_weakrefset.cpython-38.pyc76000644editdlrm
__future__.cpython-38.pyc41580644editdlrm
__phello__.foo.cpython-38.pyc1270644editdlrm
Edit: /snap/core20/2769/usr/lib/python3.8/__pycache__/codecs.cpython-38.pyc (33956B)
U yi;,@sdZddlZddlZz ddlTWn.ek rNZzedeW5dZ[XYnXddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0g,Zd1Zd2Z Z d3Z Z d4Z d5Zejd6kre ZZe Zn e ZZeZe Ze Ze ZeZGd7ddeZGd8ddZGd9ddeZGd:d;d;eZGdd>eZGd?ddeZGd@ddeZ GdAddZ!GdBddZ"d\dFdZ#d]dGdZ$dHdZ%dId Z&dJd!Z'dKd"Z(dLd#Z)dMd$Z*d^dNd'Z+d_dOd(Z,dPdQZ-dRdSZ.z4e/dDZ0e/dTZ1e/dUZ2e/dVZ3e/dWZ4e/dXZ5Wn.e6k r`dZ0dZ1dZ2dZ3dZ4dZ5YnXdZ7e7rtddl8Z8e9dYkre$ej:dZd[e_:e$ej;d[dZe_;dS)`z codecs -- Python Codec Registry, API and helpers. Written by Marc-Andre Lemburg (mal@lemburg.com). (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. N)*z%Failed to load the builtin codecs: %sregisterlookupopen EncodedFileBOMBOM_BEBOM_LEBOM32_BEBOM32_LEBOM64_BEBOM64_LEBOM_UTF8 BOM_UTF16 BOM_UTF16_LE BOM_UTF16_BE BOM_UTF32 BOM_UTF32_LE BOM_UTF32_BE CodecInfoCodecIncrementalEncoderIncrementalDecoder StreamReader StreamWriterStreamReaderWriter StreamRecoder getencoder getdecodergetincrementalencodergetincrementaldecoder getreader getwriterencodedecode iterencode iterdecode strict_errors ignore_errorsreplace_errorsxmlcharrefreplace_errorsbackslashreplace_errorsnamereplace_errorsregister_error lookup_errorssssslittlec@s,eZdZdZdZd ddddZddZdS) rz0Codec details when looking up the codec registryTN)_is_text_encodingc CsPt|||||f} || _|| _|| _|| _|| _|| _|| _|dk rL|| _ | SN) tuple__new__namer#r$incrementalencoderincrementaldecoder streamwriter streamreaderr0) clsr#r$r8r7r5r6r4r0selfr;/usr/lib/python3.8/codecs.pyr3^szCodecInfo.__new__cCsd|jj|jj|jt|fS)Nz%<%s.%s object for encoding %s at %#x>) __class__ __module__ __qualname__r4idr:r;r;r<__repr__ms  zCodecInfo.__repr__)NNNNN)__name__r>r?__doc__r0r3rBr;r;r;r<rSs c@s$eZdZdZdddZd ddZdS) ra9 Defines the interface for stateless encoders/decoders. The .encode()/.decode() methods may use different error handling schemes by providing the errors argument. These string values are predefined: 'strict' - raise a ValueError error (or a subclass) 'ignore' - ignore the character and continue with the next 'replace' - replace with a suitable replacement character; Python will use the official U+FFFD REPLACEMENT CHARACTER for the builtin Unicode codecs on decoding and '?' on encoding. 'surrogateescape' - replace with private code points U+DCnn. 'xmlcharrefreplace' - Replace with the appropriate XML character reference (only for encoding). 'backslashreplace' - Replace with backslashed escape sequences. 'namereplace' - Replace with \N{...} escape sequences (only for encoding). The set of allowed values can be extended via register_error. strictcCstdS)a# Encodes the object input and returns a tuple (output object, length consumed). errors defines the error handling to apply. It defaults to 'strict' handling. The method may not store state in the Codec instance. Use StreamWriter for codecs which have to keep state in order to make encoding efficient. The encoder must be able to handle zero length input and return an empty object of the output object type in this situation. NNotImplementedErrorr:inputerrorsr;r;r<r#sz Codec.encodecCstdS)a Decodes the object input and returns a tuple (output object, length consumed). input must be an object which provides the bf_getreadbuf buffer slot. Python strings, buffer objects and memory mapped files are examples of objects providing this slot. errors defines the error handling to apply. It defaults to 'strict' handling. The method may not store state in the Codec instance. Use StreamReader for codecs which have to keep state in order to make decoding efficient. The decoder must be able to handle zero length input and return an empty object of the output object type in this situation. NrFrHr;r;r<r$sz Codec.decodeN)rE)rE)rCr>r?rDr#r$r;r;r;r<rrs c@s<eZdZdZdddZdddZdd Zd d Zd d ZdS)rz An IncrementalEncoder encodes an input in multiple steps. The input can be passed piece by piece to the encode() method. The IncrementalEncoder remembers the state of the encoding process between calls to encode(). rEcCs||_d|_dS)z Creates an IncrementalEncoder instance. The IncrementalEncoder may use different error handling schemes by providing the errors keyword argument. See the module docstring for a list of possible values. N)rJbufferr:rJr;r;r<__init__szIncrementalEncoder.__init__FcCstdS)zA Encodes input and returns the resulting object. NrFr:rIfinalr;r;r<r#szIncrementalEncoder.encodecCsdS)z: Resets the encoder to the initial state. Nr;rAr;r;r<resetszIncrementalEncoder.resetcCsdS)z: Return the current state of the encoder. rr;rAr;r;r<getstateszIncrementalEncoder.getstatecCsdS)zl Set the current state of the encoder. state must have been returned by getstate(). Nr;r:stater;r;r<setstateszIncrementalEncoder.setstateN)rE)F) rCr>r?rDrNr#rQrRrUr;r;r;r<rs  c@sDeZdZdZdddZddZddd Zd d Zd d ZddZ dS)BufferedIncrementalEncoderz This subclass of IncrementalEncoder can be used as the baseclass for an incremental encoder if the encoder must keep some of the output in a buffer between calls to encode(). rEcCst||d|_dSNrK)rrNrLrMr;r;r<rNs z#BufferedIncrementalEncoder.__init__cCstdSr1rFr:rIrJrPr;r;r<_buffer_encodesz)BufferedIncrementalEncoder._buffer_encodeFcCs0|j|}|||j|\}}||d|_|Sr1)rLrYrJr:rIrPdataresultconsumedr;r;r<r#s z!BufferedIncrementalEncoder.encodecCst|d|_dSrW)rrQrLrAr;r;r<rQs z BufferedIncrementalEncoder.resetcCs |jpdSNrrLrAr;r;r<rRsz#BufferedIncrementalEncoder.getstatecCs|pd|_dSrWr_rSr;r;r<rUsz#BufferedIncrementalEncoder.setstateN)rE)F) rCr>r?rDrNrYr#rQrRrUr;r;r;r<rVs  rVc@s<eZdZdZdddZdddZdd Zd d Zd d ZdS)rz An IncrementalDecoder decodes an input in multiple steps. The input can be passed piece by piece to the decode() method. The IncrementalDecoder remembers the state of the decoding process between calls to decode(). rEcCs ||_dS)z Create an IncrementalDecoder instance. The IncrementalDecoder may use different error handling schemes by providing the errors keyword argument. See the module docstring for a list of possible values. N)rJrMr;r;r<rNszIncrementalDecoder.__init__FcCstdS)z@ Decode input and returns the resulting object. NrFrOr;r;r<r$szIncrementalDecoder.decodecCsdS)z9 Reset the decoder to the initial state. Nr;rAr;r;r<rQszIncrementalDecoder.resetcCsdS)a  Return the current state of the decoder. This must be a (buffered_input, additional_state_info) tuple. buffered_input must be a bytes object containing bytes that were passed to decode() that have not yet been converted. additional_state_info must be a non-negative integer representing the state of the decoder WITHOUT yet having processed the contents of buffered_input. In the initial state and after reset(), getstate() must return (b"", 0). )rr;rAr;r;r<rRs zIncrementalDecoder.getstatecCsdS)z Set the current state of the decoder. state must have been returned by getstate(). The effect of setstate((b"", 0)) must be equivalent to reset(). Nr;rSr;r;r<rU'szIncrementalDecoder.setstateN)rE)F) rCr>r?rDrNr$rQrRrUr;r;r;r<rs  c@sDeZdZdZdddZddZddd Zd d Zd d ZddZ dS)BufferedIncrementalDecoderz This subclass of IncrementalDecoder can be used as the baseclass for an incremental decoder if the decoder must be able to handle incomplete byte sequences. rEcCst||d|_dSNr`)rrNrLrMr;r;r<rN5s z#BufferedIncrementalDecoder.__init__cCstdSr1rFrXr;r;r<_buffer_decode:sz)BufferedIncrementalDecoder._buffer_decodeFcCs0|j|}|||j|\}}||d|_|Sr1)rLrcrJrZr;r;r<r$?s z!BufferedIncrementalDecoder.decodecCst|d|_dSrb)rrQrLrAr;r;r<rQGs z BufferedIncrementalDecoder.resetcCs |jdfSr^r_rAr;r;r<rRKsz#BufferedIncrementalDecoder.getstatecCs|d|_dSr^r_rSr;r;r<rUOsz#BufferedIncrementalDecoder.setstateN)rE)F) rCr>r?rDrNrcr$rQrRrUr;r;r;r<ra/s  rac@sTeZdZdddZddZddZdd Zdd d Zefd dZ ddZ ddZ dS)rrEcCs||_||_dS)aw Creates a StreamWriter instance. stream must be a file-like object open for writing. The StreamWriter may use different error handling schemes by providing the errors keyword argument. These parameters are predefined: 'strict' - raise a ValueError (or a subclass) 'ignore' - ignore the character and continue with the next 'replace'- replace with a suitable replacement character 'xmlcharrefreplace' - Replace with the appropriate XML character reference. 'backslashreplace' - Replace with backslashed escape sequences. 'namereplace' - Replace with \N{...} escape sequences. The set of allowed parameter values can be extended via register_error. N)streamrJr:rdrJr;r;r<rN\szStreamWriter.__init__cCs"|||j\}}|j|dS)z> Writes the object's contents encoded to self.stream. N)r#rJrdwrite)r:objectr[r]r;r;r<rfuszStreamWriter.writecCs|d|dS)z[ Writes the concatenated list of strings to the stream using .write(). rKN)rfjoinr:listr;r;r< writelines|szStreamWriter.writelinescCsdS)a5 Flushes and resets the codec buffers used for keeping state. Calling this method should ensure that the data on the output is put into a clean state, that allows appending of new fresh data without having to rescan the whole stream to recover state. Nr;rAr;r;r<rQs zStreamWriter.resetrcCs*|j|||dkr&|dkr&|dSr^rdseekrQr:offsetwhencer;r;r<rmszStreamWriter.seekcCs ||j|Sz? Inherit all other methods from the underlying stream. rdr:r4getattrr;r;r< __getattr__szStreamWriter.__getattr__cCs|Sr1r;rAr;r;r< __enter__szStreamWriter.__enter__cCs|jdSr1rdcloser:typevaluetbr;r;r<__exit__szStreamWriter.__exit__N)rE)r) rCr>r?rNrfrkrQrmrtrurvr}r;r;r;r<rZs   c@seZdZeZdddZd ddZd!dd Zd"d d Zd#ddZ ddZ d$ddZ ddZ ddZ efddZddZddZd S)%rrEcCs.||_||_d|_||_|j|_d|_dS)a Creates a StreamReader instance. stream must be a file-like object open for reading. The StreamReader may use different error handling schemes by providing the errors keyword argument. These parameters are predefined: 'strict' - raise a ValueError (or a subclass) 'ignore' - ignore the character and continue with the next 'replace'- replace with a suitable replacement character 'backslashreplace' - Replace with backslashed escape sequences; The set of allowed parameter values can be extended via register_error. r`N)rdrJ bytebuffercharbuffertype_empty_charbuffer charbuffer linebufferrer;r;r<rNs  zStreamReader.__init__cCstdSr1rFrHr;r;r<r$szStreamReader.decodeFc CsN|jr|j|j|_d|_|dkr(|}|dkrBt|j|krBq|dkrV|j}n |j|}|j|}|stqz|||j \}}Wn`t k r}zB|r||d|j |j \}}|j dd} t| dkrڂnW5d}~XYnX||d|_|j|7_|s(qq(|dkr,|j} |j|_n|jd|} |j|d|_| S)a Decodes data from the stream self.stream and returns the resulting object. chars indicates the number of decoded code points or bytes to return. read() will never return more data than requested, but it might return less, if there is not enough available. size indicates the approximate maximum number of decoded bytes or code points to read for decoding. The decoder can modify this setting as appropriate. The default value -1 indicates to read and decode as much as possible. size is intended to prevent having to decode huge files in one step. If firstline is true, and a UnicodeDecodeError happens after the first line terminator in the input only the first line will be returned, the rest of the input will be kept until the next call to read(). The method should use a greedy read strategy, meaning that it should read as much data as is allowed within the definition of the encoding and the given size, e.g. if optional encoding endings or state markers are available on the stream, these should be read too. NrTkeepends) rrrhrlenrdreadr~r$rJUnicodeDecodeErrorstart splitlines) r:sizechars firstlinenewdatar[newchars decodedbytesexclinesr\r;r;r<rsD       zStreamReader.readNTc Cs|jrP|jd}|jd=t|jdkr8|jd|_d|_|sL|jddd}|S|pVd}|j}|j|dd}|rt|tr|d st|t r|d r||jddd 7}||7}|jdd}|rt|dkr8|d}|d=t|dkr|d |j7<||_d|_n|d|j|_|s|jddd}q|d}|djddd}||kr|j |dd|j|_|r|}n|}q|r|dk r|r|s|jddd}q|d kr^|d9}q^|S)z Read one line from the input stream and return the decoded data. size, if given, is passed as size argument to the read() method. rrNFrHT)r  )rrri@) rrrrrr isinstancestrendswithbytesrh) r:rrlinereadsizer[r line0withendline0withoutendr;r;r<readlinesd       zStreamReader.readlinecCs|}||S)aS Read all lines available on the input stream and return them as a list. Line breaks are implemented using the codec's decoder method and are included in the list entries. sizehint, if given, is ignored since there is no efficient way to finding the true end-of-line. )rr)r:sizehintrr[r;r;r< readlines^s zStreamReader.readlinescCsd|_|j|_d|_dS)z Resets the codec buffers used for keeping state. Note that no stream repositioning should take place. This method is primarily intended to be able to recover from decoding errors. r`N)r~rrrrAr;r;r<rQms zStreamReader.resetrcCs|j|||dS)zp Set the input stream's current position. Resets the codec buffers used for keeping state. Nrlrnr;r;r<rmzszStreamReader.seekcCs|}|r|StdS)4 Return the next decoded line from the input stream.N)r StopIteration)r:rr;r;r<__next__szStreamReader.__next__cCs|Sr1r;rAr;r;r<__iter__szStreamReader.__iter__cCs ||j|Srqrrrsr;r;r<ruszStreamReader.__getattr__cCs|Sr1r;rAr;r;r<rvszStreamReader.__enter__cCs|jdSr1rwryr;r;r<r}szStreamReader.__exit__)rE)rE)rrF)NT)NT)r)rCr>r?rrrNr$rrrrQrmrrrtrurvr}r;r;r;r<rs   P K   c@seZdZdZdZd!ddZd"ddZd#d d Zd$d d ZddZ ddZ ddZ ddZ ddZ d%ddZefddZddZdd Zd S)&ra StreamReaderWriter instances allow wrapping streams which work in both read and write modes. The design is such that one can use the factory functions returned by the codec.lookup() function to construct the instance. unknownrEcCs(||_||||_||||_||_dS)aR Creates a StreamReaderWriter instance. stream must be a Stream-like object. Reader, Writer must be factory functions or classes providing the StreamReader, StreamWriter interface resp. Error handling is done in the same way as defined for the StreamWriter/Readers. N)rdreaderwriterrJ)r:rdReaderWriterrJr;r;r<rNs   zStreamReaderWriter.__init__rcCs |j|Sr1)rrr:rr;r;r<rszStreamReaderWriter.readNcCs |j|Sr1)rrrr;r;r<rszStreamReaderWriter.readlinecCs |j|Sr1)rr)r:rr;r;r<rszStreamReaderWriter.readlinescCs t|jSr)nextrrAr;r;r<rszStreamReaderWriter.__next__cCs|Sr1r;rAr;r;r<rszStreamReaderWriter.__iter__cCs |j|Sr1)rrf)r:r[r;r;r<rfszStreamReaderWriter.writecCs |j|Sr1)rrkrir;r;r<rkszStreamReaderWriter.writelinescCs|j|jdSr1rrQrrAr;r;r<rQs zStreamReaderWriter.resetrcCs6|j|||j|dkr2|dkr2|jdSr^)rdrmrrQrrnr;r;r<rms zStreamReaderWriter.seekcCs ||j|Srqrrrsr;r;r<ruszStreamReaderWriter.__getattr__cCs|Sr1r;rAr;r;r<rvszStreamReaderWriter.__enter__cCs|jdSr1rwryr;r;r<r}szStreamReaderWriter.__exit__)rE)r)N)N)r)rCr>r?rDencodingrNrrrrrrfrkrQrmrtrurvr}r;r;r;r<rs        c@seZdZdZdZdZd!ddZd"ddZd#d d Zd$d d Z ddZ ddZ ddZ ddZ ddZd%ddZefddZddZdd Zd S)&raB StreamRecoder instances translate data from one encoding to another. They use the complete set of APIs returned by the codecs.lookup() function to implement their task. Data written to the StreamRecoder is first decoded into an intermediate format (depending on the "decode" codec) and then written to the underlying stream using an instance of the provided Writer class. In the other direction, data is read from the underlying stream using a Reader instance and then encoded and returned to the caller. rrEcCs4||_||_||_||||_||||_||_dS)a Creates a StreamRecoder instance which implements a two-way conversion: encode and decode work on the frontend (the data visible to .read() and .write()) while Reader and Writer work on the backend (the data in stream). You can use these objects to do transparent transcodings from e.g. latin-1 to utf-8 and back. stream must be a file-like object. encode and decode must adhere to the Codec interface; Reader and Writer must be factory functions or classes providing the StreamReader and StreamWriter interfaces resp. Error handling is done in the same way as defined for the StreamWriter/Readers. N)rdr#r$rrrJ)r:rdr#r$rrrJr;r;r<rNs   zStreamRecoder.__init__rcCs"|j|}|||j\}}|Sr1)rrr#rJr:rr[ bytesencodedr;r;r<r#s zStreamRecoder.readNcCs6|dkr|j}n |j|}|||j\}}|Sr1)rrr#rJrr;r;r<r)s   zStreamRecoder.readlinecCs(|j}|||j\}}|jddS)NTr)rrr#rJr)r:rr[rr;r;r<r2s zStreamRecoder.readlinescCs t|j}|||j\}}|Sr)rrr#rJ)r:r[rr;r;r<r8s zStreamRecoder.__next__cCs|Sr1r;rAr;r;r<r?szStreamRecoder.__iter__cCs|||j\}}|j|Sr1)r$rJrrf)r:r[ bytesdecodedr;r;r<rfBszStreamRecoder.writecCs(d|}|||j\}}|j|Srb)rhr$rJrrf)r:rjr[rr;r;r<rkGs zStreamRecoder.writelinescCs|j|jdSr1rrAr;r;r<rQMs zStreamRecoder.resetrcCs |j|||j||dSr1)rrmrrnr;r;r<rmRszStreamRecoder.seekcCs ||j|Srqrrrsr;r;r<ruXszStreamRecoder.__getattr__cCs|Sr1r;rAr;r;r<rv_szStreamRecoder.__enter__cCs|jdSr1rwryr;r;r<r}bszStreamRecoder.__exit__)rE)r)N)N)r)rCr>r?rD data_encoding file_encodingrNrrrrrrfrkrQrmrtrurvr}r;r;r;r<rs$     rrErcCst|dk rd|kr|d}t|||}|dkr2|Sz&t|}t||j|j|}||_|WS|YnXdS)aq Open an encoded file using the given mode and return a wrapped version providing transparent encoding/decoding. Note: The wrapped version will only accept the object format defined by the codecs, i.e. Unicode objects for most builtin codecs. Output is also codec dependent and will usually be Unicode as well. Underlying encoded files are always opened in binary mode. The default file mode is 'r', meaning to open the file in read mode. encoding specifies the encoding which is to be used for the file. errors may be given to define the error handling. It defaults to 'strict' which causes ValueErrors to be raised in case an encoding error occurs. buffering has the same meaning as for the builtin open() API. It defaults to -1 which means that the default buffer size will be used. The returned wrapped file object provides an extra attribute .encoding which allows querying the used encoding. This attribute is only available if an encoding was specified as parameter. Nb)builtinsrrrr8r7rrx)filenamemoderrJ bufferingfileinfosrwr;r;r<rgscCsF|dkr |}t|}t|}t||j|j|j|j|}||_||_|S)a Return a wrapped version of file which provides transparent encoding translation. Data written to the wrapped file is decoded according to the given data_encoding and then encoded to the underlying file using file_encoding. The intermediate data type will usually be Unicode but depends on the specified codecs. Bytes read from the file are decoded using file_encoding and then passed back to the caller encoded using data_encoding. If file_encoding is not given, it defaults to data_encoding. errors may be given to define the error handling. It defaults to 'strict' which causes ValueErrors to be raised in case an encoding error occurs. The returned wrapped file object provides two extra attributes .data_encoding and .file_encoding which reflect the given parameters of the same name. The attributes can be used for introspection by Python programs. N)rrr#r$r8r7rr)rrrrJ data_info file_infosrr;r;r<rs cCs t|jS)z Lookup up the codec for the given encoding and return its encoder function. Raises a LookupError in case the encoding cannot be found. )rr#rr;r;r<rscCs t|jS)z Lookup up the codec for the given encoding and return its decoder function. Raises a LookupError in case the encoding cannot be found. )rr$rr;r;r<rscCst|j}|dkrt||S)z Lookup up the codec for the given encoding and return its IncrementalEncoder class or factory function. Raises a LookupError in case the encoding cannot be found or the codecs doesn't provide an incremental encoder. N)rr5 LookupError)rencoderr;r;r<rs cCst|j}|dkrt||S)z Lookup up the codec for the given encoding and return its IncrementalDecoder class or factory function. Raises a LookupError in case the encoding cannot be found or the codecs doesn't provide an incremental decoder. N)rr6r)rdecoderr;r;r<r s cCs t|jS)z Lookup up the codec for the given encoding and return its StreamReader class or factory function. Raises a LookupError in case the encoding cannot be found. )rr8rr;r;r<r!scCs t|jS)z Lookup up the codec for the given encoding and return its StreamWriter class or factory function. Raises a LookupError in case the encoding cannot be found. )rr7rr;r;r<r"scksHt||f|}|D]}||}|r|Vq|dd}|rD|VdS)z Encoding iterator. Encodes the input strings from the iterator using an IncrementalEncoder. errors and kwargs are passed through to the IncrementalEncoder constructor. rKTN)rr#)iteratorrrJkwargsrrIoutputr;r;r<r%s   cksHt||f|}|D]}||}|r|Vq|dd}|rD|VdS)z Decoding iterator. Decodes the input strings from the iterator using an IncrementalDecoder. errors and kwargs are passed through to the IncrementalDecoder constructor. r`TN)r r$)rrrJrrrIrr;r;r<r&s   cCsdd|DS)z make_identity_dict(rng) -> dict Return a dictionary where elements of the rng sequence are mapped to themselves. cSsi|] }||qSr;r;).0ir;r;r< /sz&make_identity_dict..r;)rngr;r;r<make_identity_dict'srcCs4i}|D]"\}}||kr&|||<q d||<q |S)a Creates an encoding map from a decoding map. If a target mapping in the decoding map occurs multiple times, then that target is mapped to None (undefined mapping), causing an exception when encountered by the charmap codec during translation. One example where this happens is cp875.py which decodes multiple character to \u001a. N)items) decoding_mapmkvr;r;r<make_encoding_map1s   rignorereplacexmlcharrefreplacebackslashreplace namereplace__main__zlatin-1zutf-8)rNrEr)NrE)rE)rE)s    B("1+IzWt 0 &