Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Namespaces | Classes | Functions | Variables
pip._vendor.webencodings Namespace Reference

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

Detailed Description

    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.

Function Documentation

◆ _detect_bom()

pip._vendor.webencodings._detect_bom (   input)
protected
Return (bom_encoding, input), with any BOM removed from the input.

◆ _get_encoding()

pip._vendor.webencodings._get_encoding (   encoding_or_label)
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.

◆ _iter_decode_generator()

pip._vendor.webencodings._iter_decode_generator (   input,
  decoder 
)
protected
Return a generator that first yields the :obj:`Encoding`,
then yields output chukns as Unicode strings.

◆ ascii_lower()

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'

◆ decode()

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

◆ encode()

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.

◆ iter_decode()

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.

◆ iter_encode()

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.

◆ lookup()

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.

Variable Documentation

◆ PYTHON_NAMES

dict pip._vendor.webencodings.PYTHON_NAMES
Initial value:
1= {
2 'iso-8859-8-i': 'iso-8859-8',
3 'x-mac-cyrillic': 'mac-cyrillic',
4 'macintosh': 'mac-roman',
5 'windows-874': 'cp874'}