B
    ÔùÓ`†	  ã               @   s  d Z ddlmZ ddlmZ ddlmZ ddl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G dd„ de	ƒZe
ZG dd„ de	ƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZddd„ZdS ) z
Excel specific descriptors
é    )ÚREL_NS)Úsafe_string)ÚElementé   )ÚMatchPatternÚMinMaxÚIntegerÚStringÚSequence)ÚSerialisablec               @   s   e Zd ZdZdS )Ú	HexBinaryz[0-9a-fA-F]+$N)Ú__name__Ú
__module__Ú__qualname__Úpattern© r   r   ú>/tmp/pip-unpacked-wheel-zhp1095k/openpyxl/descriptors/excel.pyr      s   r   c               @   s   e Zd ZdZdS )ÚUniversalMeasurez$[0-9]+(\.[0-9]+)?(mm|cm|in|pt|pc|pi)N)r   r   r   r   r   r   r   r   r      s   r   c               @   s   e Zd ZdZeZdZdZdS )Ú	TextPointzt
    Size in hundredths of points.
    In theory other units of measurement can be used but these are unbounded
    i€åùÿi€ N)r   r   r   Ú__doc__ÚintÚexpected_typeÚminÚmaxr   r   r   r   r      s   r   c                   s(   e Zd ZdZdZdZ‡ fdd„Z‡  ZS )Ú
Percentagez&((100)|([0-9][0-9]?))(\.[0-9][0-9]?)?%iÀ½ðÿi@B c                sD   t |tƒr.d|kr.| dd¡}tt|ƒd ƒ}tt| ƒ ||¡ d S )Nú%Ú iè  )Ú
isinstanceÚstrÚreplacer   ÚfloatÚsuperr   Ú__set__)ÚselfÚinstanceÚvalue)Ú	__class__r   r   r"   3   s    zPercentage.__set__)r   r   r   r   r   r   r"   Ú__classcell__r   r   )r&   r   r   -   s   r   c               @   s   e Zd Zeƒ Zddd„ZdS )Ú	ExtensionNc             C   s
   || _ d S )N)Úuri)r#   r)   r   r   r   Ú__init__>   s    zExtension.__init__)N)r   r   r   r	   r)   r*   r   r   r   r   r(   :   s   r(   c               @   s    e Zd Zeed�Zddd„ZdS )ÚExtensionList)r   r   c             C   s
   || _ d S )N)Úext)r#   r,   r   r   r   r*   H   s    zExtensionList.__init__N)r   )r   r   r   r
   r(   r,   r*   r   r   r   r   r+   D   s   
r+   c               @   s   e Zd ZeZdZdS )ÚRelationTN)r   r   r   r   Ú	namespaceÚ
allow_noner   r   r   r   r-   N   s   r-   c               @   s   e Zd ZdZdS )ÚBase64BinaryzP^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$N)r   r   r   r   r   r   r   r   r0   T   s   r0   c               @   s   e Zd ZdZdS )ÚGuidz?{[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}\}N)r   r   r   r   r   r   r   r   r1   Y   s   r1   c                   s$   e Zd ZdZdZ‡ fdd„Z‡  ZS )Ú	CellRangez]^[$]?([A-Za-z]{1,3})[$]?(\d+)(:[$]?([A-Za-z]{1,3})[$]?(\d+)?)?$|^[A-Za-z]{1,3}:[A-Za-z]{1,3}$Tc                s&   |d k	r|  ¡ }tt| ƒ ||¡ d S )N)Úupperr!   r2   r"   )r#   r$   r%   )r&   r   r   r"   c   s    zCellRange.__set__)r   r   r   r   r/   r"   r'   r   r   )r&   r   r2   ^   s   r2   Nc             C   s$   |dk	rd|| f } t | t|ƒd�S )z?
    Override serialisation because explicit none required
    Nz{%s}%s)Úval)r   r   )Útagnamer%   r.   r   r   r   Ú_explicit_nonej   s    r6   )N)r   Zopenpyxl.xml.constantsr   Zopenpyxl.compatr   Zopenpyxl.xml.functionsr   r   r   r   r   r	   r
   Zserialisabler   r   r   r   Z
Coordinater   r(   r+   r-   r0   r1   r2   r6   r   r   r   r   Ú<module>   s"   

