U
    rÎ·h‹	  ã                   @   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-49e_hfpc/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)Nr   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 r,   )Úext)r%   r0   r   r   r   r.   H   s    zExtensionList.__init__N)r   )r   r   r   r
   r+   r0   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   r1   N   s   r1   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})$Nr   r   r   r   r   r4   T   s   r4   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}\}Nr   r   r   r   r   r5   Y   s   r5   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 r,   )Úupperr"   r6   r#   r$   r(   r   r   r#   c   s    zCellRange.__set__)r   r   r   r   r3   r#   r*   r   r   r(   r   r6   ^   s   r6   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'   r2   r   r   r   Ú_explicit_nonej   s    r:   )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/   r1   r4   r5   r6   r:   r   r   r   r   Ú<module>   s"   

