![]() |
Qucs-S S-parameter Viewer & RF Synthesis Tools
|
Namespaces | |
| namespace | labels |
| namespace | mklabels |
| namespace | tests |
| namespace | x_user_defined |
Classes | |
| class | Encoding |
| class | IncrementalDecoder |
| class | IncrementalEncoder |
Functions | |
| ascii_lower (string) | |
| lookup (label) | |
| _get_encoding (encoding_or_label) | |
| decode (input, fallback_encoding, errors='replace') | |
| _detect_bom (input) | |
| encode (input, encoding=UTF8, errors='strict') | |
| iter_decode (input, fallback_encoding, errors='replace') | |
| _iter_decode_generator (input, decoder) | |
| iter_encode (input, encoding=UTF8, errors='strict') | |
| _iter_encode_generator (input, encode) | |
Variables | |
| str | VERSION = '0.5.1' |
| dict | PYTHON_NAMES |
| dict | CACHE = {} |
| UTF8 = lookup('utf-8') | |
| _UTF16LE = lookup('utf-16le') | |
| _UTF16BE = lookup('utf-16be') | |
webencodings
~~~~~~~~~~~~
This is a Python implementation of the `WHATWG Encoding standard
<http://encoding.spec.whatwg.org/>`. See README for details.
:copyright: Copyright 2012 by Simon Sapin
:license: BSD, see LICENSE for details.
|
protected |
Return (bom_encoding, input), with any BOM removed from the input.
|
protected |
Accept either an encoding object or label. :param encoding: An :class:`Encoding` object or a label string. :returns: An :class:`Encoding` object. :raises: :exc:`~exceptions.LookupError` for an unknown label.
|
protected |
Return a generator that first yields the :obj:`Encoding`, then yields output chukns as Unicode strings.
| pip._vendor.webencodings.ascii_lower | ( | string | ) |
Transform (only) ASCII letters to lower case: A-Z is mapped to a-z.
:param string: An Unicode string.
:returns: A new Unicode string.
This is used for `ASCII case-insensitive
<http://encoding.spec.whatwg.org/#ascii-case-insensitive>`_
matching of encoding labels.
The same matching is also used, among other things,
for `CSS keywords <http://dev.w3.org/csswg/css-values/#keywords>`_.
This is different from the :meth:`~py:str.lower` method of Unicode strings
which also affect non-ASCII characters,
sometimes mapping them into the ASCII range:
>>> keyword = u'Bac\N{KELVIN SIGN}ground'
>>> assert keyword.lower() == u'background'
>>> assert ascii_lower(keyword) != keyword.lower()
>>> assert ascii_lower(keyword) == u'bac\N{KELVIN SIGN}ground'
| pip._vendor.webencodings.decode | ( | input, | |
| fallback_encoding, | |||
errors = 'replace' |
|||
| ) |
Decode a single string.
:param input: A byte string
:param fallback_encoding:
An :class:`Encoding` object or a label string.
The encoding to use if :obj:`input` does note have a BOM.
:param errors: Type of error handling. See :func:`codecs.register`.
:raises: :exc:`~exceptions.LookupError` for an unknown encoding label.
:return:
A ``(output, encoding)`` tuple of an Unicode string
and an :obj:`Encoding`.
| pip._vendor.webencodings.encode | ( | input, | |
encoding = UTF8, |
|||
errors = 'strict' |
|||
| ) |
Encode a single string. :param input: An Unicode string. :param encoding: An :class:`Encoding` object or a label string. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. :return: A byte string.
| pip._vendor.webencodings.iter_decode | ( | input, | |
| fallback_encoding, | |||
errors = 'replace' |
|||
| ) |
"Pull"-based decoder.
:param input:
An iterable of byte strings.
The input is first consumed just enough to determine the encoding
based on the precense of a BOM,
then consumed on demand when the return value is.
:param fallback_encoding:
An :class:`Encoding` object or a label string.
The encoding to use if :obj:`input` does note have a BOM.
:param errors: Type of error handling. See :func:`codecs.register`.
:raises: :exc:`~exceptions.LookupError` for an unknown encoding label.
:returns:
An ``(output, encoding)`` tuple.
:obj:`output` is an iterable of Unicode strings,
:obj:`encoding` is the :obj:`Encoding` that is being used.
| pip._vendor.webencodings.iter_encode | ( | input, | |
encoding = UTF8, |
|||
errors = 'strict' |
|||
| ) |
“Pull”-based encoder. :param input: An iterable of Unicode strings. :param encoding: An :class:`Encoding` object or a label string. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. :returns: An iterable of byte strings.
| pip._vendor.webencodings.lookup | ( | label | ) |
Look for an encoding by its label.
This is the spec’s `get an encoding
<http://encoding.spec.whatwg.org/#concept-encoding-get>`_ algorithm.
Supported labels are listed there.
:param label: A string.
:returns:
An :class:`Encoding` object, or :obj:`None` for an unknown label.
| dict pip._vendor.webencodings.PYTHON_NAMES |