o
    li&                  
   @   sT  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ejdkr(ddl	m
Z n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e dZeje dgZdZh d	Zd
d dD ZdZe de!dj"e#ee$j%ddd Z&ej'd ddZ(dd Z)dd Z*dd Z+G dd de,Z-e*eZ.e- Z/g Z0dd Z1e1  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_in_filercParamsDefault)usecontext	availablelibraryreload_library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timezoneinteractivebackend_fallbackc                 C   s   i | ]	}|| d dqS )seabornzseaborn-v0_8)replace).0s r#   S/home/ubuntu/SoloSpeech/.venv/lib/python3.10/site-packages/matplotlib/style/core.py
<dictcomp>/   s    r%   )r   z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-whitegridzThe 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.
z- {})keyc                 C   s  t | ttfst| dr| g}n| }ddd}|D ]} t | tr|| | } | tv r5tjdtd t|  } | dkrUt	  dd t
D } W d	   n1 sOw   Y  n=| tv r^t|  } n4d
| v r| d
\}}}zt|| d
t  }t|} W n tttfy } zW Y d	}~nd	}~ww t | ttfrzt| } W n ty } zt| d|d	}~ww i }	| D ]}
|
tv rtd|
d q| |
 |	|
< qtj|	 q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
            - One of the style names in `.style.available` (a builtin style or
              a style installed in the user library path).

            - A dotted name of the form "package.style_name"; in that case,
              "package" should be an importable Python package name, e.g. at
              ``/path/to/package/__init__.py``; the loaded style file is
              ``/path/to/package/style_name.mplstyle``.  (Style files in
              subpackages are likewise supported.)

            - The path or URL to a style file, which gets loaded by
              `.rc_params_from_file`.

        dict
            A mapping of key/value pairs for `matplotlib.rcParams`.

        Path
            The path to a style file, which gets loaded by
            `.rc_params_from_file`.

        list
            A list of style specifiers (str, Path or dict), which are 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defaultclassic)mpl20mpl153.6messagec                 S   s   i | ]}|t vr|t| qS r#   )STYLE_BLACKLISTr   )r!   kr#   r#   r$   r%      s    zuse.<locals>.<dictcomp>N.z is not a valid package style, path of style file, URL of style file, or library style name (library styles are listed in `style.available`)zStyle includes a parameter, z9, that is not related to style.  Ignoring this parameter.)
isinstancestrr   hasattrget_DEPRECATED_SEABORN_STYLESr   warn_deprecated_DEPRECATED_SEABORN_MSG'suppress_matplotlib_deprecation_warningr   r   
rpartitionimportlib_resourcesfilesSTYLE_EXTENSIONr   ModuleNotFoundErrorOSError	TypeErrorIOErrorr0   warn_externalmplrcParamsupdate)stylestylesstyle_aliaspkg_namepathexcerrfilteredr1   r#   r#   r$   r	   K   s`   4




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
            - One of the style names in `.style.available` (a builtin style or
              a style installed in the user library path).

            - A dotted name of the form "package.style_name"; in that case,
              "package" should be an importable Python package name, e.g. at
              ``/path/to/package/__init__.py``; the loaded style file is
              ``/path/to/package/style_name.mplstyle``.  (Style files in
              subpackages are likewise supported.)

            - The path or URL to a style file, which gets loaded by
              `.rc_params_from_file`.
        dict
            A mapping of key/value pairs for `matplotlib.rcParams`.

        Path
            The path to a style file, which gets loaded by
            `.rc_params_from_file`.

        list
            A list of style specifiers (str, Path or dict), which are 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)rD   
rc_context
rcdefaultsr	   )rG   after_resetr#   r#   r$   r
      s   
%"r
   c                 C   s*   t tjjtD ]}t|}t| | q| S )z0Update style library with user-defined rc files.)maposrM   
expanduserUSER_LIBRARY_PATHSread_style_directoryupdate_nested_dict)r   stylelib_pathrH   r#   r#   r$   update_user_library   s   r[   c              	   C   sx   t  }t| dt D ],}tjdd}t|||j< W d   n1 s'w   Y  |D ]
}t	d||j
 q.q|S )z3Return dictionary of styles defined in *style_dir*.z*.T)recordNz	In %s: %s)dictr   globr>   warningscatch_warningsr   stem_logwarningr/   )	style_dirrH   rM   warnswr#   r#   r$   rX      s   rX   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
setdefaultrF   )	main_dictnew_dictrL   rc_dictr#   r#   r$   rY      s   	rY   c                   @   s   e Zd Zdd ZdS )_StyleLibraryc                 C   s*   |t v rtjdtd t | }t| |S )Nr-   r.   )r7   r   r8   r9   r]   __getitem__)selfr'   r#   r#   r$   rm     s   z_StyleLibrary.__getitem__N)__name__
__module____qualname__rm   r#   r#   r#   r$   rl     s    rl   c                   C   s.   t   t tt tt  tdd< dS )zReload the style library.N)r   clearrF   r[   _base_librarysortedr(   r   r#   r#   r#   r$   r     s   r   )F)2__doc__
contextlibloggingrU   pathlibr   sysr_   version_infoimportlib.resources	resourcesr<   
matplotlibrD   r   r   r   r   	getLoggerro   rb   __all__rM   joinget_data_pathBASE_LIBRARY_PATHget_configdirrW   r>   r0   r7   r9   SubstitutionrT   formatrt   r4   lowerr	   contextmanagerr
   r[   rX   rY   r]   rl   rs   r   r   r   r#   r#   r#   r$   <module>   sL    


i+
