OpenQuizz
Une application de gestion des contenus pédagogiques
pip._vendor.webencodings Namespace Reference

Namespaces

 labels
 
 mklabels
 
 tests
 
 x_user_defined
 

Data Structures

class  Encoding
 
class  IncrementalDecoder
 
class  IncrementalEncoder
 

Functions

def ascii_lower (string)
 
def lookup (label)
 
def decode (input, fallback_encoding, errors='replace')
 
def encode (input, encoding=UTF8, errors='strict')
 
def iter_decode (input, fallback_encoding, errors='replace')
 
def iter_encode (input, encoding=UTF8, errors='strict')
 

Variables

 VERSION
 
 PYTHON_NAMES
 
 CACHE
 
 UTF8
 

Function Documentation

◆ ascii_lower()

def 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()

def 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()

def 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()

def 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()

def 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()

def 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

◆ CACHE

CACHE

◆ PYTHON_NAMES

PYTHON_NAMES

◆ UTF8

UTF8

◆ VERSION

VERSION