
    Ng!                     b   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j        e          Zg dZej                             ej                    d          Zej                             ej                    d          gZdZh d	Z ej        d
                     edj          e!ee"j#                                                d             Z$ej%        dd            Z&d Z'd Z(d Z) e(e          Z*i Z+g Z,d Z- e-             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_fallback
z- {})keyc                    t          | t          t          f          st          | d          r| g}n| }ddd}|D ]} t          | t                    r|                    | |           } | dk    r=t          j                    5  d t          D             } ddd           n# 1 swxY w Y   n| t          v rt          |          } nsd| v ro| 	                    d          \  }}}	 t          j        |          | dt           z  }t          |          } n$# t          t          t           f$ r
}Y d}~nd}~ww xY wt          | t          t          f          r6	 t          |           } n%# t          $ r}t          | d          |d}~ww xY wi }	| D ]/}
|
t"          v rt          j        d	|
d
           $| |
         |	|
<   0t&          j                            |	           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mpl15c                 <    i | ]}|t           v|t          |         S  )STYLE_BLACKLISTr	   ).0ks     Q/var/www/html/ai-engine/env/lib/python3.11/site-packages/matplotlib/style/core.py
<dictcomp>zuse.<locals>.<dictcomp>u   s3     : : :q ! 8 8  2 8 8 8    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getr   'suppress_matplotlib_deprecation_warningr	   r   
rpartitionimportlib_resourcesfilesSTYLE_EXTENSIONr   ModuleNotFoundErrorOSError	TypeErrorr*   warn_externalmplrcParamsupdate)stylestylesstyle_aliaspkg_namepathexcerrfilteredr,   s              r-   r
   r
   1   s   h %#t%% )?)? %	::K *& *&eS!! 	OOE511E	!! ACC : :: :O : : :E: : : : : : : : : : : : : : : '!!$//44Q/5c::!%9999:D.t44EE+Wi@    DDDD ec4[)) 	II*511 I I I ? ? ?@ @ FIII
  	' 	'AO##"C1 C C CD D D D $AhH%%%%U*& *&s<   BB#	&B#	 0DD2-D2E""
F,E??FFc              #      K   t          j                    5  |rt          j                     t          |            dV  ddd           dS # 1 swxY 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)r>   
rc_context
rcdefaultsr
   )rA   after_resets     r-   r   r      s      J 
		   	NE


	                 s   )AAAc                     t          t          j        j        t                    D ]!}t          |          }t          | |           "| S )z0Update style library with user-defined rc files.)maposrG   
expanduserUSER_LIBRARY_PATHSread_style_directoryupdate_nested_dict)r   stylelib_pathrB   s      r-   update_user_libraryrW      sF    RW/1CDD , ,%m447F++++Nr/   c                 P   t                      }t          |                               dt                     D ]l}t	          j        d          5 }t          |          ||j        <   ddd           n# 1 swxY w Y   |D ]#}t          	                    d||j
                   $m|S )z3Return dictionary of styles defined in *style_dir*.z*.T)recordNz	In %s: %s)dictr   globr9   warningscatch_warningsr   stem_logwarningmessage)	style_dirrB   rG   warnsws        r-   rT   rT      s    VVFY$$%;/%;%;<< 7 7$D111 	9U 24 8 8F49	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	7 	7ALLdAI6666	7Ms   A44A8	;A8	c                     |                                 D ].\  }}|                     |i                               |           /| 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@   )	main_dictnew_dictrF   rc_dicts       r-   rU   rU      sN     ")) 7 7gT2&&--g6666r/   c                      t                                            t                               t          t                               t          t                                                     t          dd<   dS )zReload the style library.N)r   clearr@   rW   _base_librarysortedr#   r   r)   r/   r-   r   r      sK    MMOOONN&}55666',,..))IaaaLLLr/   )F).__doc__
contextlibloggingrQ   pathlibr   sysr\   version_infoimportlib.resources	resourcesr7   
matplotlibr>   r   r   r   r	   	getLogger__name__r_   __all__rG   joinget_data_pathBASE_LIBRARY_PATHget_configdirrS   r9   r*   SubstitutionrP   formatrn   r2   lowerr
   contextmanagerr   rW   rT   rU   rm   r   r   r   r)   r/   r-   <module>r      s#         				       



 w5555555      L L L L L L L L L L L Lw""
F
F
F GLL!2!2!4!4jAA gll#43#4#6#6
CCD ( ( ( IIcc&-SY!G!G!GHHII c& c& c&L ( ( ( (V        %$%677
	* * *      r/   