
    g                      :   d Z ddl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	mZmZmZmZ  ej                  e      Zg dZej&                  j)                   e
j*                         d      Zej&                  j)                   e
j.                         d      gZdZh dZ ej6                  d	j)                   ed
j:                   eeej@                                          d        Z!ejD                  dd       Z#d Z$d Z%d Z& e%e      Z'i Z(g Z)d Z* e*        y)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 ]A  } t        | t              r|j	                  | |       } | dk(  rAt        j                         5  t        D ci c]  }|t        vr
|t        |    } }ddd       nb| t        v r
t        |    } nPd| v rL| j                  d      \  }}}	 t        j                  j                  |      | dt         z  }t        |      } t        | t        t        f      r	 t        |       } i }
| D ],  }|t        v rt        j&                  d|d	       %| |   |
|<   . t(        j*                  j-                  |
       D yc c}w # 1 sw Y   xY w# t         t"        t$        f$ r
}Y d}~d}~ww xY w# t"        $ r}	t#        | d      |	d}	~	ww xY w)
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mpl15N.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   STYLE_BLACKLISTr   
rpartition	importlib	resourcesfilesSTYLE_EXTENSIONr   ModuleNotFoundErrorOSError	TypeErrorwarn_externalmplrcParamsupdate)stylestylesstyle_aliaskpkg_namepathexcerrfiltereds              R/var/www/dash_apps/app1/venv/lib/python3.12/site-packages/matplotlib/style/core.pyr   r   *   s   h %#t%)?%	:K )&eS!OOE51E	! AAC :<K :q ! 8  22 :E :: : '!$//4Q
$..44S9tfAoEV<WWD.t4E ec4[)I*51  	'AO#""21% 8B CD $Ah	' 	H%S)&:: : ,Wi@    Ii  > ?@ FIIIsH   /	E;8E6E;6FF(6E;;F	F% F%(	G1G  Gc              #      K   t        j                         5  |rt        j                          t        |        d ddd       y# 1 sw Y   yxY ww)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)r6   
rc_context
rcdefaultsr   )r9   after_resets     rD   r	   r	      s>     J 
	 NNE
	  s   A&A	AAAc                     t        t        j                  j                  t              D ]  }t        |      }t        | |        | S )z0Update style library with user-defined rc files.)maposr@   
expanduserUSER_LIBRARY_PATHSread_style_directoryupdate_nested_dict)r   stylelib_pathr:   s      rD   update_user_libraryrQ      s>    RWW//1CD ,%m47F+, N    c                 <   t               }t        |       j                  dt               D ]a  }t	        j
                  d      5 }t        |      ||j                  <   ddd       D ]#  }t        j                  d||j                         % c |S # 1 sw Y   5xY w)z3Return dictionary of styles defined in *style_dir*.z*.T)recordNz	In %s: %s)dictr   globr1   warningscatch_warningsr   stem_logwarningmessage)	style_dirr:   r@   warnsws        rD   rN   rN      s    VFY$$r/):%;< 7$$D1 	9U 24 8F499	9 	7ALLdAII6	77
 M		9 	9s   BB	c                 x    |j                         D ]&  \  }}| j                  |i       j                  |       ( | 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
setdefaultr8   )	main_dictnew_dictr?   rc_dicts       rD   rO   rO      s?     ") 7gT2&--g67rR   c                      t         j                          t         j                  t        t                     t        t         j                               t        dd y)zReload the style library.N)r   clearr8   rQ   _base_librarysortedr!   r
    rR   rD   r   r      s1    MMONN&}56',,.)IaLrR   )F)+__doc__
contextlibimportlib.resourcesr.   loggingrK   pathlibr   rW   
matplotlibr6   r   r   r   r   	getLogger__name__rZ   __all__r@   joinget_data_pathBASE_LIBRARY_PATHget_configdirrM   r1   r,   SubstitutionrJ   formatri   r(   lowerr   contextmanagerr	   rQ   rN   rO   rh   r   r
   r   rj   rR   rD   <module>r|      s%      	    L Lw"
F GGLL!2!2!2!4jA ggll#43#4#4#6
CD ( IIc&--SYY!GHIb&b&J ( (V  %%67
	*  rR   