+
    Of+)                         R t ^ RIt^RIHt RtRRRRRR	R
R/t/ tR tR tR t	 ! R R]
4      t]! R4      t]! R4      t]! R4      tR R ltR t]R3R ltR R ltR t]R3R ltR t ! R R]
4      t ! R R]
4      tR# )!z

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.

N)LABELSz0.6-devziso-8859-8-iz
iso-8859-8zx-mac-cyrilliczmac-cyrillic	macintoshz	mac-romanzwindows-874cp874c                ^    V P                  R4      P                  4       P                  R4      # )a  Transform (only) ASCII letters to lower case: A-Z is mapped to a-z.

:param string: A 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'

utf8)encodelowerdecode)strings   &H/usr/lib/python3/dist-packages/html5lib/contrib/webencodings/__init__.pyascii_lowerr   !   s'    . == &&(//77    c                >   \        V P                  R4      4      p \        P                  ! V 4      pVf   R# \        P                  V4      pVfN   VR8X  d   ^RIHp M+\        P                  W4      p\        P                  ! V4      p\        W4      pV\        V&   V# )u  
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.

z	
 Nzx-user-defined)
codec_info)r   stripr   getCACHEx_user_definedr   PYTHON_NAMEScodecslookupEncoding)labelnameencodingr   python_names   &    r   r   r   ;   s     K01E::eD|yyH##2&**46K{3JD-dOr   c                p    \        V R4      '       d   V # \        V 4      pVf   \        RV ,          4      hV# )z
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.

r   zUnknown encoding label: %r)hasattrr   LookupError)encoding_or_labelr   s   & r   _get_encodingr    Y   s@      ,//  '(H69JJKKOr   c                   0   a  ] tR t^kt o RtR tR tRtV tR# )r   a/  Reresents a character encoding such as UTF-8,
that can be used for decoding or encoding.

.. attribute:: name

    Canonical name of the encoding

.. attribute:: codec_info

    The actual implementation of the encoding,
    a stdlib :class:`~codecs.CodecInfo` object.
    See :func:`codecs.register`.

c                    Wn         W n        R # N)r   r   )selfr   r   s   &&&r   __init__Encoding.__init__z   s    	$r   c                (    R V P                   ,          # )z<Encoding %s>)r   )r$   s   &r   __repr__Encoding.__repr__~   s    **r   )r   r   N)	__name__
__module____qualname____firstlineno____doc__r%   r(   __static_attributes____classdictcell____classdict__s   @r   r   r   k   s     %+ +r   r   zutf-8zutf-16lezutf-16bec                    \        V4      p\        V 4      w  r0T;'       g    TpVP                  P                  W4      ^ ,          V3# )a  
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`.

)r    _detect_bomr   r	   )inputfallback_encodingerrorsbom_encodingr   s   &&&  r   r	   r	      sL      &&78%e,L000H%%e4Q7AAr   c                    V P                  R4      '       d   \        V R,          3# V P                  R4      '       d   \        V R,          3# V P                  R4      '       d   \        V R,          3# RV 3# )zBReturn (bom_encoding, input), with any BOM removed from the input.s   :   NNs   s   ﻿:   NNN)
startswith_UTF16LE_UTF16BEUTF8)r5   s   &r   r4   r4      sk    $$r""$$r""((U2Y;r   strictc                X    \        V4      P                  P                  W4      ^ ,          # )a  
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.

)r    r   r   )r5   r   r7   s   &&&r   r   r      s%     "--44UCAFFr   c                J    \        W4      p\        W4      p\        V4      pWE3# )a  
"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.

)IncrementalDecoder_iter_decode_generatornext)r5   r6   r7   decoder	generatorr   s   &&&   r   iter_decoderH      s+    , !!2;G&u6IIHr   c              #    "   VP                   p\        V 4      p V  F7  pV! V4      pV'       g   K  VP                  f   Q hVP                  x  Vx   M8	  V! RRR7      pVP                  f   Q hVP                  x  V'       d   Vx  R# V  F  pV! V4      pV'       g   K  Vx  K  	  V! RRR7      pV'       d   Vx  R# R# 5i)ziReturn a generator that first yields the :obj:`Encoding`,
then yields output chukns as Unicode strings.

Nr   Tfinal)r	   iterr   )r5   rF   r	   chunckoutputs   &&   r   rD   rD      s     
 ^^FKE6##///"""L  4(+++L6L  Ct$F s   *CACC$C>Cc                B    \        W4      P                  p\        W4      # )u=  
“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.

)IncrementalEncoderr   _iter_encode_generator)r5   r   r7   r   s   &&& r   iter_encoderR      s      188F!%00r   c              #   |   "   V  F  pV! V4      pV'       g   K  Vx  K  	  V! R RR7      pV'       d   Vx  R# R# 5i) TrJ   N )r5   r   rM   rN   s   &&  r   rQ   rQ     s=     6L  Bd#F s   <<<c                   8   a  ] tR tRt o RtRR ltRR ltRtV tR# )	rC   i  u3  
“Push”-based decoder.

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

c                \    \        V4      V n        W n        R V n        RV n        RV n        R# )r   N)r    _fallback_encoding_errors_buffer_decoderr   )r$   r6   r7   s   &&&r   r%   IncrementalDecoder.__init__  s,    "/0A"B
 r   c                X   V P                   pVe	   V! W4      # V P                  V,           p\        V4      w  rAVf-   \        V4      ^8  d   V'       g	   Wn        R# V P                  pVP
                  P                  V P                  4      P                  pW0n         W@n	        V! W4      # )zDecode one chunk of the input.

:param input: A byte string.
:param final:
    Indicate that no more input is available.
    Must be :obj:`True` if this is the last call.
:returns: An Unicode string.

rT   )
r[   rZ   r4   lenrX   r   incrementaldecoderrY   r	   r   )r$   r5   rK   rF   r   s   &&&  r   r	   IncrementalDecoder.decode%  s     --5((u$%e,5zA~e$22%%88FMM u$$r   )rZ   r[   rY   rX   r   Nreplace)F)	r*   r+   r,   r-   r.   r%   r	   r/   r0   r1   s   @r   rC   rC     s     	
% %r   rC   c                   2   a  ] tR tRt o Rt]R3R ltRtV tR# )rP   iA  u  
“Push”-based encoder.

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

.. method:: encode(input, final=False)

    :param input: An Unicode string.
    :param final:
        Indicate that no more input is available.
        Must be :obj:`True` if this is the last call.
    :returns: A byte string.

r@   c                p    \        V4      pVP                  P                  V4      P                  V n        R # r#   )r    r   incrementalencoderr   )r$   r   r7   s   &&&r   r%   IncrementalEncoder.__init__R  s*     *))<<VDKKr   )r   N)	r*   r+   r,   r-   r.   r?   r%   r/   r0   r1   s   @r   rP   rP   A  s       !%X L Lr   rP   ra   )r.   r   labelsr   VERSIONr   r   r   r   r    objectr   r?   r=   r>   r	   r4   r   rH   rD   rR   rQ   rC   rP   rU   r   r   <module>rj      s      
 Ln7	 	84<$+v +0 g**B,   G8@ !%X 1 0% 0%fL Lr   