o
    tBh                   
   @   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g dZe
jG dd dZeje	 dZeje	 dgZd	Zh d
Zd%ddZd%ddZededj e!ee"j#ddd Z$ej%d&ddZ&e
'ddd Z(e
'ddd Z)dd Z*dd  Z+d!d" Z,e+eZ-da.g Z/d#d$ Z0e0  dS )'aD  
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   l/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/matplotlib/style/core.py<lambda>    s    z__getattr__.<lambda>N)__name__
__module____qualname__r   
deprecatedpropertySTYLE_FILE_PATTERNr   r   r   r   r      s    
r   stylelibmplstyle>   
date.epochwebagg.portwebagg.addresstk.window_focussavefig.directorydocstring.hardcopyfigure.raise_windowwebagg.port_retrieswebagg.open_in_browserfigure.max_open_warningbackendtoolbardatapathtimezoneinteractivebackend_fallbackTc                 C   s>   i }| D ]}|t v r|rtd|d q| | ||< q|S )NzStyle includes a parameter, z9, that is not related to style.  Ignoring this parameter.)STYLE_BLACKLISTr   warn_external)dwarnokeyr   r   r    _remove_blacklisted_style_params0   s   
r5   c                 C   s   t jt| |d d S )Nr2   )mplrcParamsupdater5   )r1   r2   r   r   r   _apply_style=   s   r:   
z- {})r4   c                    s   ddd t | ttfst| dr| g}n| } fdd|D }|D ]X} t | ttfs0t|  q"| dkrOt  ttdd W d	   n1 sIw   Y  q"| tv rZtt|   q"zt	| dd
}t| W q" t
yz } zt
d| |d	}~ww d	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
    defaultclassic)mpl20mpl15keysc                 3   s*    | ]}t |tr ||n|V  qd S N)
isinstancestrget).0sstyle_aliasr   r   	<genexpr>q   s    "zuse.<locals>.<genexpr>Fr6   N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 styles)rB   rC   r   hasattrr:   r   'suppress_matplotlib_deprecation_warningr   r
   r   IOErrorformat)stylestylesrcerrr   rG   r   r   A   s@   (


r   Fc                 c   sJ    t   |rt   t|  dV  W d   dS 1 sw   Y  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)r7   
rc_context
rcdefaultsr   )rP   after_resetr   r   r   r      s   
"r   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   rY   c                  c   s:    t D ]} tj| } tj| rtj| r| V  qd S rA   )USER_LIBRARY_PATHSospath
expanduserexistsisdir)stylelib_pathr   r   r   iter_user_libraries   s   ra   c                 C   s*   t tjjtD ]}t|}t| | q| S )z0Update style library with user-defined rc files.)mapr[   r\   r]   rZ   rW   update_nested_dict)r
   r`   rQ   r   r   r   update_user_library   s   rd   c              	   C   s|   t  }t| dt D ].}tjdd}t|dd||j< W d   n1 s)w   Y  |D ]
}t	d||j
 q0q|S )z3Return dictionary of styles defined in *style_dir*.z*.T)recordFrJ   Nz	In %s: %s)dictr   globr   warningscatch_warningsr   stem_logwarningmessage)	style_dirrQ   r\   warnswr   r   r   rW      s   rW   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
setdefaultr9   )	main_dictnew_dictnamerc_dictr   r   r   rc      s   	rc   c                   C   s    t tatt tdd< dS )zReload the style library.N)rd   _base_libraryr
   sortedr@   r	   r   r   r   r   r      s   r   )T)F)1__doc__
contextlibloggingr[   pathlibr   r   rh   
matplotlibr7   r   r   r   r   	getLoggerr   rk   __all__caching_module_getattrr   r\   joinget_data_pathrX   get_configdirrZ   r   r/   r5   r:   Substitutionrb   rO   rx   rC   lowerr   contextmanagerr   r   rY   ra   rd   rW   rc   rw   r
   r	   r   r   r   r   r   <module>   sJ    



D!


