Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3
Døªj ã @ s8 d dl mZmZmZ ddlmZ d
dd„Zddd „ZdS )é )ÚUTF8ÚdecodeÚlookupé )Úparse_stylesheetNc C s– |rt |ƒ}|rt| |ƒS | jdƒr~| jdddƒ}|d
kr~| jd|ƒr~t | d|… jdƒƒ}|r~|jdkrtt| tƒS t| |ƒS |rŒt| |ƒS t| tƒS )aB Determine the character encoding of a CSS stylesheet and decode it.
This is based on the presence of a :abbr:`BOM (Byte Order Mark)`,
a ``@charset`` rule, and encoding meta-information.
:type css_bytes: :obj:`bytes`
:param css_bytes: A CSS byte string.
:type protocol_encoding: :obj:`str`
:param protocol_encoding:
The encoding label, if any, defined by HTTP or equivalent protocol.
(e.g. via the ``charset`` parameter of the ``Content-Type`` header.)
:type environment_encoding: :class:`webencodings.Encoding`
:param environment_encoding:
The `environment encoding
`_, if any.
:returns:
A 2-tuple of a decoded Unicode string and the
:class:`webencodings.Encoding` object that was used.
s
@charset "ó "é
éd r s ";Úlatin1úutf-16beúutf-16leéÿÿÿÿ)r r )r r Ú
startswithÚfindÚnamer )Ú css_bytesÚprotocol_encodingÚenvironment_encodingÚfallbackZ end_quote© r ú2/tmp/pip-build-_d5lkt3n/tinycss2/tinycss2/bytes.pyÚdecode_stylesheet_bytes s
r Fc C s$ t | ||ƒ\}}t|||ƒ}||fS )a} Parse :diagram:`stylesheet` from bytes,
determining the character encoding as web browsers do.
This is used when reading a file or fetching a URL.
The character encoding is determined from the initial bytes
(a :abbr:`BOM (Byte Order Mark)` or a ``@charset`` rule)
as well as the parameters. The ultimate fallback is UTF-8.
:type css_bytes: :obj:`bytes`
:param css_bytes: A CSS byte string.
:type protocol_encoding: :obj:`str`
:param protocol_encoding:
The encoding label, if any, defined by HTTP or equivalent protocol.
(e.g. via the ``charset`` parameter of the ``Content-Type`` header.)
:type environment_encoding: :class:`webencodings.Encoding`
:param environment_encoding:
The `environment encoding`_, if any.
:type skip_comments: :obj:`bool`
:param skip_comments:
Ignore CSS comments at the top-level of the stylesheet.
If the input is a string, ignore all comments.
:type skip_whitespace: :obj:`bool`
:param skip_whitespace:
Ignore whitespace at the top-level of the stylesheet.
Whitespace is still preserved
in the :attr:`~tinycss2.ast.QualifiedRule.prelude`
and the :attr:`~tinycss2.ast.QualifiedRule.content` of rules.
:returns:
A ``(rules, encoding)`` tuple.
* ``rules`` is a list of
:class:`~tinycss2.ast.QualifiedRule`,
:class:`~tinycss2.ast.AtRule`,
:class:`~tinycss2.ast.Comment` (if ``skip_comments`` is false),
:class:`~tinycss2.ast.WhitespaceToken`
(if ``skip_whitespace`` is false),
and :class:`~tinycss2.ast.ParseError` objects.
* ``encoding`` is the :class:`webencodings.Encoding` object
that was used.
If ``rules`` contains an ``@import`` rule, this is
the `environment encoding`_ for the imported stylesheet.
.. _environment encoding:
https://www.w3.org/TR/css-syntax/#environment-encoding
.. code-block:: python
response = urlopen('http://example.net/foo.css')
rules, encoding = parse_stylesheet_bytes(
css_bytes=response.read(),
# Python 3.x
protocol_encoding=response.info().get_content_type().get_param('charset'),
# Python 2.x
protocol_encoding=response.info().gettype().getparam('charset'),
)
for rule in rules:
...
)r r )r r r Z
skip_commentsZskip_whitespaceZcss_unicodeÚencodingZ
stylesheetr r r Úparse_stylesheet_bytes0 s >r )NN)NNFF)Úwebencodingsr r r Úparserr r r r r r r Ú s
)