U
    d»{já$  ã                   @   s|  d Z ddlZddl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m
Z
mZmZmZ e e¡Zddddd	gZe
jG d
d„ dƒƒZej e	 ¡ d¡Zej e	 ¡ d¡gZdZdddddddddddddddhZd4dd„Zd5d d!„Ze d" ed#j e!ee"j#d$�ƒ¡¡d%d„ ƒZ$ej%d6d'd„ƒZ&e
 'd(¡d)d*„ ƒZ(e
 'd(¡d+d,„ ƒZ)d-d.„ Z*d/d0„ Z+d1d2„ Z,e+eƒZ-da.g Z/d3d	„ Z0e0ƒ  dS )7aD  
Core functions and attributes for the matplotlib style library:

``use``
    Select style sheet to override the current matplotlib settings.
``context``
    Context manager to use a style sheet temporarily.
``available``
    List available style sheets.
``library``
    A dictionary of style names and matplotlib settings.
é    N)ÚPath)Ú_apiÚ
_docstringÚrc_params_from_fileÚrcParamsDefaultÚuseÚcontextÚ	availableÚlibraryÚreload_libraryc                   @   s&   e Zd Zejddd�edd„ ƒƒZdS )Ú__getattr__ú3.5Ú )Úobj_typec                 C   s   t  dt ¡S )Nz([\S]+).%s$)ÚreÚcompileÚSTYLE_EXTENSION)Úself© r   úT/var/www/html/bwave/python/venv/lib/python3.8/site-packages/matplotlib/style/core.pyÚ<lambda>    ó    z__getattr__.<lambda>N)Ú__name__Ú
__module__Ú__qualname__r   Ú
deprecatedÚpropertyZSTYLE_FILE_PATTERNr   r   r   r   r      s   ÿr   ZstylelibZmplstyleÚinteractiveÚbackendzwebagg.portzwebagg.addresszwebagg.port_retrieszwebagg.open_in_browserZbackend_fallbackZtoolbarÚtimezonezfigure.max_open_warningzfigure.raise_windowzsavefig.directoryztk.window_focuszdocstring.hardcopyz
date.epochTc                 C   s>   i }| D ]0}|t kr,|r8t d|›d�¡ q| | ||< q|S )NzStyle includes a parameter, z9, that is not related to style.  Ignoring this parameter.)ÚSTYLE_BLACKLISTr   Zwarn_external)ÚdÚwarnÚoÚkeyr   r   r   Ú _remove_blacklisted_style_params0   s    
ÿr%   c                 C   s   t j t| |d�¡ d S )N©r"   )ÚmplZrcParamsÚupdater%   )r!   r"   r   r   r   Ú_apply_style=   s    r)   Ú
z- {})r$   c                    sò   t | ttfƒst| dƒr | g}n| }dddœ‰ ‡ fdd„}t||ƒD ]¨} t | ttfƒs`t| ƒ qD| dkrŠt ¡ � ttdd� W 5 Q R X qD| t	kr tt	|  ƒ qDzt
| dd	�}t|ƒ W qD tk
rê } ztd
 | ¡ƒ|‚W 5 d}~X Y qDX qDdS )aë  
    Use Matplotlib style settings from a style specification.

    The style name of 'default' is reserved for reverting back to
    the default style settings.

    .. note::

       This updates the `.rcParams` with the settings from the style.
       `.rcParams` not defined in the style are kept.

    Parameters
    ----------
    style : str, dict, Path or list
        A style specification. Valid options are:

        +------+-------------------------------------------------------------+
        | str  | The name of a style or a path/URL to a style file. For a    |
        |      | list of available style names, see `.style.available`.      |
        +------+-------------------------------------------------------------+
        | dict | Dictionary with valid key/value pairs for                   |
        |      | `matplotlib.rcParams`.                                      |
        +------+-------------------------------------------------------------+
        | Path | A path-like object which is a path to a style file.         |
        +------+-------------------------------------------------------------+
        | list | A list of style specifiers (str, Path or dict) applied from |
        |      | first to last in the list.                                  |
        +------+-------------------------------------------------------------+

    Notes
    -----
    The following `.rcParams` are not related to style and will be ignored if
    found in a style specification:

    %s
    ÚkeysÚdefaultZclassic)Zmpl20Zmpl15c                    s<   t | tƒr8ˆ  | | ¡} | dkr8tjddd� |  dd¡} | S )N)Úseabornzseaborn-brightzseaborn-colorblindzseaborn-darkzseaborn-darkgridzseaborn-dark-palettezseaborn-deepzseaborn-mutedzseaborn-notebookzseaborn-paperzseaborn-pastelzseaborn-posterzseaborn-talkzseaborn-tickszseaborn-whitezseaborn-whitegridz3.6zûThe seaborn styles shipped by Matplotlib are deprecated since %(since)s, as they no longer correspond to the styles shipped by seaborn. However, they will remain available as 'seaborn-v0_8-<style>'. Alternatively, directly use the seaborn API instead.)Úmessager-   zseaborn-v0_8)Ú
isinstanceÚstrÚgetr   Zwarn_deprecatedÚreplace)Ús©Zstyle_aliasr   r   Ú	fix_styleq   s    
 ÿzuse.<locals>.fix_styleFr&   ©Zuse_default_templatez|{!r} not found in the style library and input is not a valid URL or path; see `style.available` for list of available stylesN)r/   r0   r   ÚhasattrÚmapr)   r   Z'suppress_matplotlib_deprecation_warningr   r
   r   ÚIOErrorÚformat)ÚstyleÚstylesr5   ÚrcÚerrr   r4   r   r   A   s0    (


þÿýFc              	   c   s2   t  ¡ �  |rt  ¡  t| ƒ dV  W 5 Q R X dS )a	  
    Context manager for using style settings temporarily.

    Parameters
    ----------
    style : str, dict, Path or list
        A style specification. Valid options are:

        +------+-------------------------------------------------------------+
        | str  | The name of a style or a path/URL to a style file. For a    |
        |      | list of available style names, see `.style.available`.      |
        +------+-------------------------------------------------------------+
        | dict | Dictionary with valid key/value pairs for                   |
        |      | `matplotlib.rcParams`.                                      |
        +------+-------------------------------------------------------------+
        | Path | A path-like object which is a path to a style file.         |
        +------+-------------------------------------------------------------+
        | list | A list of style specifiers (str, Path or dict) applied from |
        |      | first to last in the list.                                  |
        +------+-------------------------------------------------------------+

    after_reset : bool
        If True, apply style after resetting settings to their defaults;
        otherwise, apply style on top of the current settings.
    N)r'   Z
rc_contextZ
rcdefaultsr   )r;   Zafter_resetr   r   r   r   ¤   s
    
r   c                  C   s   t tƒ} | S )z+Load style library defined in this package.)Úread_style_directoryÚBASE_LIBRARY_PATH)r
   r   r   r   Úload_base_libraryÆ   s    rA   c                  c   s8   t D ].} tj | ¡} tj | ¡rtj | ¡r| V  qd S )N)ÚUSER_LIBRARY_PATHSÚosÚpathÚ
expanduserÚexistsÚisdir)Ústylelib_pathr   r   r   Úiter_user_librariesÍ   s    rI   c                 C   s*   t tjjtƒD ]}t|ƒ}t| |ƒ q| S )z0Update style library with user-defined rc files.)r8   rC   rD   rE   rB   r?   Úupdate_nested_dict)r
   rH   r<   r   r   r   Úupdate_user_libraryÕ   s    rK   c              
   C   sh   t ƒ }t| ƒ dt› �¡D ]H}tjdd��}t|dd�||j< W 5 Q R X |D ]}t 	d||j
¡ qLq|S )z3Return dictionary of styles defined in *style_dir*.z*.T)ÚrecordFr6   z	In %s: %s)Údictr   Úglobr   ÚwarningsÚcatch_warningsr   ÚstemÚ_logÚwarningr.   )Z	style_dirr<   rD   ZwarnsÚwr   r   r   r?   Ý   s     ÿr?   c                 C   s(   |  ¡ D ]\}}|  |i ¡ |¡ q| S )a  
    Update nested dict (only level of nesting) with new values.

    Unlike `dict.update`, this assumes that the values of the parent dict are
    dicts (or dict-like), so you shouldn't replace the nested dict if it
    already exists. Instead you should update the sub-dict.
    )ÚitemsÚ
setdefaultr(   )Z	main_dictZnew_dictÚnameZrc_dictr   r   r   rJ   é   s    	rJ   c                   C   s    t tƒatt ¡ ƒtdd…< dS )zReload the style library.N)rK   Ú_base_libraryr
   Úsortedr+   r	   r   r   r   r   r   þ   s    )T)T)F)1Ú__doc__Ú
contextlibÚloggingrC   Úpathlibr   r   rO   Z
matplotlibr'   r   r   r   r   Ú	getLoggerr   rR   Ú__all__Zcaching_module_getattrr   rD   ÚjoinZget_data_pathr@   Zget_configdirrB   r   r    r%   r)   ZSubstitutionr8   r:   rY   r0   Úlowerr   Úcontextmanagerr   r   rA   rI   rK   r?   rJ   rX   r
   r	   r   r   r   r   r   Ú<module>   sf   
          û

ÿ
`!

