B
    ò¶I`¨ß  ã            3  @   s~	  d Z ddlZddlmZmZ ddlZddlmZ ddlZddl	Z	ddl
Z
ddlZddlmZmZ ddlmZ ddlmZ ddlmZ dd	lmZmZ e e¡Zd
dddddddddddddgZdddddddgZee ZG dd „ d ƒZeƒ �dddd"œd#d$„ƒZ d%d&„ Z!e e!ƒZ"d'd(„ Z#ej$d)d*d+�d,d-„ ƒZ%d.d/„ Z&e $d0¡d1d2„ ƒZ'd3d4„ Z(d5d6„ Z)d7d8„ Z*d!d9œd:d;„Z+e+e,ƒZ-e+e,d<d9�Z.e e-d=d>�Z/e+e0ƒZ1e+e0d<d9�Z2e+e3ƒZ4e+e3d<d9�Z5e e4d?d>�Z6d@dA„ Z7edBed<dC�Z8e9ƒ Z:dDdE„ Z;edFdGdHdIgd<d0dJ�Z<e $d0¡�ddKdL„ƒZ=e $d0¡dMdN„ ƒZ>e $d0¡dOdP„ ƒZ?dQdR„ Z@dSdT„ ZAdUdV„ ZBdWdX„ ZCe eCd<dYdZ�ZDed[d\d]gd0d^�ZEd_d`„ ZFdadb„ ZGdcdd„ ZHe eHƒZIdedf„ ZJdgdh„ ZKdidj„ ZLdkdl„ ZMedmdndodpdqdrdsgd0d^�ZNedtdu O¡ d0d^�ZPedvdwdxdydzd{gd0d^�ZQd|d}„ ZRe $d)¡d~d„ ƒZSd€d�„ ZTed‚dƒd„d…d†d‡dˆd‰dŠd‹dŒd�dŽd�d�d‘d’d“d”d•d–d—d˜d™dšd›dœgd<d0dJ�ZUd�dž„ ZVedŸe W¡ e X¡ �d•d<dC�ZYd£d¤„ ZZd¥d¦„ Z[d§d¨„ Z\d©dª„ Z]ed«d¬d­d®dydxd gƒZ^e e\ƒZ_e e]ƒZ`e e^ƒZad¯d°„ Zbe ebƒZced±d²d³d´dµd¶d®d·d¸d¹dºdwgd<d0dJ�Zded»d d¼gd0d^�Zee $d0¡d½d¾„ ƒZfd¿dÀ„ ZgedÁdÂdÃdÄgd0d^�Zhe $d0¡dÅdÆ„ ƒZiedÇdÈdÉdÊdËdÌgd0d^�ZjedÍdÎdÏdÍgd0d^�ZkedÐdÑdÒd gd0d^�ZldÓdÔ„ ZmdÕdÖ„ Znd×dØ„ ZodÙdÚ„ ZpeoepdÛœZqedÜdÝdÞdÏgd0d^�Zrdßdà„ Zse esƒZte e6ƒZue eBd<dá�e6e eZƒeDeDe_e`eaeDe6e6eDece6e/eteudâœZvdãdädŸdådædçdèdédêdëœ	Zwdìdí„ Zdîdï„ Zxdðdñ„ Zye $d)¡dòdó„ ƒZze $d0¡dôdõ„ ƒZ{edöd­dwd®gd0d^�Z|G d÷dø„ døe}ƒZ~dùdú„ Ze;e&e~d dHdIgƒe!e&e-e1e-e&e1e4eZeCe-eAeAe4e4e&e\e\e]e]e6e6e6e&e^dƒdûdüdýge4eCe&eCe&eCe4eye&e&eRe2e&e&e&e&e&e&eCe-eAeCe4e4eZe4eCe4eZeCe4eZeCe4eZeCe4eZeCe-eCeCe4eZe4e/e-e-e-eJe4e/e/e/e/e/eCe&e(e&ege1e1e&eKeKeKeKeKeKdndodpdqdrdsgdþdÿ�d �d�d�ddt�d�d�d�dgeLeMeFe-e-e1�d�d	ge&e&eZe&e5e4d­dwd®gdydwdxge)eCeCe4e&e&e&e&eHd­dwd®geJeAe5e4e&dÎdÏdÍgdÝdÞdÏgeHe4eJeCe e1�d
�d�e&e&e1e&e1e&ex�d�dgeq�d eq�d e&e&e-e-e#e-e-e-e-e-e-e-e&e~d²d³d´dµd¶d®d·d¸d¹dºdwgƒe1e1eHeGe4e&e&e5e4e4e4e4e4e4e4e@e@e&e&e&e&e4e4e4e4e4e4eCe&e&e&e&e&eHe-dwd®d­ge&e&e&e&e4e4e4e4e4e4eCe&e&e&e&e&eHe-dwdxdydzd{geCeZe4e4eHeJe e4�d
�d�e4eCeCe&e&e1e&eq�d eq�d eq�d eq�d eq�d eq�d e&eq�d eq�d e4e4e*eAeAd\d]ge1eTeme4e-e&e&e~�d�d�d„ �dD ƒ•ƒe&eVe1e7e1e&e&e7dÂdÃdÄge&e(e&d d¼ge.e&e&eq�d e&ene"e1e/e/e/e/e/e/e/e/e/e/e/e/e/e/e/e/dÑdÒd ge4e-e-e1dÈdÉdÊdËdÌge/e-e/e-e/e-e/e&e&�d�œ2Z€e:d!�dg g d�dg�dd!�dœ	Z��d�d„ e€ ‚¡ D ƒZ€dS (  ak  
The rcsetup module contains the validation code for customization using
Matplotlib's rc settings.

Each rc setting is assigned a function used to validate any attempted changes
to that setting.  The validation functions are defined in the rcsetup module,
and are used to construct the rcParams global object which stores the settings
and is referenced throughout Matplotlib.

The default values of the rc settings are set in the default matplotlibrc file.
Any additions or deletions to the parameter set listed here should also be
propagated to the :file:`matplotlibrc.template` in Matplotlib's root source
directory.
é    N)Ú	lru_cacheÚreduce)ÚNumber)Ú	animationÚcbook)Ú	ls_mapper)Úparse_fontconfig_pattern)Úis_color_like)ÚCyclerÚcyclerZGTK3AggZ	GTK3CairoZMacOSXZnbAggZQt4AggZQt4CairoZQt5AggZQt5CairoZTkAggZTkCairoZWebAggZWXZWXAggZWXCairoZaggZcairoZpdfZpgfZpsÚsvgÚtemplatec               @   s$   e Zd Zdddœdd„Zdd„ ZdS )	ÚValidateInStringsFN)Ú_deprecated_sincec               s6   || _ ˆ| _|| _‡fdd„‰ ‡ fdd„|D ƒ| _dS )z#*valid* is a list of legal strings.c                s   ˆ r|   ¡ S | S d S )N)Úlower)Ús)Ú
ignorecase© ú6/tmp/pip-unpacked-wheel-tvo012g9/matplotlib/rcsetup.pyÚfunc:   s    z(ValidateInStrings.__init__.<locals>.funcc                s   i | ]}|ˆ |ƒ“qS r   r   )Ú.0Úk)r   r   r   ú
<dictcomp>?   s    z.ValidateInStrings.__init__.<locals>.<dictcomp>N)Úkeyr   r   Úvalid)Úselfr   r   r   r   r   )r   r   r   Ú__init__3   s
    zValidateInStrings.__init__c                sÊ   ˆ j r2‡ fdd„tƒ  ¡ D ƒ\}tjˆ j |dd� ˆ jr@| ¡ }|ˆ jkrTˆ j| S |›dˆ j› dˆ j 	¡ •› �}t
|tƒr¾| d¡r�| d¡s¤| d¡r¾| d¡r¾|d	d
… ˆ jkr¾|d7 }t|ƒ‚d S )Nc             3   s   | ]\}}|ˆ kr|V  qd S )Nr   )r   r   Úv)r   r   r   ú	<genexpr>C   s    z-ValidateInStrings.__call__.<locals>.<genexpr>Úfunction)ÚnameZobj_typez is not a valid value for z; supported values are ú"ú'é   éÿÿÿÿz'; remove quotes surrounding your string)r   ÚglobalsÚitemsr   Úwarn_deprecatedr   r   r   r   ÚvaluesÚ
isinstanceÚstrÚ
startswithÚendswithÚ
ValueError)r   r   r    Úmsgr   )r   r   Ú__call__A   s    


zValidateInStrings.__call__)F)Ú__name__Ú
__module__Ú__qualname__r   r/   r   r   r   r   r   2   s   r   F)ÚnÚdocc               s€   ‡ ‡‡fdd„}yd  ˆj¡|_W n& tk
rH   d  tˆƒj¡|_Y nX |j dd¡d d |j |_|d k	rt|nˆj|_|S )Nc                sÈ   t | tƒrXy‡fdd„|  d¡D ƒ}W q’ tk
rT   ˆ rN‡fdd„| D ƒ}n‚ Y q’X n:t | ¡r„t | ttfƒs„‡fdd„| D ƒ}ntd| › �ƒ‚ˆd k	rÄt	|ƒˆkrÄtdˆ› dt	|ƒ› d	| › �ƒ‚|S )
Nc                s    g | ]}|  ¡ rˆ |  ¡ ƒ‘qS r   )Ústrip)r   r   )Úscalar_validatorr   r   ú
<listcomp>Z   s    z1_listify_validator.<locals>.f.<locals>.<listcomp>ú,c                s    g | ]}|  ¡ rˆ |  ¡ ƒ‘qS r   )r5   )r   r   )r6   r   r   r7   `   s    c                s"   g | ]}t |tƒr|rˆ |ƒ‘qS r   )r)   r*   )r   r   )r6   r   r   r7   j   s    z0Expected str or other non-set iterable, but got z	Expected z values, but there are z values in )
r)   r*   ÚsplitÚ	ExceptionÚnpÚiterableÚsetÚ	frozensetr-   Úlen)r   Úval)Úallow_stringlistr3   r6   r   r   ÚfW   s    

z_listify_validator.<locals>.fz{}listz{}ListÚ.r#   r   )Úformatr0   ÚAttributeErrorÚtyper2   ÚrsplitÚ__doc__)r6   rA   r3   r4   rB   r   )rA   r3   r6   r   Ú_listify_validatorT   s    rI   c             C   s   | S )Nr   )r   r   r   r   Úvalidate_any}   s    rJ   c             C   s6   yt  | ¡ | S  tk
r0   t| ›d�ƒ‚Y nX d S )Nz: should be a string that can be parsed by numpy.datetime64)r;   Z
datetime64r-   )r   r   r   r   Ú_validate_date‚   s    
rK   z3.2zos.path.exists)Úalternativec             C   s,   | dkrdS t j | ¡r| S td|  ƒ‚dS )z$If s is a path, return s, else FalseNz+"%s" should be a path but it does not exist)ÚosÚpathÚexistsÚRuntimeError)r   r   r   r   Úvalidate_path_exists‹   s
    rQ   c             C   s:   t | tƒr|  ¡ } | dkrdS | dkr*dS td|  ƒ‚dS )zConvert b to ``bool`` or raise.)ÚtÚyÚyesÚonÚtrueÚ1r#   TT)rB   r3   ÚnoÚoffÚfalseÚ0r   FFzCould not convert "%s" to boolN)r)   r*   r   r-   )Úbr   r   r   Úvalidate_bool–   s    
r]   z3.3c             C   sN   t | tƒr|  ¡ } | dks"| dkr&dS | dkr2dS | dkr>dS td|  ƒ‚dS )z7Convert b to ``bool`` or raise, passing through *None*.NÚnone)rR   rS   rT   rU   rV   rW   r#   TT)rB   r3   rX   rY   rZ   r[   r   FFzCould not convert "%s" to bool)r)   r*   r   r-   )r\   r   r   r   Úvalidate_bool_maybe_none¢   s    
r_   c          
   C   s�   | d ks| dkr"t jddd� dS y8t| tƒr2| S t | ¡rTt jddd� d | ¡S t‚W n0 tk
rŠ } ztd|  ƒ|‚W d d }~X Y nX d S )	NÚNonez3.3z±Support for setting the 'text.latex.preamble' or 'pgf.preamble' rcParam to None is deprecated since %(since)s and will be removed %(removal)s; set it to an empty string instead.)ÚmessageÚ z¾Support for setting the 'text.latex.preamble' or 'pgf.preamble' rcParam to a list of strings is deprecated since %(since)s and will be removed %(removal)s; set it to a single string instead.Ú
z Could not convert "%s" to string)	r   r'   r)   r*   r;   r<   ÚjoinÚ	TypeErrorr-   )r   Úer   r   r   Ú_validate_tex_preamble±   s    




rg   c             C   sl   yt | ƒS  tk
rZ   t| tƒrV| dkr.dS |  ¡  d¡rVtjdd| ›d�d� dS Y nX td|  ƒ‚d S )NÚlinez3.3z&Support for setting axes.axisbelow to zh to mean 'line' is deprecated since %(since)s and will be removed %(removal)s; set it to 'line' instead.)ra   z2%s cannot be interpreted as True, False, or "line")r]   r-   r)   r*   r   r+   r   r'   )r   r   r   r   Úvalidate_axisbelowÈ   s    

ri   c          
   C   sR   | dkr| S yt | ƒS  tk
rL } zt| ›d| ›d�ƒ|‚W dd}~X Y nX dS )z<Confirm s is string 'figure' or convert s to float or raise.Úfigurez. is not string "figure" and could not convert z	 to floatN)Úfloatr-   )r   rf   r   r   r   Úvalidate_dpiÙ   s    rl   )Ú
allow_nonec               sP   ‡ ‡fdd„}dˆj › �|_ ˆ r.| j d7  _ |j dd¡d d |j  |_|S )zp
    Return a validator that converts inputs to *cls* or raises (and possibly
    allows ``None`` as well).
    c          
      sn   ˆ r&| d ks"t | tƒr&|  ¡ dkr&d S yˆ| ƒS  tk
rh } ztd| ›dˆj› �ƒ|‚W d d }~X Y nX d S )Nr^   zCould not convert z to )r)   r*   r   r-   r0   )r   rf   )rm   Úclsr   r   Ú	validatorê   s    z'_make_type_validator.<locals>.validatorZ	validate_Z_or_NonerC   r#   r   )r0   r2   rG   )rn   rm   ro   r   )rm   rn   r   Ú_make_type_validatorä   s    
rp   Tzreturn a list of strings)r4   zreturn a list of floatsc             C   s–   dddœ}yt | ƒ}W nV tk
rl   y||  ¡  S  tk
rf } ztdt|ƒ ƒ|‚W dd}~X Y nX Y n&X || ¡ krŽtdt| ¡ ƒ ƒ‚|S dS )z`
    Confirm that this is a Postscript or PDF font type that we know how to
    convert to.
    é   é*   )Ztype3Ztruetypez*Supported Postscript/PDF font types are %sN)Úvalidate_intr-   r   ÚKeyErrorÚlistr(   )r   Z	fonttypesZfonttyperf   r   r   r   Úvalidate_fonttype  s    &rv   Úbackend)r   c             C   s"   | t ks|  d¡r| nt| ƒ}|S )Nz	module://)Ú_auto_backend_sentinelr+   Ú_validate_standard_backends)r   rw   r   r   r   Úvalidate_backend$  s    rz   Útoolbarr`   Ztoolbar2Ztoolmanager)r   r   c                s   ‡ ‡‡fdd„}|S )Nc          
      sÔ   t | tƒrRdd„ |  d¡D ƒ} ˆdk	r„t| ƒˆkr„tdˆ› dt| ƒ› d| › �ƒ‚n2ˆdk	r„t| ƒˆkr„tdˆ› dt| ƒ› d	| › �ƒ‚y‡ ‡fd
d„| D ƒS  tk
rÎ } ztdˆj› d�ƒ|‚W dd}~X Y nX dS )z,Convert *n* objects using ``cls``, or raise.c             S   s   g | ]}|  ¡ ‘qS r   )r5   )r   Úxr   r   r   r7   6  s    z;_make_nseq_validator.<locals>.validator.<locals>.<listcomp>r8   NzExpected exactly z! comma-separated values, but got z comma-separated values: z values, but got z	 values: c                s$   g | ]}ˆ r|d k	rˆ|ƒn|‘qS )Nr   )r   r@   )rm   rn   r   r   r7   A  s   z!Could not convert all entries to r   )r)   r*   r9   r?   r-   r0   )r   rf   )rm   rn   r3   r   r   ro   3  s    
z'_make_nseq_validator.<locals>.validatorr   )rn   r3   rm   ro   r   )rm   rn   r3   r   Ú_make_nseq_validator0  s    r}   c             C   s
   t t| ƒS )N)r}   rk   )r3   r   r   r   Úvalidate_nseq_floatJ  s    r~   c             C   s
   t t| ƒS )N)r}   Úint)r3   r   r   r   Úvalidate_nseq_intO  s    r€   c             C   s   t  | d¡r| S t| ƒS )zReturn a valid color arg.Zinherit)r   Ú
_str_equalÚvalidate_color)r   r   r   r   Úvalidate_color_or_inheritT  s    rƒ   c             C   s   t  | d¡r| S t| ƒS )NÚauto)r   r�   r‚   )r   r   r   r   Úvalidate_color_or_auto[  s    r…   c             C   s.   t | tƒr&t d| ¡r&td| ›d�ƒ‚t| ƒS )Nz^C[0-9]$zCannot put cycle reference (z) in prop_cycler)r)   r*   ÚreÚmatchr-   r‚   )r   r   r   r   Úvalidate_color_for_prop_cyclea  s    rˆ   c          	   C   s˜   t | tƒrF|  ¡ dkrdS t| ƒdks2t| ƒdkrFd|  }t|ƒrF|S t| ƒrR| S yt | ¡}W n ttfk
rx   Y nX t|ƒr†|S t| ›d�ƒ‚dS )zReturn a valid color arg.r^   é   é   ú#z does not look like a color argN)	r)   r*   r   r?   r	   ÚastÚliteral_evalÚSyntaxErrorr-   )r   ZstmpÚcolorr   r   r   r‚   h  s     
r‚   zreturn a list of colorspecs)rA   r4   ZorientationZ	landscapeZportrait)r   c          
   C   sF   | dkr| S yt | ƒS  tk
r@ } ztdƒ|‚W d d }~X Y nX d S )N)r„   Úequalz not a valid aspect specification)rk   r-   )r   rf   r   r   r   Úvalidate_aspect‡  s    r‘   c             C   s    | d ks| dkrd S t | ƒS d S )Nr`   )Úvalidate_fontsize)r   r   r   r   Úvalidate_fontsize_None�  s    r“   c          
   C   s|   ddddddddd	g	}t | tƒr(|  ¡ } | |kr4| S yt| ƒS  tk
rv } ztd
| d |¡f ƒ|‚W d d }~X Y nX d S )Nzxx-smallzx-smallÚsmallÚmediumZlargezx-largezxx-largeZsmallerZlargerz5%s is not a valid font size. Valid font sizes are %s.z, )r)   r*   r   rk   r-   rd   )r   Z	fontsizesrf   r   r   r   r’   —  s    

r’   c             C   sp   ddddddddd	d
ddddg}| |kr,| S yt | ƒS  ttfk
rj } zt| › d�ƒ|‚W d d }~X Y nX d S )NZ
ultralightÚlightÚnormalÚregularZbookr•   ZromanZsemiboldZdemiboldZdemiZboldZheavyz
extra boldZblackz is not a valid font weight.)r   r-   re   )r   Úweightsrf   r   r   r   Úvalidate_fontweight¨  s    rš   c             C   s   t | ƒ | S )N)r   )r   r   r   r   Úvalidate_font_propertiesµ  s    r›   c             C   s@   t | tƒr|  ¡ } | dks"| dkr&dS tjddd� t| ƒS dS )zB
    Temporary validate for fallback_to_cm, while deprecated

    Nr^   z3.3zŸSupport for setting the 'mathtext.fallback_to_cm' rcParam is deprecated since %(since)s and will be removed %(removal)s; use 'mathtext.fallback : 'cm' instead.)ra   )r)   r*   r   r   r'   r_   )r\   r   r   r   Ú!_validate_mathtext_fallback_to_cmº  s    

rœ   c             C   s^   dddg}t | tƒr|  ¡ } | d ks,| dkr0d S |  ¡ |kr@| S t| › dd |¡› d�ƒ‚d S )NÚcmÚstixÚstixsansr^   zB is not a valid fallback font name. Valid fallback font names are r8   z(. Passing 'None' will turn fallback off.)r)   r*   r   r-   rd   )r   Z_fallback_fontsr   r   r   Ú_validate_mathtext_fallbackË  s    

r    ZfontsetZ
dejavusansZdejavuserifr�   rž   rŸ   ZcustomÚdefaultz.rm cal it tt sf bf default bb frak scr regularÚ	alignmentÚcenterÚtopZbottomZbaselineZcenter_baselinec             C   s~   | dkrt jddd� dS yttdd�| ƒS  ttfk
rx   yt| ƒS  tk
rr } ztdƒ|‚W d d }~X Y nX Y nX d S )NÚrangez3.2z”Support for setting the boxplot.whiskers rcParam to 'range' is deprecated since %(since)s and will be removed %(removal)s; set it to 0, 100 instead.)ra   é   )r3   z:Not a valid whisker value ['range', float, (float, float)])r   r'   rI   Úvalidate_floatre   r-   rk   )r   rf   r   r   r   Úvalidate_whiskersç  s    
r¨   c             C   s&   t | ƒ} | dkr"tjddd� d} | S )Nr„   z3.2z’Support for setting the 'savefig.format' rcParam to 'auto' is deprecated since %(since)s and will be removed %(removal)s; set it to 'png' instead.)ra   Úpng)Úvalidate_stringr   r'   )Úvaluer   r   r   Úupdate_savefig_formatù  s    
r¬   c             C   s&   t | ƒ} | dkr"tjddd� d} | S )Nr„   z3.2z’Support for setting the 'savefig.format' rcParam to 'auto' is deprecated since %(since)s and will be removed %(removal)s; set it to 'png' instead.)ra   r©   )rª   r   r'   )r«   r   r   r   Ú_update_savefig_format  s    
r­   Zps_papersizer„   ÚletterÚlegalÚledgerZa0Za1Za2Úa3Za4Za5Za6Za7Za8Za9Za10Zb0Zb1Zb2Zb3Zb4Zb5Zb6Zb7Zb8Zb9Zb10c             C   s4   t | tƒr|  ¡ } | dkrd S tdddgƒ| ƒS d S )N)r^   NrZ   Fzps.usedistillerZghostscriptZxpdf)r)   r*   r   r   )r   r   r   r   Úvalidate_ps_distiller  s
    
r²   Ú	linestyler^   ú rb   c          	   C   s.  t | tƒrPyt| ƒS  tk
r&   Y nX yt | ¡} W n ttfk
rN   Y nX dd„ }|| ƒrât| ƒdkrât | d tdƒt	fƒrâ|| d ƒrât| d ƒd dkrât
dd„ | d D ƒƒrâ| d dkrÞtjd	d
d� d| d f} | S || ƒ�rt| ƒd dk�rt
dd„ | D ƒƒ�rd| fS td| ›d�ƒ‚dS )zf
    A validator for all possible line styles, the named ones *and*
    the on-off ink sequences.
    c             S   s   t  | ¡ot| tttfƒ S )N)r;   r<   r)   r*   ÚbytesÚ	bytearray)r|   r   r   r   Ú_is_iterable_not_string_like=  s    z9_validate_linestyle.<locals>._is_iterable_not_string_liker¦   r   Nr#   c             s   s   | ]}t |tƒV  qd S )N)r)   r   )r   Úelemr   r   r   r   H  s    z&_validate_linestyle.<locals>.<genexpr>z3.3z†Passing the dash offset as None is deprecated since %(since)s and support for it will be removed %(removal)s; pass it as zero instead.)ra   c             s   s   | ]}t |tƒV  qd S )N)r)   r   )r   r¸   r   r   r   r   S  s    z
linestyle z$ is not a valid on-off ink sequence.)r)   r*   Ú_validate_named_linestyler-   rŒ   r�   rŽ   r?   rF   r   Úallr   r'   )Úlsr·   r   r   r   Ú_validate_linestyle.  s4    


r¼   c             C   sB   |   ¡ }| |kr>|dkr(tjddd� n|dkr>tjddd� |S )N)ÚmiterÚroundÚbevelz3.3zŠCase-insensitive capstyles are deprecated since %(since)s and support for them will be removed %(removal)s; please pass them in lowercase.)ra   )Úbuttr¾   Ú
projectingz‹Case-insensitive joinstyles are deprecated since %(since)s and support for them will be removed %(removal)s; please pass them in lowercase.)r   r   r'   )r   Zs_lowr   r   r   Ú$_deprecate_case_insensitive_join_capX  s    
rÂ   c             C   s    t | ƒ} tjdddg| d� | S )Nr½   r¾   r¿   )Ú	joinstyle)rÂ   r   Ú_check_in_list)r   r   r   r   Úvalidate_joinstylei  s    rÅ   c             C   s    t | ƒ} tjdddg| d� | S )NrÀ   r¾   rÁ   )Úcapstyle)rÂ   r   rÄ   )r   r   r   r   Úvalidate_capstyleo  s    rÇ   zmarkers.fillstyleÚfullÚleftÚrightc             C   s”   t | ttttdƒfƒr| S t | tƒr`t| ƒdkrXtdd„ | D ƒƒsTtdd„ | D ƒƒrX| S tdƒ‚t | t	ƒrˆtdd„ | D ƒƒr€| S tdƒ‚td	ƒ‚dS )
aB  
    Validate the markevery property of a Line2D object.

    Parameters
    ----------
    s : None, int, float, slice, length-2 tuple of ints,
        length-2 tuple of floats, list of ints

    Returns
    -------
    None, int, float, slice, length-2 tuple of ints,
        length-2 tuple of floats, list of ints

    Nr¦   c             s   s   | ]}t |tƒV  qd S )N)r)   r   )r   rf   r   r   r   r   “  s    z%validate_markevery.<locals>.<genexpr>c             s   s   | ]}t |tƒV  qd S )N)r)   rk   )r   rf   r   r   r   r   ”  s    z3'markevery' tuple must be pair of ints or of floatsc             s   s   | ]}t |tƒV  qd S )N)r)   r   )r   rf   r   r   r   r   ›  s    z3'markevery' list must have all elements of type intz!'markevery' is of an invalid type)
r)   Úslicerk   r   rF   Útupler?   rº   re   ru   )r   r   r   r   Úvalidate_markevery~  s    

rÍ   Z
legend_locÚbestzupper rightz
upper leftz
lower leftzlower rightzcenter leftzcenter rightzlower centerzupper centerzsvg.fonttyperN   c             C   s   t | ƒS )N)Ú_validate_hinting)r   r   r   r   Úvalidate_hinting·  s    rÐ   c          
   C   s<   | dkrt jddd� | S tddddd	d
dddgdd�| ƒS )N)TFz3.2z­Support for setting the text.hinting rcParam to True or False is deprecated since %(since)s and will be removed %(removal)s; set it to its synonyms 'auto' or 'none' instead.)ra   ztext.hintingr¡   Zno_autohintZforce_autohintZ
no_hintingr„   ZnativeZeitherr^   T)r   )r   r'   r   )r   r   r   r   rÏ   ½  s    

rÏ   zpgf.texsystemZxelatexZlualatexZpdflatexc             C   s*   | t jjkr| S tdtt jjƒ› �ƒ‚d S )Nz Supported animation writers are )r   ÚwritersZ_registeredr-   Úsorted)r   r   r   r   Úvalidate_movie_writerÐ  s    rÓ   zanimation.frame_formatr©   ZjpegZtiffÚrawZrgbaÚmajorÚminorZbothzanimation.htmlÚhtml5Zjshtmlc             C   sH   t | tƒr4|  ¡ } | dkr| S | dkr*d S tdƒ‚n| d k	rDtdƒ‚| S )NZtightÚstandardz$bbox should be 'tight' or 'standard')r)   r*   r   r-   )r   r   r   r   Úvalidate_bboxä  s    

rÙ   c             C   s\   t | tƒr|  ¡ } | dks"| d kr&d S ytttdd�| ƒƒS  tk
rV   tdƒ‚Y nX d S )Nr^   rq   )r3   z.Expected a (scale, length, randomness) triplet)r)   r*   r   rÌ   rI   r§   r-   )r   r   r   r   Úvalidate_sketchò  s    
rÚ   c             C   s6   t | ƒ} d|   krdk r$n n| S td| › �ƒ‚d S )Nr   r#   zValue must be >=0 and <1; got )r§   rP   )r   r   r   r   Ú!_validate_greaterequal0_lessthan1ý  s    rÛ   c             C   s6   t | ƒ} d|   krdkr$n n| S td| › �ƒ‚d S )Nr   r#   zValue must be >=0 and <=1; got )r§   rP   )r   r   r   r   Ú"_validate_greaterequal0_lessequal1  s    rÜ   )z
0 <= x < 1z0 <= x <= 1zaxes.grid.axisr|   rS   c             C   sX   t | tƒstdƒ‚tjt| d� t| ƒddddddd	d
ddh
 }|rTtdt|ƒ ƒ‚| S )zŽ
    Validate a hatch pattern.
    A hatch pattern string can have any sequence of the following
    characters: ``\ / | - + * . x o O``.
    zHatch pattern must be a string)Zhatch_patternú\ú/ú|ú-ú+Ú*rC   r|   ÚoÚOzUnknown hatch symbol(s): %s)r)   r*   r-   r   Ú_check_isinstancer=   ru   )r   Úunknownr   r   r   Úvalidate_hatch  s    
 rç   )rA   )r�   Ú	linewidthr³   Ú	facecolorÚ	edgecolorrÃ   rÆ   Z	fillstyleÚmarkerfacecolorÚ
markersizeÚmarkeredgewidthÚmarkeredgecolorZ	markeveryÚalphaÚmarkerZhatchZdashesr�   rè   ré   rê   rë   rî   rí   rì   )	ÚcZlwr»   ZfcZecZmfcZmecZmewÚmsc              O   sü   | r|rt dƒ‚n| s"|s"t dƒ‚t| ƒdkrPt| d tƒsDt dƒ‚t| d ƒS t| ƒdkrp| d | d fg}nt| ƒdkr†t dƒ‚n| ¡ }g }xR|D ]J\}}t ||¡}t |d¡}|dkrÌt d	| ƒ‚||ƒ}| 	||f¡ q˜W t
tjd
d„ |D ƒƒS )a!  
    Create a `~cycler.Cycler` object much like :func:`cycler.cycler`,
    but includes input validation.

    Call signatures::

      cycler(cycler)
      cycler(label=values[, label2=values2[, ...]])
      cycler(label, values)

    Form 1 copies a given `~cycler.Cycler` object.

    Form 2 creates a `~cycler.Cycler` which cycles over one or more
    properties simultaneously. If multiple properties are given, their
    value lists must have the same length.

    Form 3 creates a `~cycler.Cycler` for a single property. This form
    exists for compatibility with the original cycler. Its use is
    discouraged in favor of the kwarg form, i.e. ``cycler(label=values)``.

    Parameters
    ----------
    cycler : Cycler
        Copy constructor for Cycler.

    label : str
        The property key. Must be a valid `.Artist` property.
        For example, 'color' or 'linestyle'. Aliases are allowed,
        such as 'c' for 'color' and 'lw' for 'linewidth'.

    values : iterable
        Finite-length iterable of the property values. These values
        are validated and will raise a ValueError if invalid.

    Returns
    -------
    Cycler
        A new :class:`~cycler.Cycler` for the given properties.

    Examples
    --------
    Creating a cycler for a single property:

    >>> c = cycler(color=['red', 'green', 'blue'])

    Creating a cycler for simultaneously cycling over multiple properties
    (e.g. red circle, green plus, blue cross):

    >>> c = cycler(color=['red', 'green', 'blue'],
    ...            marker=['o', '+', 'x'])

    zEcycler() can only accept positional OR keyword arguments -- not both.z2cycler() must have positional OR keyword argumentsr#   r   zEIf only one positional argument given, it must  be a Cycler instance.r¦   z+No more than 2 positional arguments allowedNzUnknown artist property: %sc             s   s   | ]\}}t ||ƒV  qd S )N)Úccycler)r   r   r   r   r   r   r   �  s    zcycler.<locals>.<genexpr>)re   r?   r)   r
   Úvalidate_cyclerr&   Ú_prop_aliasesÚgetÚ_prop_validatorsÚappendr   ÚoperatorÚadd)ÚargsÚkwargsÚpairsZ	validatedÚpropÚvalsÚ	norm_propro   r   r   r   r   K  s,    5

r   c       	   
   C   s†  t | tƒrly,d|  dd¡kr$tdƒ‚t| ti dœƒ} W n4 tk
rj } ztd| |f ƒ|‚W dd}~X Y nX t | tƒr|| }ntd|  ƒ‚|jt	t
ƒt	tƒB  }|r®td	| ƒ‚t	ƒ }xb|jD ]X}t ||¡}||krî||jkrîtd
 ||¡ƒ‚||k�rtd ||¡ƒ‚| |g¡ q¼W t|ƒt|jƒk�s0t‚x(|jD ]}t ||¡}| ||¡ �q8W x&| ¡  ¡ D ]\}}t
| |ƒ �qhW |S )z?Return a Cycler object from a string repr or the object itself.z.__r´   rb   zG'%s' seems to have dunder methods. Raising an exception for your safety)r   Ú__builtins__z+'%s' is not a valid cycler construction: %sNz.object was not a string or Cycler instance: %szUnknown artist properties: %sz@Cannot specify both '{0}' and alias '{1}' in the same prop_cyclezKAnother property was already aliased to '{0}'. Collision normalizing '{1}'.)r)   r*   Úreplacer-   Úevalr   ÚBaseExceptionr
   Úkeysr=   r÷   rõ   rö   rD   Úupdater?   ÚAssertionErrorZ
change_keyÚby_keyr&   )	r   rf   Zcycler_instZunknownsÚcheckerrþ   r   r   rÿ   r   r   r   rô      s@    
 


rô   c          	   C   sz   dddddddg}t | tƒr(| |kr(| S yt| ƒS  ttfk
rH   Y nX yt| ƒS  tk
rf   Y nX td |¡ƒ‚d S )	Nr„   ZsturgesÚfdZdoaneZscottZriceÚsqrtz='hist.bins' must be one of {}, an int or a sequence of floats)r)   r*   r   re   r-   Úvalidate_floatlistrD   )r   Z
valid_strsr   r   r   Úvalidate_hist_binsÞ  s    r  c             C   s4   t jt| d� ddlm} d|kr0|d j ¡  | S )N)rN   r   )Úmoduleszmatplotlib.animation)r   rå   r*   Úsysr  rÑ   Z	set_dirty)Úpr  r   r   r   Úvalidate_animation_writer_pathî  s
    r  c          
   C   s^   | d k	rRdd l }y| | ¡ W n. |jk
rL } ztdƒ|‚W d d }~X Y nX | S tdƒ‚d S )Nr   z*'webagg.address' is not a valid IP address)ÚsocketÚ	inet_atonÚerrorr-   )r   r  rf   r   r   r   Úvalidate_webagg_addressþ  s    r  zaxes.titlelocationc               @   s   e Zd ZdZdS )Ú_ignorecasezAA marker class indicating that a list-of-str is case-insensitive.N)r0   r1   r2   rH   r   r   r   r   r    s   r  c             C   s*   t |tƒr"t |tƒ}t| ||d�S |S d S )N)r   )r)   ru   r  r   )r   Úconvr   r   r   r   Ú_convert_validator_spec  s    

r  ZflatZnearestZgouraudZrmÚcalÚitÚttZsfZbfZbbZfrakZscrr˜   Úupperr   r¦   )r3   ÚdataZround_numbersz0 <= x <= 1z
0 <= x < 1c             C   s&   g | ]}t d ƒD ]}|› |› �‘qqS )é   )r¥   )r   ÚabÚir   r   r   r7     s   r7   r  (2  rw   Zbackend_fallbackr{   ZdatapathÚinteractiveÚtimezonezwebagg.portzwebagg.addresszwebagg.open_in_browserzwebagg.port_retrieszlines.linewidthzlines.linestylezlines.colorzlines.markerzlines.markerfacecolorzlines.markeredgecolorzlines.markeredgewidthzlines.markersizezlines.antialiasedzlines.dash_joinstylezlines.solid_joinstylezlines.dash_capstylezlines.solid_capstylezlines.dashed_patternzlines.dashdot_patternzlines.dotted_patternzlines.scale_dasheszmarkers.fillstylezpcolor.shadingzpatch.linewidthzpatch.edgecolorzpatch.force_edgecolorzpatch.facecolorzpatch.antialiasedzhatch.colorzhatch.linewidthz	hist.binszboxplot.notchzboxplot.verticalzboxplot.whiskerszboxplot.bootstrapzboxplot.patchartistzboxplot.showmeanszboxplot.showcapszboxplot.showboxzboxplot.showflierszboxplot.meanlinezboxplot.flierprops.colorzboxplot.flierprops.markerz"boxplot.flierprops.markerfacecolorz"boxplot.flierprops.markeredgecolorz"boxplot.flierprops.markeredgewidthzboxplot.flierprops.markersizezboxplot.flierprops.linestylezboxplot.flierprops.linewidthzboxplot.boxprops.colorzboxplot.boxprops.linewidthzboxplot.boxprops.linestylezboxplot.whiskerprops.colorzboxplot.whiskerprops.linewidthzboxplot.whiskerprops.linestylezboxplot.capprops.colorzboxplot.capprops.linewidthzboxplot.capprops.linestylezboxplot.medianprops.colorzboxplot.medianprops.linewidthzboxplot.medianprops.linestylezboxplot.meanprops.colorzboxplot.meanprops.markerz!boxplot.meanprops.markerfacecolorz!boxplot.meanprops.markeredgecolorzboxplot.meanprops.markersizezboxplot.meanprops.linestylezboxplot.meanprops.linewidthzfont.familyz
font.stylezfont.variantzfont.stretchzfont.weightz	font.sizez
font.serifzfont.sans-serifzfont.cursivezfont.fantasyzfont.monospacez
text.colorztext.usetexztext.latex.preambleztext.latex.previewztext.hintingztext.hinting_factorztext.kerning_factorztext.antialiasedzmathtext.calzmathtext.rmzmathtext.ttzmathtext.itzmathtext.bfzmathtext.sfzmathtext.fontsetzmathtext.defaultzmathtext.fallback_to_cmzmathtext.fallbackzimage.aspectzimage.interpolationz
image.cmapz	image.lutzimage.originzimage.resamplezimage.composite_imagezcontour.negative_linestylezcontour.corner_maskzcontour.linewidthzerrorbar.capsizezxaxis.labellocationzyaxis.labellocationzaxes.axisbelowzaxes.facecolorzaxes.edgecolorzaxes.linewidthzaxes.spines.leftzaxes.spines.rightzaxes.spines.bottomzaxes.spines.topzaxes.titlesizezaxes.titlelocationzaxes.titleweightzaxes.titlecolorzaxes.titleyzaxes.titlepadz	axes.gridzaxes.grid.whichzaxes.grid.axiszaxes.labelsizezaxes.labelpadzaxes.labelweightzaxes.labelcolorzaxes.formatter.limitszaxes.formatter.use_localezaxes.formatter.use_mathtextzaxes.formatter.min_exponentzaxes.formatter.useoffsetzaxes.formatter.offset_thresholdzaxes.unicode_minuszaxes.prop_cyclezaxes.autolimit_modezaxes.xmarginzaxes.ymarginzpolaraxes.gridzaxes3d.gridzscatter.markerzscatter.edgecolorsz
date.epochzdate.autoformatter.yearzdate.autoformatter.monthzdate.autoformatter.dayzdate.autoformatter.hourzdate.autoformatter.minutezdate.autoformatter.secondzdate.autoformatter.microsecondzlegend.fancyboxz
legend.loczlegend.numpointszlegend.scatterpointszlegend.fontsizezlegend.title_fontsizezlegend.markerscalezlegend.shadowzlegend.frameonzlegend.framealphazlegend.borderpadzlegend.labelspacingzlegend.handlelengthzlegend.handleheightzlegend.handletextpadzlegend.borderaxespadzlegend.columnspacingzlegend.facecolorzlegend.edgecolorz	xtick.topzxtick.bottomzxtick.labeltopzxtick.labelbottomzxtick.major.sizezxtick.minor.sizezxtick.major.widthzxtick.minor.widthzxtick.major.padzxtick.minor.padzxtick.colorzxtick.minor.visiblezxtick.minor.topzxtick.minor.bottomzxtick.major.topzxtick.major.bottomzxtick.labelsizezxtick.directionzxtick.alignmentz
ytick.leftzytick.rightzytick.labelleftzytick.labelrightzytick.major.sizezytick.minor.sizezytick.major.widthzytick.minor.widthzytick.major.padzytick.minor.padzytick.colorzytick.minor.visiblezytick.minor.leftzytick.minor.rightzytick.major.leftzytick.major.rightzytick.labelsizezytick.directionzytick.alignmentz
grid.colorzgrid.linestylezgrid.linewidthz
grid.alphazfigure.titlesizezfigure.titleweightzfigure.figsizez
figure.dpizfigure.facecolorzfigure.edgecolorzfigure.frameonzfigure.autolayoutzfigure.max_open_warningzfigure.raise_windowzfigure.subplot.leftzfigure.subplot.rightzfigure.subplot.bottomzfigure.subplot.topzfigure.subplot.wspacezfigure.subplot.hspacezfigure.constrained_layout.usez figure.constrained_layout.hspacez figure.constrained_layout.wspacezfigure.constrained_layout.h_padzfigure.constrained_layout.w_padzsavefig.dpizsavefig.facecolorzsavefig.edgecolorzsavefig.orientationzsavefig.jpeg_qualityzsavefig.formatzsavefig.bboxzsavefig.pad_incheszsavefig.directoryzsavefig.transparentztk.window_focuszps.papersizez	ps.useafmzps.usedistillerzps.distiller.reszps.fonttypezpdf.compressionzpdf.inheritcolorzpdf.use14corefontszpdf.fonttypezpgf.texsystemzpgf.rcfontszpgf.preamblezsvg.image_inlinezsvg.fonttypezsvg.hashsaltzdocstring.hardcopyzpath.simplifyzpath.simplify_thresholdz	path.snapzpath.sketchzpath.effectszagg.path.chunksizezkeymap.fullscreenzkeymap.homezkeymap.backzkeymap.forwardz
keymap.panzkeymap.zoomzkeymap.savezkeymap.quitzkeymap.quit_allzkeymap.gridzkeymap.grid_minorzkeymap.yscalezkeymap.xscalezkeymap.all_axeszkeymap.helpzkeymap.copyzanimation.htmlzanimation.embed_limitzanimation.writerzanimation.codeczanimation.bitratezanimation.frame_formatzanimation.html_argszanimation.ffmpeg_pathzanimation.ffmpeg_argszanimation.avconv_pathzanimation.avconv_argszanimation.convert_pathzanimation.convert_argszmpl_toolkits.legacy_colorbarz_internal.classic_modeZavconvÚaé_   )	rw   z_internal.classic_modezanimation.avconv_pathzanimation.avconv_argszanimation.html_argszmathtext.fallback_to_cmzkeymap.all_axeszsavefig.jpeg_qualityztext.latex.previewc             C   s   i | ]\}}t ||ƒ|“qS r   )r  )r   r   r  r   r   r   r   à  s   r   )F)NF)r`   r^   r´   rb   )r„   r®   r¯   r°   )ƒrH   rŒ   Ú	functoolsr   r   ÚloggingZnumbersr   rù   rM   r†   Znumpyr;   Z
matplotlibr   r   Zmatplotlib.cbookr   Zmatplotlib.fontconfig_patternr   Zmatplotlib.colorsr	   r   r
   ró   Ú	getLoggerr0   Ú_logZinteractive_bkZnon_interactive_bkZall_backendsr   rI   rJ   Zvalidate_anylistrK   Ú
deprecatedrQ   r]   r_   rg   ri   rl   rp   r*   rª   Zvalidate_string_or_NoneZvalidate_stringlistr   rs   Zvalidate_int_or_Nonerk   r§   Zvalidate_float_or_Noner  rv   ry   Úobjectrx   rz   Zvalidate_toolbarr}   r~   r€   rƒ   r…   rˆ   r‚   Zvalidate_colorlistZvalidate_orientationr‘   r“   r’   Zvalidate_fontsizelistrš   r›   rœ   r    Zvalidate_fontsetr9   Zvalidate_mathtext_defaultZ_validate_alignmentr¨   r¬   r­   Zvalidate_ps_papersizer²   r  r(   r¹   r¼   rÂ   rÅ   rÇ   Zvalidate_fillstyleZvalidate_joinstylelistZvalidate_capstylelistZvalidate_fillstylelistrÍ   Zvalidate_markeverylistZvalidate_legend_locZvalidate_svg_fonttyperÐ   rÏ   Zvalidate_pgf_texsystemrÓ   Zvalidate_movie_frame_fmtZvalidate_axis_locatorZvalidate_movie_html_fmtrÙ   rÚ   rÛ   rÜ   Z_range_validatorsZvalidate_grid_axisrç   Zvalidate_hatchlistZvalidate_dashlistr÷   rõ   rô   r  r  r  Zvalidate_axes_titlelocationru   r  r  Z_validatorsZ_hardcoded_defaultsr&   r   r   r   r   Ú<module>   s   

"'	

	
*%
	U>






