o
    /h                     @   s   d Z dgZG dd deZdS )zoCSSRuleList implements DOM Level 2 CSS CSSRuleList.
Partly also http://dev.w3.org/csswg/cssom/#the-cssrulelist.CSSRuleListc                   @   sL   e Zd ZdZdd Zdd Ze Z Z ZZ	dd Z
edd	 Zd
d ZdS )r   a  The CSSRuleList object represents an (ordered) list of statements.

    The items in the CSSRuleList are accessible via an integral index,
    starting from 0.

    Subclasses a standard Python list so theoretically all standard list
    methods are available. Setting methods like ``__init__``, ``append``,
    ``extend`` or ``__setslice__`` are added later on instances of this
    class if so desired.
    E.g. CSSStyleSheet adds ``append`` which is not available in a simple
    instance of this class!
    c                 G   s   dS )z2Nothing is set as this must also be defined later.N selfignoredr   r   L/var/www/html/myenv/lib/python3.10/site-packages/cssutils/css/cssrulelist.py__init__   s   zCSSRuleList.__init__c                 G   s   t d)z.Implemented in class using a CSSRuleList only.z=Must be implemented by class using an instance of this class.)NotImplementedErrorr   r   r   r   __notimplemented   s   zCSSRuleList.__notimplementedc                 C   s    z| | W S  t y   Y dS w )a  (DOM) Retrieve a CSS rule by ordinal `index`. The order in this
        collection represents the order of the rules in the CSS style
        sheet. If index is greater than or equal to the number of rules in
        the list, this returns None.

        Returns CSSRule, the style rule at the index position in the
        CSSRuleList, or None if that is not a valid index.
        N)
IndexError)r   indexr   r   r   item!   s
   	
zCSSRuleList.itemc                 C   s   t | S )z)(DOM) The number of CSSRules in the list.)len)r   r   r   r   length/   s   zCSSRuleList.lengthc                 c   s     | D ]
}|j |kr|V  qdS )zxYield the rules which have the given `type` only, one of the
        constants defined in :class:`cssutils.css.CSSRule`.N)type)r   r   rr   r   r   rulesOfType4   s   
zCSSRuleList.rulesOfTypeN)__name__
__module____qualname____doc__r   _CSSRuleList__notimplementedappendextend__setitem____setslice__r   propertyr   r   r   r   r   r   r      s    
N)r   __all__listr   r   r   r   r   <module>   s    