B
    ÔùÓ`®  ã               @   s|   d dl mZmZmZmZmZ d dlmZ d dlm	Z	m
Z
mZmZmZmZmZ ddlmZ G dd„ deƒZG dd	„ d	eƒZd
S )é    )ÚIntegerÚStringÚTypedÚSequenceÚAlias)ÚSerialisable)ÚFontÚFillÚGradientFillÚPatternFillÚBorderÚ	AlignmentÚ
Protectioné   )ÚNumberFormatc               @   sf   e Zd ZdZdZeedd�Zeedd�Z	ee
dd�Zeedd�Zeedd�Zeedd�Zddd„ZdS )	ÚDifferentialStyleÚdxf)ÚfontÚnumFmtÚfillÚ	alignmentÚborderÚ
protectionT)Úexpected_typeÚ
allow_noneNc             C   s.   || _ || _|| _|| _|| _|| _|| _d S )N)r   r   r   r   r   r   ÚextLst)Úselfr   r   r   r   r   r   r   © r   ú@/tmp/pip-unpacked-wheel-zhp1095k/openpyxl/styles/differential.pyÚ__init__$   s    	zDifferentialStyle.__init__)NNNNNNN)Ú__name__Ú
__module__Ú__qualname__ÚtagnameZ__elements__r   r   r   r   r   r	   r   r   r   r   r   r   r   r   r   r   r   r   r      s         r   c               @   sP   e Zd ZdZ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 )ÚDifferentialStyleListz5
    Deduping container for differential styles.
    Zdxfs)r   r   r   c             C   s
   || _ d S )N)r   )r   r   r   r   r   r   A   s    zDifferentialStyleList.__init__c             C   s8   t |tƒstdttƒ ƒ‚|| jkr(dS | j |¡ dS )zV
        Check to see whether style already exists and append it if does not.
        z	expected N)Ú
isinstancer   Ú	TypeErrorÚstrÚstylesÚappend)r   r   r   r   r   r)   E   s
    

zDifferentialStyleList.appendc             C   s   |   |¡ | j |¡S )z?
        Add a differential style and return its index
        )r)   r(   Úindex)r   r   r   r   r   ÚaddP   s    
zDifferentialStyleList.addc             C   s
   t | jƒS )N)Úboolr(   )r   r   r   r   Ú__bool__X   s    zDifferentialStyleList.__bool__c             C   s
   | j | S )N)r(   )r   Úidxr   r   r   Ú__getitem__]   s    z!DifferentialStyleList.__getitem__N)r   )r    r!   r"   Ú__doc__r#   r   r   r   r   r(   r   r)   r+   r-   r/   r   r   r   r   r$   6   s   

r$   N)Zopenpyxl.descriptorsr   r   r   r   r   Z!openpyxl.descriptors.serialisabler   Zopenpyxl.stylesr   r	   r
   r   r   r   r   Znumbersr   r   r$   r   r   r   r   Ú<module>   s
   $	