Viewing File: /opt/imunify360/venv/lib/python3.11/site-packages/docutils/__pycache__/io.cpython-311.pyc
]j] 8 d Z dZddlZddlZddlZddlZddlZddlZddlm Z ej
5 ej d ej d p ej
d Ze Zddd n# 1 swxY w Y n$# e$ rZdej v rdZndZY dZ[ndZ[w dZY nxY w ej e n# eef$ r dZY nw xY w G d d
e Z G d de Zd
Zd Z G d de Z G d de Z G d d Z G d de Z G d de Z G d de Z G d de Z! G d de Z" G d d e Z# G d! d"e Z$ G d# d$e Z%dS )%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)
TransformSpecignore zunknown locale: UTF-8utf-8c e Zd ZdS )
InputErrorN__name__
__module____qualname__ k/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib/python3.11/site-packages/docutils/io.pyr r 3 r r c e Zd ZdS )OutputErrorNr
r r r r r 4 r r r c t j | j t j | k S # t t t
f$ r Y dS w xY w)aN Test, 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)codecslookupencodingLookupErrorAttributeError TypeError)streamr s r check_encodingr 7 sQ }V_--x1H1HHH3 tts .1 AAc $ | j j d| S )z5Return string representation of Exception `err`.
z: ) __class__r )errs r error_stringr G s m$-----r c e Zd ZdZdZdZ ddZd Zd Zd Z e
j d Z e
j d
fe
j dfe
j dffZ d
Zd ZdS )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.)
inputNstrictc p || _ || _ || _ || _ |s| j | _ d | _ d S N)r
error_handlersourcesource_pathdefault_source_pathsuccessful_encoding)selfr( r) r r' s r __init__zInput.__init__] sM
1**'&- 8#7D#' EEr c 4 | j d| j d| j S )Nz : source=z, source_path=)r r( r) r, s r __repr__zInput.__repr__q s( 26...$+++262B2BD Dr c t )z,Return input as `str`. Define in subclasses.NotImplementedErrorr/ s r readz
Input.readu !!r c | j r<| j dk rt |t s
J d t |t r|S | j r | j g}n_| | }|r|g}nDdg}t
r%t
dk r| t
| d |D ]W} t ||| j }|| _ | dd c S # t t f$ r}|}Y d}~Pd}~ww xY wt dd d
|D dt | d )
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` instancer zlatin-1u Nz=Unable to decode input data. Tried the following encodings: z, c 3 4 K | ]}t | V d S r&