ok

Mini Shell

Direktori : /lib/python2.7/site-packages/pip/_vendor/webencodings/
Upload File :
Current File : //lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pyo

�
��abc@s6dZddlmZddlZddlmZdZidd6d	d
6dd6d
d6ZiZd�Z	d�Z
d�Zdefd��YZ
e
d�Ze
d�Ze
d�Zdd�Zd�Zedd�Zdd�Zd�Zedd�Zd�Zd efd!��YZd"efd#��YZdS($u

    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.

i����(tunicode_literalsNi(tLABELSu0.5u
iso-8859-8uiso-8859-8-iumac-cyrillicux-mac-cyrillicu	mac-romanu	macintoshucp874uwindows-874cCs|jd�j�jd�S(u9Transform (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'

    uutf8(tencodetlowertdecode(tstring((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pytascii_lower#scCs�t|jd��}tj|�}|dkr4dStj|�}|dkr�|dkrnddlm}n!tj||�}t	j
|�}t||�}|t|<n|S(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.

    u	

 ux-user-definedi(t
codec_infoN(RtstripRtgettNonetCACHEtx_user_definedRtPYTHON_NAMEStcodecstlookuptEncoding(tlabeltnametencodingRtpython_name((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pyR=s

cCsBt|d�r|St|�}|dkr>td|��n|S(u�
    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.

    u
codec_infouUnknown encoding label: %rN(thasattrRR
tLookupError(tencoding_or_labelR((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pyt
_get_encoding[s	RcBs eZdZd�Zd�ZRS(uOReresents 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`.

    cCs||_||_dS(N(RR(tselfRR((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pyt__init__|s	cCsd|jS(Nu
<Encoding %s>(R(R((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pyt__repr__�s(t__name__t
__module__t__doc__RR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pyRms	uutf-8uutf-16leuutf-16beureplacecCsGt|�}t|�\}}|p'|}|jj||�d|fS(u�
    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`.

    i(Rt_detect_bomRR(tinputtfallback_encodingterrorstbom_encodingR((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pyR�scCsa|jd�rt|dfS|jd�r:t|dfS|jd�rWt|dfSd|fS(uBReturn (bom_encoding, input), with any BOM removed from the input.s��is��siN(t
startswitht_UTF16LEt_UTF16BEtUTF8R
(R ((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pyR�sustrictcCst|�jj||�dS(u;
    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.

    i(RRR(R RR"((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pyR�scCs4t||�}t||�}t|�}||fS(u�
    "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.

    (tIncrementalDecodert_iter_decode_generatortnext(R R!R"tdecodert	generatorR((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pytiter_decode�sccs�|j}t|�}x]|D])}||�}|r|jV|VPqqW|ddt�}|jV|rq|VndSx(|D] }||�}|r||Vq|q|W|ddt�}|r�|VndS(uqReturn a generator that first yields the :obj:`Encoding`,
    then yields output chukns as Unicode strings.

    ttfinalN(RtiterRtTrue(R R+Rtchuncktoutput((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pyR)�s(	

cCst||�j}t||�S(uY
    “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.

    (tIncrementalEncoderRt_iter_encode_generator(R RR"R((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pytiter_encode�sccsOx(|D] }||�}|r|VqqW|ddt�}|rK|VndS(NuR/(R1(R RR2R3((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pyR5s
R(cBs&eZdZdd�Zed�ZRS(uO
    “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.

    ureplacecCs7t|�|_||_d|_d|_d|_dS(NR.(Rt_fallback_encodingt_errorst_bufferR
t_decoderR(RR!R"((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pyRs
			cCs�|j}|dk	r"|||�S|j|}t|�\}}|dkrt|�dkrs|rs||_dS|j}n|jj|j�j	}||_||_
|||�S(u�Decode 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.

        iuN(R:R
R9RtlenR7RtincrementaldecoderR8RR(RR R/R+R((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pyR's
	

			(RRRRtFalseR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pyR(s
R4cBseZdZedd�ZRS(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.

    ustrictcCs(t|�}|jj|�j|_dS(N(RRtincrementalencoderR(RRR"((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pyRTs(RRRR'R(((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pyR4Cs(Rt
__future__RRtlabelsRtVERSIONR
RRRRtobjectRR'R%R&RRRR-R)R6R5R(R4(((sE/usr/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.pyt<module>
s4
					 	
3

Zerion Mini Shell 1.0