Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
docutils.io.Input Class Reference
Inheritance diagram for docutils.io.Input:
Inheritance graph
[legend]
Collaboration diagram for docutils.io.Input:
Collaboration graph
[legend]

Public Member Functions

 __init__ (self, source=None, source_path=None, encoding=None, error_handler='strict')
 
 __repr__ (self)
 
 read (self)
 
 decode (self, data)
 
 determine_encoding_from_data (self, data)
 
 isatty (self)
 
- Public Member Functions inherited from docutils.TransformSpec
 get_transforms (self)
 

Public Attributes

 encoding
 
 error_handler
 
 source
 
 source_path
 
 successful_encoding
 
- Public Attributes inherited from docutils.TransformSpec
 default_transforms
 

Static Public Attributes

str component_type = 'input'
 
 default_source_path = None
 
 coding_slug = re.compile(br"coding[:=]\s*([-\w.]+)")
 
tuple byte_order_marks
 
- Static Public Attributes inherited from docutils.TransformSpec
tuple default_transforms = ()
 
tuple unknown_reference_resolvers = ()
 

Detailed Description

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.)

Constructor & Destructor Documentation

◆ __init__()

docutils.io.Input.__init__ (   self,
  source = None,
  source_path = None,
  encoding = None,
  error_handler = 'strict' 
)

Member Function Documentation

◆ decode()

docutils.io.Input.decode (   self,
  data 
)
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 and the locale's preferred encoding.
The client application should call ``locale.setlocale()`` at the
beginning of processing::

    locale.setlocale(locale.LC_ALL, '')

Raise UnicodeError if unsuccessful.

Provisional: encoding detection will be removed in Docutils 1.0.

◆ determine_encoding_from_data()

docutils.io.Input.determine_encoding_from_data (   self,
  data 
)
Try to determine the encoding of `data` by looking *in* `data`.
Check for a byte order mark (BOM) or an encoding declaration.

◆ isatty()

docutils.io.Input.isatty (   self)
Return True, if the input source is connected to a TTY device.

◆ read()

docutils.io.Input.read (   self)
Return input as `str`. Define in subclasses.

Reimplemented in docutils.io.FileInput, docutils.io.StringInput, docutils.io.NullInput, and docutils.io.DocTreeInput.

Member Data Documentation

◆ byte_order_marks

tuple docutils.io.Input.byte_order_marks
static
Initial value:
= ((codecs.BOM_UTF32_BE, 'utf-32'),
(codecs.BOM_UTF32_LE, 'utf-32'),
(codecs.BOM_UTF8, 'utf-8-sig'),
(codecs.BOM_UTF16_BE, 'utf-16'),
(codecs.BOM_UTF16_LE, 'utf-16'),
)

The documentation for this class was generated from the following file: