
    ^j
#                        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$ ejJ                  d      d        Z&d Z' ejJ                  d      d        Z(d Z) ejJ                  d      d        Z* e'e      Z+i Z,g Z-d Z. e.        y)a  
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. Underscore-prefixed names are considered private and
    not listed, though may still be accessed directly from ``library``.
``library``
    A dictionary of style names and matplotlib settings.
    N)Path)_api
_docstringrc_params_from_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 ]E  } t        | t              r|j	                  | |       } | dk(  rAt        j                         5  t        D ci c]  }|t        vr
|t        |    } }ddd       nd| t        v r
t        |    } nRd| v rN| j                  d      \  }}}	 t        j                  j                  |      | dt         z  }t        |d      } t        | t        t        f      r	 t        | d      } i }
| D ],  }|t        v rt        j&                  d
|d       %| |   |
|<   . t(        j*                  j-                  |
       H 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.Fuse_default_templatez 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/opt/ringagent/.cad-venv/lib/python3.12/site-packages/matplotlib/style/__init__.pyr   r   +   s   h %#t%)?%	:K )&eS!OOE51E	! AAC ;<K ;q !)9 9  22 ;E ;; ; '!$//4Q
$..44S9tfAFVEW<XXD/5QE ec4[)I+EN  	'A$$""21% 8B CD $Ah	' 	H%S)&;; ; ,Wi@    Ii  > ?@ FIIIsH   /	E?8E:E?8FF,:E??F	F)$F),	G	5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)r8   
rc_context
rcdefaultsr   )r;   after_resets     rF   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osrB   
expanduserUSER_LIBRARY_PATHS_read_style_directory_update_nested_dict)r   stylelib_pathr<   s      rF   _update_user_libraryrS      s>    RWW//1CD -&}5GV,- N    z3.11c                     t        |       S N)rS   )r   s    rF   update_user_libraryrW      s    ((rT   c                 @   t               }t        |       j                  dt               D ]c  }t	        j
                  d      5 }t        |d      ||j                  <   ddd       D ]#  }t        j                  d||j                         % e |S # 1 sw Y   5xY w)z3Return dictionary of styles defined in *style_dir*.z*.T)recordFr'   Nz	In %s: %s)dictr   globr3   warningscatch_warningsr   stem_logwarningmessage)	style_dirr<   rB   warnsws        rF   rP   rP      s    VFY$$r*:);%<= 7$$D1 	VU 3Du UF499	V 	7ALLdAII6	77
 M		V 	Vs   BB	c                     t        |       S rV   )rP   )rb   s    rF   read_style_directoryrf      s     ++rT   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
setdefaultr:   )	main_dictnew_dictrA   rc_dicts       rF   rQ   rQ      s?     ") 7gT2&--g67rT   c                     t        | |      S rV   )rQ   )rj   rk   s     rF   update_nested_dictrn      s    y(33rT   c                      t         j                          t         j                  t        t        j                                      t        d t         D              t        dd y)zReload the style library.c              3   D   K   | ]  }|j                  d       r|  yw)r@   N)
startswith).0rA   s     rF   	<genexpr>z!reload_library.<locals>.<genexpr>   s     O4$//#:N$Os     N)r   clearr:   rS   _base_librarycopysortedr
    rT   rF   r   r      s:    MMONN'(:(:(<=>O7OOIaLrT   )F)/__doc__
contextlibimportlib.resourcesr0   loggingrM   pathlibr   r\   
matplotlibr8   r   r   r   r   	getLogger__name__r_   __all__rB   joinget_data_path_BASE_LIBRARY_PATHget_configdirrO   r3   r.   SubstitutionrL   formatrw   r*   lowerr   contextmanagerr	   rS   
deprecatedrW   rP   rf   rQ   rn   ru   r   r
   r   rx   rT   rF   <module>r      s      	    M Mw"
F WW\\"3#"3"3"5zB ggll#43#4#4#6
CD  (  IIc&--(8cii!HIJb&b&J ( (V ) ) , , 4 4 &&89
	P  rT   