o
    ðäj�
  ã                   @   sj   d dl mZ d dlmZmZmZmZ d dlmZ ddl	m
Z
 d dlmZ G dd„ deƒZG d	d
„ d
ƒZdS )é    )ÚOrderedDict)ÚBoolÚSequenceÚAliasÚConvertible)ÚSerialisableé   )ÚRule)ÚMultiCellRangec                   @   sh   e Zd ZdZeed�ZedƒZe	dd�Z
eed�ZedƒZdd	d
„Zdd„ Zdd„ Zdd„ Zdd„ ZdS )ÚConditionalFormattingÚconditionalFormatting)Úexpected_typeÚsqrefT)Ú
allow_noneÚcfRule© Nc                 C   s   || _ || _|| _d S ©N)r   Úpivotr   )Úselfr   r   r   ÚextLstr   r   úb/var/www/ticemtrilhas/avaliacao_env/lib/python3.10/site-packages/openpyxl/formatting/formatting.pyÚ__init__   s   
zConditionalFormatting.__init__c                 C   s   t || jƒsdS | j|jkS )NF)Ú
isinstanceÚ	__class__r   )r   Úotherr   r   r   Ú__eq__"   s   zConditionalFormatting.__eq__c                 C   ó
   t | jƒS r   )Úhashr   ©r   r   r   r   Ú__hash__(   ó   
zConditionalFormatting.__hash__c                 C   s   dj | jj| jd�S )Nz<{cls} {cells}>)ÚclsÚcells)Úformatr   Ú__name__r   r   r   r   r   Ú__repr__,   s   zConditionalFormatting.__repr__c                 C   s
   || j v S )zL
        Check whether a certain cell is affected by the formatting
        ©r   )r   Úcoordr   r   r   Ú__contains__0   s   
z"ConditionalFormatting.__contains__)r   Nr   N)r$   Ú
__module__Ú__qualname__Útagnamer   r
   r   r   r"   r   r   r   r	   r   Úrulesr   r   r   r%   r(   r   r   r   r   r      s    



r   c                   @   sP   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ ZdS )ÚConditionalFormattingListzConditional formatting rules.c                 C   s   t ƒ | _d| _d S )Nr   )r   Ú	_cf_rulesÚmax_priorityr   r   r   r   r   ;   s   
z"ConditionalFormattingList.__init__c                 C   s`   |}t |tƒrt|ƒ}t |tƒstdƒ‚|}|  jd7  _|js$| j|_| j |g ¡ 	|¡ dS )zyAdd a rule such as ColorScaleRule, FormulaRule or CellIsRule

         The priority will be added automatically.
        z<Only instances of openpyxl.formatting.rule.Rule may be addedr   N)
r   Ústrr   r	   Ú
ValueErrorr/   Úpriorityr.   Ú
setdefaultÚappend)r   Úrange_stringr   ÚcfÚruler   r   r   Úadd@   s   

zConditionalFormattingList.addc                 C   r   r   )Úboolr.   r   r   r   r   Ú__bool__R   r    z"ConditionalFormattingList.__bool__c                 C   r   r   )Úlenr.   r   r   r   r   Ú__len__V   r    z!ConditionalFormattingList.__len__c                 c   s&   � | j  ¡ D ]
\}}||_|V  qd S r   )r.   Úitemsr,   )r   r6   r,   r   r   r   Ú__iter__Z   s
   €þz"ConditionalFormattingList.__iter__c                 C   s   t |tƒr
t|d�}| j| S )z0
        Get the rules for a cell range
        r&   )r   r0   r   r.   ©r   Úkeyr   r   r   Ú__getitem__`   s   


z%ConditionalFormattingList.__getitem__c                 C   s   t |d�}| j|= d S )Nr&   )r   r.   r?   r   r   r   Ú__delitem__i   s   
z%ConditionalFormattingList.__delitem__c                 C   s   |   ||¡ dS )z-
        Add a rule for a cell range
        N)r8   )r   r@   r7   r   r   r   Ú__setitem__n   s   z%ConditionalFormattingList.__setitem__N)r$   r)   r*   Ú__doc__r   r8   r:   r<   r>   rA   rB   rC   r   r   r   r   r-   7   s    	r-   N)Úcollectionsr   Úopenpyxl.descriptorsr   r   r   r   Ú!openpyxl.descriptors.serialisabler   r7   r	   Úopenpyxl.worksheet.cell_ranger
   r   r-   r   r   r   r   Ú<module>   s   &