/snap/core24/1587/usr/lib/python3.12/__pycache__
NameSizeModeActions
abc.cpython-312.pyc80550644editdlrm
aifc.cpython-312.pyc428630644editdlrm
antigravity.cpython-312.pyc10030644editdlrm
argparse.cpython-312.pyc1016820644editdlrm
ast.cpython-312.pyc1002790644editdlrm
base64.cpython-312.pyc244080644editdlrm
bdb.cpython-312.pyc373590644editdlrm
bisect.cpython-312.pyc36410644editdlrm
bz2.cpython-312.pyc151330644editdlrm
calendar.cpython-312.pyc396210644editdlrm
cgi.cpython-312.pyc402280644editdlrm
cgitb.cpython-312.pyc173320644editdlrm
chunk.cpython-312.pyc73100644editdlrm
cmd.cpython-312.pyc186190644editdlrm
code.cpython-312.pyc130510644editdlrm
codecs.cpython-312.pyc422740644editdlrm
codeop.cpython-312.pyc69160644editdlrm
colorsys.cpython-312.pyc46420644editdlrm
compileall.cpython-312.pyc204970644editdlrm
configparser.cpython-312.pyc635820644editdlrm
contextlib.cpython-312.pyc303760644editdlrm
contextvars.cpython-312.pyc2610644editdlrm
copy.cpython-312.pyc98000644editdlrm
copyreg.cpython-312.pyc74140644editdlrm
cProfile.cpython-312.pyc85930644editdlrm
crypt.cpython-312.pyc53610644editdlrm
csv.cpython-312.pyc177880644editdlrm
dataclasses.cpython-312.pyc446780644editdlrm
datetime.cpython-312.pyc4090644editdlrm
decimal.cpython-312.pyc4060644editdlrm
difflib.cpython-312.pyc754990644editdlrm
dis.cpython-312.pyc345600644editdlrm
doctest.cpython-312.pyc1056860644editdlrm
enum.cpython-312.pyc807080644editdlrm
filecmp.cpython-312.pyc146610644editdlrm
fileinput.cpython-312.pyc202800644editdlrm
fnmatch.cpython-312.pyc64950644editdlrm
fractions.cpython-312.pyc366670644editdlrm
ftplib.cpython-312.pyc426360644editdlrm
functools.cpython-312.pyc405060644editdlrm
genericpath.cpython-312.pyc68220644editdlrm
getopt.cpython-312.pyc83630644editdlrm
getpass.cpython-312.pyc68500644editdlrm
gettext.cpython-312.pyc221510644editdlrm
glob.cpython-312.pyc98410644editdlrm
graphlib.cpython-312.pyc103270644editdlrm
gzip.cpython-312.pyc320150644editdlrm
hashlib.cpython-312.pyc80870644editdlrm
heapq.cpython-312.pyc179560644editdlrm
hmac.cpython-312.pyc106980644editdlrm
imaplib.cpython-312.pyc628890644editdlrm
imghdr.cpython-312.pyc69440644editdlrm
inspect.cpython-312.pyc1334460644editdlrm
io.cpython-312.pyc41390644editdlrm
ipaddress.cpython-312.pyc907620644editdlrm
keyword.cpython-312.pyc10410644editdlrm
linecache.cpython-312.pyc64010644editdlrm
locale.cpython-312.pyc595360644editdlrm
lzma.cpython-312.pyc158550644editdlrm
mailbox.cpython-312.pyc1116180644editdlrm
mailcap.cpython-312.pyc111550644editdlrm
mimetypes.cpython-312.pyc241850644editdlrm
modulefinder.cpython-312.pyc279440644editdlrm
netrc.cpython-312.pyc89030644editdlrm
nntplib.cpython-312.pyc449390644editdlrm
ntpath.cpython-312.pyc260330644editdlrm
nturl2path.cpython-312.pyc30340644editdlrm
numbers.cpython-312.pyc139670644editdlrm
opcode.cpython-312.pyc147160644editdlrm
operator.cpython-312.pyc173640644editdlrm
optparse.cpython-312.pyc675460644editdlrm
os.cpython-312.pyc434740644editdlrm
pathlib.cpython-312.pyc620980644editdlrm
pdb.cpython-312.pyc849190644editdlrm
pickle.cpython-312.pyc761760644editdlrm
pickletools.cpython-312.pyc811280644editdlrm
pipes.cpython-312.pyc109140644editdlrm
pkgutil.cpython-312.pyc199590644editdlrm
platform.cpython-312.pyc416000644editdlrm
plistlib.cpython-312.pyc412860644editdlrm
poplib.cpython-312.pyc184460644editdlrm
posixpath.cpython-312.pyc182360644editdlrm
pprint.cpython-312.pyc294740644editdlrm
profile.cpython-312.pyc225400644editdlrm
pstats.cpython-312.pyc379220644editdlrm
pty.cpython-312.pyc73630644editdlrm
pyclbr.cpython-312.pyc148870644editdlrm
pydoc.cpython-312.pyc1429550644editdlrm
py_compile.cpython-312.pyc100780644editdlrm
queue.cpython-312.pyc147320644editdlrm
quopri.cpython-312.pyc93230644editdlrm
random.cpython-312.pyc331530644editdlrm
reprlib.cpython-312.pyc99090644editdlrm
rlcompleter.cpython-312.pyc82820644editdlrm
runpy.cpython-312.pyc143850644editdlrm
sched.cpython-312.pyc77350644editdlrm
secrets.cpython-312.pyc25560644editdlrm
selectors.cpython-312.pyc261280644editdlrm
shelve.cpython-312.pyc129130644editdlrm
shlex.cpython-312.pyc141620644editdlrm
shutil.cpython-312.pyc681130644editdlrm
signal.cpython-312.pyc44480644editdlrm
site.cpython-312.pyc290630644editdlrm
sitecustomize.cpython-312.pyc3000644editdlrm
smtplib.cpython-312.pyc482210644editdlrm
sndhdr.cpython-312.pyc107120644editdlrm
socket.cpython-312.pyc418170644editdlrm
socketserver.cpython-312.pyc342580644editdlrm
sre_compile.cpython-312.pyc6250644editdlrm
sre_constants.cpython-312.pyc6280644editdlrm
sre_parse.cpython-312.pyc6210644editdlrm
ssl.cpython-312.pyc630110644editdlrm
stat.cpython-312.pyc52310644editdlrm
statistics.cpython-312.pyc554230644editdlrm
string.cpython-312.pyc114820644editdlrm
stringprep.cpython-312.pyc251600644editdlrm
struct.cpython-312.pyc3250644editdlrm
subprocess.cpython-312.pyc791870644editdlrm
sunau.cpython-312.pyc254230644editdlrm
symtable.cpython-312.pyc187810644editdlrm
sysconfig.cpython-312.pyc300010644editdlrm
tabnanny.cpython-312.pyc121560644editdlrm
tarfile.cpython-312.pyc1233880644editdlrm
telnetlib.cpython-312.pyc284230644editdlrm
tempfile.cpython-312.pyc473390644editdlrm
textwrap.cpython-312.pyc182930644editdlrm
this.cpython-312.pyc14080644editdlrm
threading.cpython-312.pyc653460644editdlrm
timeit.cpython-312.pyc148640644editdlrm
token.cpython-312.pyc35570644editdlrm
tokenize.cpython-312.pyc247750644editdlrm
trace.cpython-312.pyc330240644editdlrm
traceback.cpython-312.pyc515230644editdlrm
tracemalloc.cpython-312.pyc269070644editdlrm
tty.cpython-312.pyc26680644editdlrm
turtle.cpython-312.pyc1846320644editdlrm
types.cpython-312.pyc149390644editdlrm
typing.cpython-312.pyc1418600644editdlrm
uu.cpython-312.pyc78160644editdlrm
uuid.cpython-312.pyc330070644editdlrm
warnings.cpython-312.pyc237920644editdlrm
wave.cpython-312.pyc320840644editdlrm
weakref.cpython-312.pyc313480644editdlrm
webbrowser.cpython-312.pyc263530644editdlrm
xdrlib.cpython-312.pyc118410644editdlrm
zipapp.cpython-312.pyc99770644editdlrm
zipimport.cpython-312.pyc244750644editdlrm
_aix_support.cpython-312.pyc47590644editdlrm
_collections_abc.cpython-312.pyc459120644editdlrm
_compat_pickle.cpython-312.pyc72210644editdlrm
_compression.cpython-312.pyc74970644editdlrm
_distutils_system_mod.cpython-312.pyc78180644editdlrm
_markupbase.cpython-312.pyc122790644editdlrm
_osx_support.cpython-312.pyc177310644editdlrm
_pydatetime.cpython-312.pyc941930644editdlrm
_pydecimal.cpython-312.pyc2278070644editdlrm
_pyio.cpython-312.pyc1102690644editdlrm
_pylong.cpython-312.pyc99830644editdlrm
_py_abc.cpython-312.pyc70540644editdlrm
_sitebuiltins.cpython-312.pyc47600644editdlrm
_strptime.cpython-312.pyc241160644editdlrm
_sysconfigdata__linux_x86_64-linux-gnu.cpython-312.pyc586510644editdlrm
_sysconfigdata__x86_64-linux-gnu.cpython-312.pyc586450644editdlrm
_threading_local.cpython-312.pyc82950644editdlrm
_weakrefset.cpython-312.pyc117510644editdlrm
__future__.cpython-312.pyc47040644editdlrm
__hello__.cpython-312.pyc8700644editdlrm
Edit: /snap/core24/1587/usr/lib/python3.12/__pycache__/codecs.cpython-312.pyc (42274B)
ЦidZddlZddlZ ddlgdZdZdxZ Z dxZ Z d Z d Zejd k(re xZZe Zne xZZeZe Ze Ze ZeZGd d eZGddZGddeZGddeZGddeZGddeZGddeZGddeZ GddZ!GddZ"d2d!Z#d3d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*d4d)Z+d4d*Z,d+Z-d,Z. e/d Z0e/d-Z1e/d.Z2e/d/Z3e/d0Z4e/d1Z5dZ7e7rddl8Z8yy#e$rZedezdZ[wwxYw#e6$rdZ0dZ1dZ2dZ3dZ4dZ5Y5wxYw)5z 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: %s),registerlookupopen 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,eZdZdZdZ ddddZdZy)rz0Codec details when looking up the codec registryTN)_is_text_encodingctj|||||f} || _|| _|| _|| _|| _|| _|| _||| _ | SN) tuple__new__namer$r%incrementalencoderincrementaldecoder streamwriter streamreaderr2) clsr$r%r;r:r8r9r7r2selfs /usr/lib/python3.12/codecs.pyr6zCodecInfo.__new__^se}}S66<"NO   "4"4((  (%6D " cd|jj|jj|jt |fzS)Nz%<%s.%s object for encoding %s at %#x>) __class__ __module__ __qualname__r7idr=s r>__repr__zCodecInfo.__repr__ms:6**DNN,G,GBtH&& &r?)NNNNN)__name__rBrC__doc__r2r6rFr?r>rrSs%:EI?C ! &r?rc eZdZdZddZddZy)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. ct)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. NotImplementedErrorr=inputerrorss r>r$z Codec.encodes ""!r?ct)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. rLrNs r>r%z Codec.decodes *"!r?Nstrict)rGrBrCrHr$r%rIr?r>rrrs,"&"r?rc2eZdZdZddZd dZdZdZdZy) 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(). c ||_d|_y)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)rPbufferr=rPs r>__init__zIncrementalEncoder.__init__s  r?ct)zA Encodes input and returns the resulting object. rLr=rOfinals r>r$zIncrementalEncoder.encode "!r?cy)z: Resets the encoder to the initial state. NrIrEs r>resetzIncrementalEncoder.resetr?cy)z: Return the current state of the encoder. rrIrEs r>getstatezIncrementalEncoder.getstatesr?cy)zl Set the current state of the encoder. state must have been returned by getstate(). NrIr=states r>setstatezIncrementalEncoder.setstater`r?NrRF) rGrBrCrHrYr$r_rbrfrIr?r>rrs  "    r?rc8eZdZdZd dZdZd dZdZdZdZ y) 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(). c>tj||d|_yNrV)rrYrWrXs r>rYz#BufferedIncrementalEncoder.__init__s##D&1 r?ctr4rLr=rOrPr\s r>_buffer_encodez)BufferedIncrementalEncoder._buffer_encode "!r?cx|j|z}|j||j|\}}||d|_|Sr4)rWrnrPr=rOr\dataresultconsumeds r>r$z!BufferedIncrementalEncoder.encode?{{U"!00t{{EJ89o  r?c<tj|d|_yrk)rr_rWrEs r>r_z BufferedIncrementalEncoder.resets  & r?c"|jxsdSNrrWrEs r>rbz#BufferedIncrementalEncoder.getstates{{ar?c|xsd|_yrkryrds r>rfz#BufferedIncrementalEncoder.setstates kr r?NrRrg) rGrBrCrHrYrnr$r_rbrfrIr?r>riris%  "  "r?ric2eZdZdZddZd dZdZdZdZy) 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(). c||_y)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)rPrXs r>rYzIncrementalDecoder.__init__s  r?ct)z@ Decode input and returns the resulting object. rLr[s r>r%zIncrementalDecoder.decoder]r?cy)z9 Reset the decoder to the initial state. NrIrEs r>r_zIncrementalDecoder.resetr`r?cy)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). )r?rrIrEs r>rbzIncrementalDecoder.getstatesr?cy)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(). NrIrds r>rfzIncrementalDecoder.setstate'r`r?NrRrg) rGrBrCrHrYr%r_rbrfrIr?r>rrs  "   r?rc8eZdZdZd dZdZd dZdZdZdZ y) 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. c>tj||d|_yNr?)rrYrWrXs r>rYz#BufferedIncrementalDecoder.__init__5s##D&1 r?ctr4rLrms r>_buffer_decodez)BufferedIncrementalDecoder._buffer_decode:ror?cx|j|z}|j||j|\}}||d|_|Sr4)rWrrPrqs r>r%z!BufferedIncrementalDecoder.decode?rur?c<tj|d|_yr)rr_rWrEs r>r_z BufferedIncrementalDecoder.resetGs  & r?c|jdfSrxryrEs r>rbz#BufferedIncrementalDecoder.getstateKs Qr?c|d|_yrxryrds r>rfz#BufferedIncrementalDecoder.setstateOs Ah r?NrRrg) rGrBrCrHrYrr%r_rbrfrIr?r>rr/s%  "  r?rcJeZdZd dZdZdZdZd dZefdZ dZ dZ d Z y ) rc ||_||_y)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)streamrPr=rrPs r>rYzStreamWriter.__init__\s,  r?cx|j||j\}}|jj|y)z> Writes the object's contents encoded to self.stream. N)r$rPrwrite)r=objectrrrts r>rzStreamWriter.writeus.VT[[9h $r?cD|jdj|y)z[ Writes the concatenated list of strings to the stream using .write(). rVN)rjoinr=lists r> writelineszStreamWriter.writelines|s 2774=!r?cy)a2 Resets the codec buffers used for keeping internal 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. NrIrEs r>r_zStreamWriter.resets r?ct|jj|||dk(r|dk(r|jyyyrxrseekr_r=offsetwhences r>rzStreamWriter.seeks3 ( Q;6Q; JJL';r?c(||j|Sz? Inherit all other methods from the underlying stream. rr=r7getattrs r> __getattr__zStreamWriter.__getattr__ t{{D))r?c|Sr4rIrEs r> __enter__zStreamWriter.__enter__ r?c8|jjyr4rcloser=typevaluetbs r>__exit__zStreamWriter.__exit__ r?cFtd|jjzNzcan't serialize %s TypeErrorrArGr=protos r> __reduce_ex__zStreamWriter.__reduce_ex__,t~~/F/FFGGr?NrRr) rGrBrCrYrrr_rrrrrrrIr?r>rrZs52 "   $*Hr?rcneZdZeZddZddZddZddZddZ dZ ddZ d Z d Z efd Zd Zd ZdZy)rc||_||_d|_|j|_|j|_d|_y)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)rrP bytebuffercharbuffertype_empty_charbuffer charbuffer linebufferrs r>rYzStreamReader.__init__s>$  !%!4!4!600r?ctr4rLrNs r>r%zStreamReader.decodes!!r?cF|jr1|jj|j|_d|_|dkr|} |dk\rt |j|k\rn|dkr|j j }n|j j |}|j|z}|snC |j||j\}}||d|_|xj|z c_|sn|dkr|j} |j|_| S|jd|} |j|d|_| S#t$rZ}|rM|j|d|j|j\}}|jd} t | dkrYd}~d}~wwxYw)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) rrrrlenrreadrr%rPUnicodeDecodeErrorstart splitlines) r=sizechars firstlinenewdatarrnewchars decodedbytesexclinesrss r>rzStreamReader.reads8 ??"4499$//JDO"DO 19Ezt'50ax++**,++**40??W,D )-T4;;)G&,#<=1DO OOx 'O?@ 19__F"44DO  __Ve,F"ooef5DO 1&  D#))$4dkkB+Hl$///>E5z1}%  s2D== F AFF Nc&|jrh|jd}|jd=t|jdk(r|jd|_d|_|s|jdd}|S|xsd}|j} |j |d}|rXt |tr|jd s!t |tr'|jd r||j dd z }||z }|jd}|rt|dkDrm|d}|d=t|dkDr&|d xx|jz cc<||_d|_n|d|jz|_|s|jdd} |S|d}|djdd}||k7r<|jj|dd|jz|_|r|} |S|} |S|r||r|s|jdd} |S|d kr|dz})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  )rri@) rrrrrr isinstancestrendswithbytesr) r=rrlinereadsizerrr line0withendline0withoutends r>readlinezStreamReader.readlines; ????1%D"4??#q(#'//!"4"&6q9K:2%%99X96DtS)dmmD.AtU+ e0DDII1AI66D DLDOOTO2Eu:>!8Da5zA~b T__4 */*.+0(T__*D##>qA& % %Qx "'("5"5u"5"Ea"H?2&*&<&<&A&A%)&L&*oo'6DO+  / 4+??E?:1=D $A ]r?cD|j}|j|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=sizehintrrrs r> readlineszStreamReader.readlinesasyy{x((r?cBd|_|j|_d|_y)z Resets the codec buffers used for keeping internal state. Note that no stream repositioning should take place. This method is primarily intended to be able to recover from decoding errors. r?N)rrrrrEs r>r_zStreamReader.resetps00r?c\|jj|||jy)zp Set the input stream's current position. Resets the codec buffers used for keeping state. Nrrs r>rzStreamReader.seek}s! ( r?c6|j}|r|Stz4 Return the next decoded line from the input stream.)r StopIteration)r=rs r>__next__zStreamReader.__next__s}} Kr?c|Sr4rIrEs r>__iter__zStreamReader.__iter__rr?c(||j|Srrrs r>rzStreamReader.__getattr__rr?c|Sr4rIrEs r>rzStreamReader.__enter__rr?c8|jjyr4rrs r>rzStreamReader.__exit__rr?cFtd|jjzrrrs r>rzStreamReader.__reduce_ex__rr?rR)rrF)NTr)rGrBrCrrrYr%rrrr_rrrrrrrrrIr?r>rrsRN2"N`IV ) $*Hr?rcveZdZdZdZddZddZddZddZdZ d Z d Z d Z d Z dd ZefdZdZdZdZy)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. unknowncX||_||||_||||_||_y)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)rreaderwriterrP)r=rReaderWriterrPs r>rYzStreamReaderWriter.__init__s. VV, VV,  r?c8|jj|Sr4)rrr=rs r>rzStreamReaderWriter.reads{{%%r?Nc8|jj|Sr4)rrrs r>rzStreamReaderWriter.readlines{{##D))r?c8|jj|Sr4)rr)r=rs r>rzStreamReaderWriter.readliness{{$$X..r?c,t|jSr)nextrrEs r>rzStreamReaderWriter.__next__sDKK  r?c|Sr4rIrEs r>rzStreamReaderWriter.__iter__rr?c8|jj|Sr4)rr)r=rrs r>rzStreamReaderWriter.writes{{  &&r?c8|jj|Sr4)rrrs r>rzStreamReaderWriter.writeliness{{%%d++r?cl|jj|jjyr4rr_rrEs r>r_zStreamReaderWriter.reset"  r?c|jj|||jj|dk(r!|dk(r|jjyyyrx)rrrr_rrs r>rzStreamReaderWriter.seeksJ (  Q;6Q; KK   ';r?c(||j|Srrrs r>rzStreamReaderWriter.__getattr__rr?c|Sr4rIrEs r>rzStreamReaderWriter.__enter__rr?c8|jjyr4rrs r>rzStreamReaderWriter.__exit__rr?cFtd|jjzrrrs r>rz StreamReaderWriter.__reduce_ex__rr?rRrr4r)rGrBrCrHencodingrYrrrrrrrr_rrrrrrrIr?r>rrsZH$&*/! ',  $*Hr?rc|eZdZdZdZdZ ddZddZddZddZ dZ d Z d Z d Z d Zdd ZefdZdZdZdZy)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. rct||_||_||_||||_||||_||_y)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)rr$r%rrrP)r=rr$r%rrrPs r>rYzStreamRecoder.__init__s<*   VV, VV,  r?cz|jj|}|j||j\}}|Sr4)rrr$rPr=rrr bytesencodeds r>rzStreamRecoder.read,s4{{%![[t{{;l r?Nc||jj}n|jj|}|j||j\}}|Sr4)rrr$rPrs r>rzStreamRecoder.readline2sK <;;'')D;;''-D![[t{{;l r?c|jj}|j||j\}}|j dS)NTr)rrr$rPr)r=rrrrs r>rzStreamRecoder.readlines;s>{{!![[t{{;l--r?cnt|j}|j||j\}}|Sr)rrr$rP)r=rrrs r>rzStreamRecoder.__next__As0DKK ![[t{{;l r?c|Sr4rIrEs r>rzStreamRecoder.__iter__Hrr?cv|j||j\}}|jj|Sr4)r%rPrr)r=rr bytesdecodeds r>rzStreamRecoder.writeKs0![[t{{;l{{  &&r?cdj|}|j||j\}}|jj |Sr)rr%rPrr)r=rrrrs r>rzStreamRecoder.writelinesPs=xx~![[t{{;l{{  &&r?cl|jj|jjyr4rrEs r>r_zStreamRecoder.resetVrr?ct|jj|||jj||yr4)rrrrs r>rzStreamRecoder.seek[s, ( (r?c(||j|Srrrs r>rzStreamRecoder.__getattr__arr?c|Sr4rIrEs r>rzStreamRecoder.__enter__hrr?c8|jjyr4rrs r>rzStreamRecoder.__exit__krr?cFtd|jjzrrrs r>rzStreamRecoder.__reduce_ex__nrr?rRr r4r)rGrBrCrH data_encoding file_encodingrYrrrrrrrr_rrrrrrrIr?r>rrsd MM!8 . ' '  )$*Hr?rrSc| d|vr|dz}tj|||}||S t|}t||j|j |}||_|S#|jxYw)a 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. If encoding is not None, then the 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. b)builtinsrrrr;r:r r)filenamemoder rP bufferingfileinfosrws r>rrss> $cz ==4 3D h t'8'8$:K:KVT    s 5AA1c||}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. )rrr$r%r;r:rr)r%rrrP data_info file_infosrs r>rrsj2% }%I}%I tY--y/?/? --y/E/Ev OB%B$B Ir?c,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$r s r>rr (  " ""r?c,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%r-s r>rrr.r?cJt|j}| t||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. )rr8 LookupError)r encoders r>r r )X11G(## Nr?cJt|j}| t||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. )rr9r1)r decoders r>r!r!r3r?c,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. )rr;r-s r>r"r" (  ( ((r?c,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. )rr:r-s r>r#r#r7r?c+Kt||fi|}|D]}|j|}|s||jdd}|r|yyw)z Encoding iterator. Encodes the input strings from the iterator using an IncrementalEncoder. errors and kwargs are passed through to the IncrementalEncoder constructor. rVTN)r r$)iteratorr rPkwargsr2rOoutputs r>r&r&sc.#H-f??G& L^^B %F   +A Ac+Kt||fi|}|D]}|j|}|s||jdd}|r|yyw)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%)r:r rPr;r5rOr<s r>r'r' sc.#H-f??G& L^^C &F  r=c.|Dcic]}||c}Scc}w)z make_identity_dict(rng) -> dict Return a dictionary where elements of the rng sequence are mapped to themselves. rI)rngis r>make_identity_dictrB4s AAaC  s cXi}|jD]\}}||vr|||<d||<|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_mapmkvs r>make_encoding_maprI>sE A!!#!AvAaDAaD  Hr?ignorereplacexmlcharrefreplacebackslashreplace namereplace)rNrSr)NrSrR)9rHr!sys_codecs ImportErrorwhy SystemError__all__rr rr rrr byteorderrrrr r rr r5rrrrrirrrrrrrrrrr r!r"r#r&r'rBrIr/r(r)r*r+r,r-r1_false encodingsrIr?r>rYs E -0 $#$## # ==H#"C)I #"C)I     &&>@"@"D& & P "!3 "D/ / b"!3"VHH5HHXxH5xHxVHVHtsHsHn/b"L##  ))$( . *M *M!),N+,?@*+=>%m4   o"E =C DDEV"MMN#"s)D0D-D* D%%D*-EE