Ë `ç’΄ÃXãóì—dZdZddlZddlZddlZddlZddlZddlZddlm Z  ej«5ejd«ej«dxsej«dZej«Zddd« ej&e«Gd „d e«ZGd „d e«Zd „Zd„ZGd„de «ZGd„de «ZGd„d«ZGd„de«ZGd„de«ZGd„de«Z Gd„de«Z!Gd„de«Z"Gd„d e«Z#Gd!„d"e«Z$Gd#„d$e«Z%y#1swYŒ±xYw#e$rZdej$vrdZndZYdZ[ŒÑdZ[wdZYŒÚxYw#eef$rdZYŒÕwxYw)%z I/O classes provide a uniform API for low-level input and output. Subclasses exist for a variety of input/output mechanisms. ÚreStructuredTextéN)Ú TransformSpecÚignoreézunknown locale: UTF-8úutf-8có —eZdZy)Ú InputErrorN©Ú__name__Ú __module__Ú __qualname__©óú0/usr/lib/python3.12/site-packages/docutils/io.pyr r 3ó…rr có —eZdZy)Ú OutputErrorNr rrrrr4rrrcó¢— tj|j«tj|«k(S#ttt f$rYywxYw)aNTest, whether the encoding of `stream` matches `encoding`. Returns :None: if `encoding` or `stream.encoding` are not a valid encoding argument (e.g. ``None``) or `stream.encoding is missing. :True: if the encoding argument resolves to the same value as `encoding`, :False: if the encodings differ. N)ÚcodecsÚlookupÚencodingÚ LookupErrorÚAttributeErrorÚ TypeError)Ústreamrs rÚcheck_encodingr7sA€ðÜ�}‰}˜VŸ_™_Ó-´·±¸xÓ1HÑHÐHøÜ œ¬Ð 3òÙðús‚47·AÁ Acó8—|jj›d|›�S)z5Return string representation of Exception `err`. z: )Ú __class__r )Úerrs rÚ error_stringr Gs €ð�m‰m×$Ñ$Ð % R¨ uÐ -Ð-rcó¼—eZdZdZdZdZ dd„Zd„Zd„Zd„Z e jd«Z e jd fe jd fe j d ffZ d „Zd „Zy)ÚInputah Abstract base class for input wrappers. Docutils input objects must provide a `read()` method that returns the source, typically as `str` instance. Inheriting `TransformSpec` allows input objects to add "transforms" and "unknown_reference_resolvers" to the "Transformer". (Optional for custom input objects since Docutils 0.19.) ÚinputNcóx—||_ ||_ ||_ ||_ |s|j|_d|_y©N)rÚ error_handlerÚsourceÚ source_pathÚdefault_source_pathÚsuccessful_encoding)Úselfr'r(rr&s rÚ__init__zInput.__init__]sH€à ˆŒ Ø1à*ˆÔØ*àˆŒ Ø'à&ˆÔØ-áØ#×7Ñ7ˆDÔ à#'ˆÔ ØErcóR—|j›d|j›d|j›�S)Nz : source=z, source_path=)rr'r(©r+s rÚ__repr__zInput.__repr__qs$€Ø26·.³.À$Ç+Ã+Ø26×2BÒ2BðDð Drcó—t‚)z,Return input as `str`. Define in subclasses.©ÚNotImplementedErrorr.s rÚreadz Input.readuó€ä!Ð!rcóˆ—|jr4|jj«dk(rt|t«sJd«‚t|t«r|S|jr|jg}nO|j |«}|r|g}n8dg}t rt dk7r|j t «|j d«|D]4} t|||j«}||_|jdd«cStdd jd „|D««›d t«›d �«‚#ttf$r }|}Yd}~Œ~d}~wwxYw) aƒ Decode `data` if required. Return Unicode `str` instances unchanged (nothing to decode). If `self.encoding` is None, determine encoding from data or try UTF-8, locale encoding, and (as last ressort) 'latin-1'. The client application should call ``locale.setlocale`` at the beginning of processing:: locale.setlocale(locale.LC_ALL, '') Raise UnicodeError if unsuccessful. Provisional: - Raise UnicodeError (instead of falling back to the locale encoding) if decoding the source with the default encoding (UTF-8) fails and Python is started in `UTF-8 mode`. Raise UnicodeError (instead of falling back to "latin1") if both, default and locale encoding, fail. - Only remove BOM (U+FEFF ZWNBSP at start of data), no other ZWNBSPs. Úunicodez;input encoding is "unicode" but `data` is no `str` instancerzlatin-1uÚNz=Unable to decode input data. Tried the following encodings: z, c3ó2K—|]}t|«–—Œy­wr%)Úrepr)Ú.0Úencs rÚ zInput.decode..¼sèø€ÐBÑ.A sœ˜cŸÑ.Aùs‚ú. (Ú))rÚlowerÚ isinstanceÚstrÚdetermine_encoding_from_dataÚ_locale_encodingÚappendr&r*ÚreplaceÚ UnicodeErrorrÚjoinr )r+ÚdataÚencoding_candidatesÚ data_encodingr;ÚdecodedrÚerrors rÚdecodez Input.decodeysM€ð4 �=Š=˜TŸ]™]×0Ñ0Ó2°iÒ?ܘd¤CÔ(ð Nð,Mó NÐ(ä �dœCÔ àˆKØ �=Š=ð$(§=¡= /Ñ à ×=Ñ=¸dÓCˆMÙð(5 oÑ#ð (/ iÐ#õ$Ô(8¸GÒ(CØ'×.Ñ.Ô/?Ô@à#×*Ñ*¨9Ô5Û&ˆCð ܘd C¨×);Ñ);Ó<�Ø+.�Ô(ð—‘ x°Ó4Ò4ð'ôØ KØ�y‰yÑBÑ.AÓBÓBÐCðDܘUÓ#Ð$ Að 'ó(ð (øô!¤+Ð.ò à•ûð úsÃ/D&Ä&EÄ5D<Ä<Escoding[:=]\s*([-\w.]+)rz utf-16-bez utf-16-lecó—|jD]\}}|j|«sŒ|cS|j«ddD]A}|jj |«}|sŒ!|j d«j d«cSy)z— Try to determine the encoding of `data` by looking *in* `data`. Check for a byte order mark (BOM) or an encoding declaration. NérÚascii)Úbyte_order_marksÚ startswithÚ splitlinesÚ coding_slugÚsearchÚgrouprM)r+rHÚ start_bytesrÚlineÚmatchs rrBz"Input.determine_encoding_from_dataÉs{€ð &*×%:Ô%:Ñ !ˆK˜Ø�‰˜{Õ+Ø’ð&;ð—O‘OÓ% b qÓ)ˆDØ×$Ñ$×+Ñ+¨DÓ1ˆEÚØ—{‘{ 1“~×,Ñ,¨WÓ5Ò5ð*ðrcóV— |jj«S#t$rYywxYw)z>Return True, if the input source is connected to a TTY device.F)r'Úisattyrr.s rr[z Input.isattyÙs,€ð Ø—;‘;×%Ñ%Ó'Ð 'øÜò Ùð úó ‚œ (§(©NNNÚstrict)r r r Ú__doc__Úcomponent_typer)r,r/r3rMÚreÚcompilerTrÚBOM_UTF8Ú BOM_UTF16_BEÚ BOM_UTF16_LErQrBr[rrrr"r"Ms‡„ñ ð€NàÐà?CØ'óFò(Dò"òD(ðL�"—*‘*Ð7Ó8€KØ'àŸ™¨'Ð2Ø×,Ñ,¨kÐ:Ø×,Ñ,¨kÐ:ð=Ðð-òó rr"có6—eZdZdZdZdZ dd„Zd„Zd„Zd„Z y) ÚOutputak Abstract base class for output wrappers. Docutils output objects must provide a `write()` method that expects and handles one argument (the output). Inheriting `TransformSpec` allows output objects to add "transforms" and "unknown_reference_resolvers" to the "Transformer". (Optional for custom output objects since Docutils 0.19.) ÚoutputNcót—||_ |xsd|_ ||_ ||_ |s|j|_yy)Nr^)rr&Ú destinationÚdestination_pathÚdefault_destination_path)r+rjrkrr&s rr,zOutput.__init__ñsH€à ˆŒ Ø7à*Ò6¨hˆÔØ*à&ˆÔØ.à 0ˆÔØ2áØ$(×$AÑ$AˆDÕ !ð rcóR—|j›d|j›d|j›�S)Nz: destination=z, destination_path=)rrjrkr.s rr/zOutput.__repr__s%€à—>“> 4×#3Ó#3°T×5JÒ5JðLð Mrcó—t‚)z#Write `data`. Define in subclasses.r1©r+rHs rÚwritez Output.writer4rcóö—|jr6|jj«dk(rt|t«sJd«‚|St|t«s|S|j |j|j «S)a? Encode and return `data`. If `data` is a `bytes` instance, it is returned unchanged. Otherwise it is encoded with `self.encoding`. Provisional: If `self.encoding` is set to the pseudo encoding name "unicode", `data` must be a `str` instance and is returned unchanged. r6zØ.6óBò"Mò"óBrrgcó0—eZdZdZ dd„Zd„Zd„Zd„Zy)Ú ErrorOutputz’ Wrapper class for file-like error streams with failsafe de- and encoding of `str`, `bytes`, `unicode` and `Exception` instances. Ncóà—|€tj}n!|sd}nt|t«r t |d«}||_ |xst |dd«xs txsd|_ ||_ ||_ y)a› :Parameters: - `destination`: a file-like object, a string (path to a file), `None` (write to `sys.stderr`, default), or evaluating to `False` (write() requests are ignored). - `encoding`: `destination` text encoding. Guessed if None. - `encoding_errors`: how to treat encoding errors. NFÚwrrP) ÚsysÚstderrr@rAÚopenrjÚgetattrrCrÚencoding_errorsÚdecoding_errors)r+rjrr{r|s rr,zErrorOutput.__init__&s€ð Ð ÜŸ*™*‰KÙØ‰Kä ˜ ¤SÔ )ܘ{¨CÓ0ˆKà&ˆÔØ+à!ò8¤W¨[¸*ÀdÓ%Kò8Ü,ò8Ø07ð Œ à,à.ˆÔØ%à.ˆÔØ%rcóø—|jsyt|t«r t|«} |jj |«y#t $rB|jj |j |j|j««Yyt$rát|t«rA|jj |j |j|j««Yy|jtjtjfvr'|jjj |«Yy|jj t||j|j««YywxYw)z› Write `data` to self.destination. Ignore, if self.destination is False. `data` can be a `bytes`, `str`, or `Exception` instance. N)rjr@Ú ExceptionrArpÚUnicodeEncodeErrorrrrr{rrwrxÚstdoutÚbufferr|ros rrpzErrorOutput.writeGs$€ð ×ÒØ Ü �dœIÔ &Ü�t“9ˆDð BØ × Ñ × "Ñ " 4Õ (øÜ!ò FØ × Ñ × "Ñ " 4§;¡;¨t¯}©}Ø/3×/CÑ/Có$Eö Fäò Bܘ$¤Ô$Ø× Ñ ×&Ñ& t§{¡{°4·=±=Ø37×3GÑ3Gó(IöJà×!Ñ!¤c§j¡j´#·*±*Ð%=Ñ=à× Ñ ×'Ñ'×-Ñ-¨dÖ3à× Ñ ×&Ñ&¤s¨4°·±Ø+/×+?Ñ+?ó(AöBð Bús&ªAÁAE9ÂAE9Ã)AE9Ä<:E9Å8E9có²—|jtjtjfvry |jj «y#t $rYywxYw)z– Close the error-output stream. Ignored if the destination is` sys.stderr` or `sys.stdout` or has no close() method. N)rjrwr€rxÚcloserr.s rrƒzErrorOutput.closeasK€ð × Ñ ¤§ ¡ ¬C¯J©JÐ7Ñ 7Ø ð Ø × Ñ × "Ñ "Õ $øÜò Ù ð ús¯A Á AÁAcóV— |jj«S#t$rYywxYw)z=Return True, if the destination is connected to a TTY device.F)rjr[rr.s rr[zErrorOutput.isattyos.€ð Ø×#Ñ#×*Ñ*Ó,Ð ,øÜò Ùð úr\)NNÚbackslashreplacerE)r r r r_r,rprƒr[rrrrtrts(„ñð 37Ø!3Ø!*ó&òBBò4 órrtcó0—eZdZdZ dd„Zd„Zd„Zd„Zy)Ú FileInputz5 Input for single, simple file-like objects. NcóV—tj|||||«||_t«|_|€F|r. t |||j xsd|j¬«|_nhtj|_nRt|j|j «dur0t!d|j ›d|jj ›d�«‚|s |jj"|_yy#t$r&}t|j|j|«‚d}~wwxYw#t&$rYywxYw)aƒ :Parameters: - `source`: either a file-like object (which is read directly), or `None` (which implies `sys.stdin` if no `source_path` given). - `source_path`: a path to a file, which is opened and then read. - `encoding`: the expected text encoding of the input file. - `error_handler`: the encoding error handler to use. - `autoclose`: close automatically after read (except when `sys.stdin` is the source). - `mode`: how the file is to be opened (see standard function `open`). The default is read only ('r'). Nz utf-8-sig©rÚerrorsFz#Encoding clash: encoding given is "z&" but source is opened with encoding "z".)r"r,Ú autoclosertÚ_stderrryrr&r'ÚOSErrorr ÚerrnoÚstrerrorrwÚstdinrrFÚnamer(r)r+r'r(rr&r‹ÚmoderLs rr,zFileInput.__init__|s€ô �‰�t˜V [°(¸MÔJØ"ˆŒÜ"“}ˆŒ à ˆ>ÙðOÜ"& {°DØ04· ± Ò0LÀØ.2×.@Ñ.@ô#B�D•Kô "Ÿi™i�• Ü ˜DŸK™K¨¯©Ó 7¸5Ñ @åà $§ £ ¨t¯{©{×/CÓ/Cð EóFð Fñð Ø#'§;¡;×#3Ñ#3�Õ ðøôòOÜ$ U§[¡[°%·.±.À+ÓNÐNûðOûô"ò Ùð ús)µ,C*à DÃ* DÃ3!DÄDÄ D(Ä'D(cój— |jtjur%|jjj «}n|jj «}|jr|j« |j|«}dj|j«dgz«S#t t f$rS|jsC|jr7t|jd«}|j «}|j«n‚YŒ²wxYw#|jr|j«wwxYw)zU Read and decode a single file and return the data (Unicode string). ÚrbÚ r7)r'rwr�r�r3rFrrr(ryrƒr‹rMrGrS)r+rHÚb_sources rr3zFileInput.read¤sê€ð Ø�{‰{œcŸi™iÑ'à—{‘{×)Ñ)×.Ñ.Ó0‘à—{‘{×'Ñ'Ó)�ð�~Š~Ø— ‘ • Ø�{‰{˜4Ó ˆà�y‰y˜Ÿ™Ó*¨B¨4Ñ/Ó0Ð0øôœkÐ*ò Ø—=’= T×%5Ò%5ä × 0Ñ 0°$Ó7�Ø—}‘}“�Ø—‘Õ àñ!ð  ûð�~Š~Ø— ‘ • ðús%‚AB.Â.ADÄ DÄDÄDÄD2có@—|j«jd«S)zK Return lines of a single file as list of Unicode strings. T)r3rSr.s rÚ readlineszFileInput.readlines½s€ð�y‰y‹{×%Ñ% dÓ+Ð+rcór—|jtjur|jj«yyr%)r'rwr�rƒr.s rrƒzFileInput.closeÃs'€Ø �;‰;œcŸi™iÑ 'Ø �K‰K× Ñ Õ ð (r)NNNr^TÚr)r r r r_r,r3r˜rƒrrrr‡r‡ws'„ñð15Ø.6Ø&)ó&òP1ò2,ó  rr‡có:—eZdZdZdZdZ d d„Zd„Zd„Zd„Z y) Ú FileOutputz,Output for single, simple file-like objects.zrvNcó$—tj|||||«d|_||_|�t j dt d¬«|�||_t«|_ |€ |rd|_nytj|_ nc|rat|jd«rK||jjk7r2td|jj›d |›d �|j¬ «|s |jj|_yy#t"$rYywxYw) aA :Parameters: - `destination`: either a file-like object (which is written directly) or `None` (which implies `sys.stdout` if no `destination_path` given). - `destination_path`: a path to a file, which is opened and then written. - `encoding`: the text encoding of the output file. - `error_handler`: the encoding error handler to use. - `autoclose`: close automatically after write (except when `sys.stdout` or `sys.stderr` is the destination). - `handle_io_errors`: ignored, deprecated, will be removed. - `mode`: how the file is to be opened (see standard function `open`). The default is 'w', providing universal newline support for text files. TNz_io.FileOutput: init argument "handle_io_errors" is ignored and will be removed in Docutils 2.0.rO)Ú stacklevelFr’zWarning: Destination mode "z" differs from specified mode "Ú")Úfile)rgr,Úopenedr‹ÚwarningsÚwarnÚDeprecationWarningr’rtrŒrwr€rjÚhasattrÚprintr‘rkr)r+rjrkrr&r‹Úhandle_io_errorsr’s rr,zFileOutput.__init__Ôsý€ô& �‰˜˜kÐ+;Ø  -ô 1àˆŒ Ø"ˆŒØ Ð 'Ü �M‰Mð*ä+=È!õ Mð Р؈DŒIÜ"“}ˆŒ Ø Ð ÙØ#�• ä#&§:¡:�Õ á”w˜t×/Ñ/°Ô8ؘ$×*Ñ*×/Ñ/Ò/Ý Ø!%×!1Ñ!1×!6Ó!6ºð>à—|‘|õ %ñ ð Ø(,×(8Ñ(8×(=Ñ(=�Õ%ð øô"ò Ùð úsÃ&DÄ DÄDcó,—d|jvr|j|jdœ}ni} t|j|jfi|¤Ž|_d|_ y#t $r0}t|j|j|j«‚d}~wwxYw)NÚbr‰T) r’rr&ryrkrjr�rrŽr�r¡)r+ÚkwargsrLs rryzFileOutput.opensŒ€à �d—i‘iÑ Ø"&§-¡-Ø $× 2Ñ 2ñ4‰FðˆFð 5Ü# D×$9Ñ$9¸4¿9¹9ÑOÈÑOˆDÔ ðˆ� øôò 5ܘeŸk™k¨5¯>©>Ø"×3Ñ3ó5ð 5ûð 5ús¬&AÁ BÁ#+BÂBc ó—|js|j«t|t«rft |j |j «durDtjdk7r |jdtj«}|j|«} |j j|«|j*r|j-«|S#t$r¯}t|t«r• |j jj|«nn#t$rbt |j |j «dur=t!d|j"›d|j j ›d|j ›d�«‚|‚wxYwYd}~ŒÑd}~wt$t&f$r*}t%d|j ›d t)|«›d�«‚d}~wwxYw#|j*r|j-«wwxYw) aBWrite `data` to a single file, also return it. `data` can be a `str` or `bytes` instance. If writing `bytes` fails, an attempt is made to write to the low-level interface ``self.destination.buffer``. If `data` is a `str` instance and `self.encoding` and `self.destination.encoding` are set to different values, `data` is encoded to a `bytes` instance using `self.encoding`. Provisional: future versions may raise an error if `self.encoding` and `self.destination.encoding` are set to different values. Fr•z Encoding of z (z&) differs from specified encoding (r>Nz2Unable to encode output data. output-encoding is: r=)r¡ryr@rArrjrÚosÚlineseprErrrprÚbytesr�rÚ ValueErrorrkrFrr r‹rƒ)r+rHrs rrpzFileOutput.writes¤€ð�{Š{Ø �I‰IŒKÜ �tœSÔ !ܘt×/Ñ/°·±Ó?À5ÑHÜ�z‰z˜TÒ!Ø—|‘| D¬"¯*©*Ó5�Ø—;‘;˜tÓ$ˆDð Ø × Ñ × "Ñ " 4Ô (ð&�~Š~Ø— ‘ ” ؈ øô)ò "ܘ$¤Ô&ð "Ø×$Ñ$×+Ñ+×1Ñ1°$Õ7øÜ%ò"Ü% d×&6Ñ&6Ø&*§m¡mó5Ø8=ñ>ä(Ø*¨4×+@Ñ+@Ð*AðB Ø $× 0Ñ 0× 9Ñ 9Ð:ð;:Ø:>¿-¹-¸ÈðKóLðLð "˜ ð"ÿûôœkÐ*ò <ÜØDØ—=‘=�/ ¤l°3Ó&7Ð%8¸ð;ó<ð <ûð <ûð �~Š~Ø— ‘ • ðúsOÂC à F<ÃFÃ'%D Ä FÄ A+E8Å8FÅ;F?ÆF<Æ%F7Æ7F<Æ<F?Æ?Gcó —|jtjtjfvr"|jj «d|_yy)NF)rjrwr€rxrƒr¡r.s rrƒzFileOutput.close?s;€Ø × Ñ ¤C§J¡J´· ± Ð#;Ñ ;Ø × Ñ × "Ñ "Ô $؈D�Kð có8—|j|j«S)z`Return the source as `str` instance. Decode, if required (see `Input.decode`). )rMr'r.s rr3zStringInput.readSs€ð �{‰{˜4Ÿ;™;Ó'Ð'rN©r r r r_r)r3rrrrµrµNs„Ù1à$Ðó(rrµcó—eZdZdZdZd„Zy)Ú StringOutputz=Output to a `bytes` or `str` instance. Provisional. r¶cóF—|j|«|_|jS)avStore `data` in `self.destination`, and return it. If `self.encoding` is set to the pseudo encoding name "unicode", `data` must be a `str` instance and is stored/returned unchanged (cf. `Output.encode`). Otherwise, `data` can be a `bytes` or `str` instance and is stored/returned as a `bytes` instance (`str` data is encoded with `self.encode()`). Attention: the `output_encoding`_ setting may affect the content of the output (e.g. an encoding declaration in HTML or XML or the representation of characters as LaTeX macro vs. literal character). )rrrjros rrpzStringOutput.writecs!€ð Ÿ;™; tÓ,ˆÔØ×ÑÐrN©r r r r_rlrprrrrºrº[s„ñð *Ðó rrºcó—eZdZdZdZd„Zy)Ú NullInputzDegenerate input: read nothing.z null inputcó—y)zReturn an empty string.r7rr.s rr3zNullInput.read|s€àrNr¸rrrr¾r¾vs„á)à&Ðórr¾có—eZdZdZdZd„Zy)Ú NullOutputz!Degenerate output: write nothing.z null outputcó—y)zDo nothing, return None.Nrros rrpzNullOutput.write‡s€à rNr¼rrrrÁrÁ�s„á+à,Ðó rrÁcó—eZdZdZdZd„Zy)Ú DocTreeInputzm Adapter for document tree input. The document tree must be passed in the ``source`` parameter. z doctree inputcó—|jS)zReturn the document tree.)r'r.s rr3zDocTreeInput.read–s €à�{‰{ÐrNr¸rrrrÄrÄŒs„ñð *ÐórrÄ)&r_Ú __docformat__rÚlocaler¬rarwr¢ÚdocutilsrÚcatch_warningsÚ simplefilterÚ getlocaleÚgetdefaultlocalerCr?r¯rLÚargsrrrr�r rrr r"rgrtr‡rœr²rµrºr¾rÁrÄrrrÚrÎs¥ðñ ð #€ ã Û Û Û Û Ûå"ðà ˆ× Ñ Õ "؈×јhÔ'Ø,˜F×,Ñ,Ó.¨qÑ1ò<Ø6˜v×6Ñ6Ó8¸Ñ;ð à+×1Ñ1Ó3Ð÷ #ðØ€F‡M�MÐ"Ô#ô  �ÔÜ �'Ô ò ò .ô QˆMôQôh;Bˆ]ô;B÷|UñUôpN �ôN ôbz �ôz ôz�zôô (�%ô (ô �6ô ô6�ôô �ô ô �5õ ÷] #Ð "ûð ò ð %§*¡*Ñ,Ø"ÑàÐÿøðØÒûð �YÐòØÒðúsA¤D>µA D2ÂD> E'Ä2D;Ä7D>Ä>E$ÅEÅE$Å' E3Å2E3