3
ƽh              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j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j$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j$d0ddKdLZ=ej$d0dMdN Z>ej$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dtdujO d0d^ZPedvdwdxdydzd{gd0d^ZQd|d} ZRej$d)d~d ZSdd ZTedddddddddddddddddddddddddddgd<d0dJZUdd ZVedejW ejX dd<dCZYdd ZZdd Z[dd Z\dd Z]edddddydxdgZ^e e\Z_e e]Z`e e^Zadd Zbe ebZceddddddddddddwgd<d0dJZdedddgd0d^Zeej$d0dd Zfdd Zgeddddgd0d^Zhej$d0ddƄ Zieddddddgd0d^Zjeddddgd0d^Zkeddddgd0d^ZlddԄ Zmddք Zndd؄ Zoddڄ ZpeoepdۜZqeddddgd0d^Zrdd Zse esZte e6Zue eBd<de6e eZeDeDe_e`eaeDe6e6eDece6e/eteudZvdddddddddd	Zwdd Zdd Zxdd Zyej$d)dd Zzej$d0dd Z{edddwdgd0d^Z|G dd de}Z~dd Ze;e&e~ddHdIge!e&e-e1e-e&e1e4eZeCe-eAeAe4e4e&e\e\e]e]e6e6e6e&e^ddddg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ddd ddddtddddgeLeMeFe-e-e1dd	ge&e&eZe&e5e4ddwdgdydwdxge)eCeCe4e&e&e&e&eHddwdgeJeAe5e4e&dddgdddg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~dddddddddddwge1e1eHeGe4e&e&e5e4e4e4e4e4e4e4e@e@e&e&e&e&e4e4e4e4e4e4eCe&e&e&e&e&eHe-dwddg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&e7dddge&e(e&ddge.e&e&eqd e&ene"e1e/e/e/e/e/e/e/e/e/e/e/e/e/e/e/e/dddge4e-e-e1dddddge/e-e/e-e/e-e/e&e&d2Ze:d!dg g ddgdd!d	Zdd ej D Zd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| j  S | S d S )N)lower)s)
ignorecase 8/tmp/pip-build-7iwl8md4/matplotlib/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 j D \}tj j |dd  jr@|j }| jkrT j| S |d j d jj	  }t
|tr|jdr|jds|jdr|j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 j|_W n& tk
rH   dj tj|_Y nX |jjddd d |j |_|d k	rt|nj|_|S )Nc                s   t | trXyfdd| jdD }W q tk
rT    rNfdd| D }n Y qX n<tj| rt | ttf rfdd| D }ntd|  d k	rt	|krtd dt	| d	|  |S )
Nc                s    g | ]}|j  r |j  qS r   )strip)r   r   )scalar_validatorr   r   
<listcomp>Z   s    z1_listify_validator.<locals>.f.<locals>.<listcomp>,c                s    g | ]}|j  r |j  qS r   )r5   )r   r   )r6   r   r   r7   `   s    c                s$   g | ]}t |t s|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 j|  | 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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| j } | 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#   TrB   r3   noofffalse0r   FzCould not convert "%s" to boolN)rR   rS   rT   rU   rV   rW   r#   T)rB   r3   rX   rY   rZ   r[   r   F)r)   r*   r   r-   )br   r   r   validate_bool   s    
r]   z3.3c          	   C   sN   t | tr| j } | 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nonerR   rS   rT   rU   rV   rW   r#   TrB   r3   rX   rY   rZ   r[   r   FzCould not convert "%s" to bool)rR   rS   rT   rU   rV   rW   r#   T)rB   r3   rX   rY   rZ   r[   r   F)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j| rTt jddd dj| S tW n0 tk
r } ztd|  |W Y d d }~X nX d S )	NNonez3.3zSupport 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 zSupport 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 | j j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 Y dd}~X 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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&| j dkr&d S y| S  tk
rh } ztd| dj |W Y d d }~X 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|| j  S  tk
rf } ztdt| |W Y dd}~X nX Y n&X ||j krtdt|j  |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| j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 | jdD } dk	rt| krtd dt|  d|  n2dk	rt| krtd dt|  d	|  y fd
d| D S  tk
r } ztdj d|W Y dd}~X nX dS )z,Convert *n* objects using ``cls``, or raise.c             S   s   g | ]}|j  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 | ]}  s|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 j| 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 j| 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j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| j dkrdS t| dks2t| dkrFd|  }t|rF|S t| rR| S ytj| }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 Y d d }~X nX d S )Nr   equalz not a valid aspect specification)r   r   )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(| j } | |kr4| S yt| S  tk
rv } ztd
| dj|f |W Y d d }~X 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 Y d d }~X nX d S )NZ
ultralightlightZ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| j } | 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.3zSupport 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| j } | d ks,| dkr0d S | j |kr@| S t|  ddj| 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 Y d d }~X nX Y nX d S )Nrangez3.2zSupport 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.2zSupport 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.2zSupport 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| j } | dkrd S tdddg| S d S )Nr^   rZ   Fzps.usedistillerZghostscriptZxpdf)r^   NrZ   F)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j| } W n ttfk
rN   Y nX dd }|| rt| dkrt | d tdt	fr|| d rt| d d dkrt
dd | d D r| d dkrt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 j| 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.3zPassing 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   | j  }| |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.3zCase-insensitive capstyles are deprecated since %(since)s and support for them will be removed %(removal)s; please pass them in lowercase.)ra   butt
projectingzCase-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   r   r   )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	rt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 )NTFz3.2zSupport 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^   )r   )TF)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| j } | 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| j } | 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odk n  r$| 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odkn  r$| 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|  r&| r&t dt| dkrTt| d tsHt dt| d S t| dkrt| d | d fg}nt| dkrt dn|j }g }xR|D ]J\}}tj||}tj|d}|dkrt d	| ||}|j	||f qW 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| jddkr$tdt| ti d} W n4 tk
rj } ztd| |f |W Y dd}~X nX t | tr|| }ntd|  |jt	t
t	tB  }|rtd	| t	 }xb|jD ]X}tj||}||kr||jkrtd
j||||krtdj|||j|g qW t|t|jks0tx(|jD ]}tj||}|j|| q8W x&|j j 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j|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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|j|  W n. |jk
rL } ztd|W Y d d }~X 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   loggingnumbersr   r   rM   r   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   Z
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>






