| 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 : /lib/python3/dist-packages/css_parser/css/__pycache__/ |
Upload File : |
�
��3e� � �| � d Z ddlmZmZmZmZ dgZdZdZddl Z ddl
mZ ddlZddl
Z G d � dej � Zy)
z9CSSCharsetRule implements DOM Level 2 CSS CSSCharsetRule.� )�unicode_literals�division�absolute_import�print_function�CSSCharsetRule�restructuredtextz$Id$N� )�cssrulec � � � e Zd ZdZ d� fd� Zd� Zd� Zd� Z� fd�Z e eed�� Z
d � Z e d
� ed�� Z e d
� d�� Z
e d� � Z� xZS )r a�
The CSSCharsetRule interface represents an @charset rule in a CSS style
sheet. The value of the encoding attribute does not affect the encoding
of text data in the DOM objects; this encoding is always UTF-16
(also in Python?). After a stylesheet is loaded, the value of the
encoding attribute is the value found in the @charset rule. If there
was no @charset in the original document, then no CSSCharsetRule is
created. The value of the encoding attribute may also be used as a hint
for the encoding used on serialization of the style sheet.
The value of the @charset rule (and therefore of the CSSCharsetRule)
may not correspond to the encoding the document actually came in;
character encoding information e.g. in an HTTP header, has priority
(see CSS document representation) but this is not reflected in the
CSSCharsetRule.
This rule is not really needed anymore as setting
:attr:`CSSStyleSheet.encoding` is much easier.
Format::
charsetrule:
CHARSET_SYM S* STRING S* ';'
BUT: Only valid format is (single space, double quotes!)::
@charset "ENCODING";
c �| �� t t | � ||�� d| _ |r|| _ || _ yd| _ || _ y)z�
:param encoding:
a valid character encoding
:param readonly:
defaults to False, not used yet
)�
parentRule�parentStyleSheetz@charsetN)�superr �__init__�
_atkeyword�encoding� _encoding� _readonly)�selfr r
r �readonly� __class__s ��?/usr/lib/python3/dist-packages/css_parser/css/csscharsetrule.pyr zCSSCharsetRule.__init__, sI �� � �n�d�,�
�>N� -� P�$����$�D�M� "��� "�D�N�!��� c �P � d| j j �d| j �d�S )Nzcss_parser.css.z
(encoding=�))r �__name__r �r s r �__repr__zCSSCharsetRule.__repr__? s � ��N�N�#�#��M�M�� r c �` � d| j j | j t | � fz S )Nz.<css_parser.css.%s object encoding=%r at 0x%x>)r r r �idr s r �__str__zCSSCharsetRule.__str__D s0 � �?��N�N�#�#��M�M��t�H�C� � r c �@ � t j j | � S )z$The parsable textual representation.)�
css_parser�ser�do_CSSCharsetRuler s r �_getCssTextzCSSCharsetRule._getCssTextJ s � ��~�~�/�/��5�5r c �, �� t t | � |� d}| j |� }| j | j |� � | j j k7 r7d}| j j dt j j �� | j |� }| j |� }| j |� }| j j |k7 s|s/d}| j j d| j |� z � | j! | j |� � }| j | j |� � }d|k7 s|dvr/d}| j j d| j |� z � |r|| _ y y )
a�
:param cssText:
A parsable DOMString.
:exceptions:
- :exc:`~xml.dom.SyntaxErr`:
Raised if the specified CSS string value has a syntax error and
is unparsable.
- :exc:`~xml.dom.InvalidModificationErr`:
Raised if the specified CSS string value represents a different
type of rule than the current one.
- :exc:`~xml.dom.HierarchyRequestErr`:
Raised if the rule cannot be inserted at this point in the
style sheet.
- :exc:`~xml.dom.NoModificationAllowedErr`:
Raised if the rule is readonly.
TFz*CSSCharsetRule must start with "@charset ")�errorz&CSSCharsetRule: no encoding found; %r.�;)�EOFNz!CSSCharsetRule: Syntax Error: %r.N)r r �_setCssText�
_tokenize2�_type�
_nexttoken�_prods�CHARSET_SYM�_logr( �xml�dom�InvalidModificationErr�_stringtokenvalue�STRING� _valuestr�_tokenvaluer )
r �cssText�
wellformed� tokenizer�
encodingtoken�encodingtyper � semicolon�EOFtyper s
�r r+ zCSSCharsetRule._setCssTextN s\ �� �"