
    G8c%                     L   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j                  e      Zg dZe
j$                   G d d             Zej(                  j+                   e	j,                         d      Zej(                  j+                   e	j0                         d      gZd	Zh d
ZdD  ci c]  } | | j9                  dd       c} ZdZddZddZ  ejB                  dj+                   e"djF                   e$ee%jL                                          d        Z'ejP                  d d       Z) e
jT                  d      d        Z+ e
jT                  d      d        Z,d Z-d Z.d Z/ G d de0      Z1 e.e      Z2 e1       Z3g Z4d Z5 e5        yc c} w )!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                   N    e Zd Z  ej                  dd       ed             Zy)__getattr__3.5 )obj_typec                 :    t        j                  dt        z        S )Nz([\S]+).%s$)recompileSTYLE_EXTENSION)selfs    7/usr/lib/python3/dist-packages/matplotlib/style/core.py<lambda>z__getattr__.<lambda>    s    RZZ @A     N)__name__
__module____qualname__r   
deprecatedpropertySTYLE_FILE_PATTERN r   r   r   r      s(    <<XA>C Dr   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timezoneinteractivebackend_fallback)seabornz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-whitegridr2   zseaborn-v0_8zThe 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.c                 r    i }| D ]/  }|t         v r|st        j                  d|d       (| |   ||<   1 |S )NzStyle includes a parameter, z9, that is not related to style.  Ignoring this parameter.)STYLE_BLACKLISTr   warn_external)dwarnokeys       r    _remove_blacklisted_style_paramsr:   J   sY    
A /!""23' :B BC sVAcF Hr   c                 X    t         j                  j                  t        | |             y )Nr7   )mplrcParamsupdater:   )r6   r7   s     r   _apply_styler@   W   s    LL8FGr   
z- {})r9   c                    t        | t        t        f      st        | d      r| g}n| }dddfd}t	        ||      D ]  } t        | t        t        f      st        |        %| dk(  r/t        j                         5  t        t        d       ddd       Y| t        v rt        t        |           t	 t        | d	      }t        |        y# 1 sw Y   xY w# t        $ r }t        d
j                  |             |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  | 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
    keysdefaultclassic)mpl20mpl15c                     t        | t              r>j                  | |       } | t        v r$t	        j
                  dt               t        |    } | S Nz3.6)message)
isinstancestrget_DEPRECATED_SEABORN_STYLESr   warn_deprecated_DEPRECATED_SEABORN_MSG)sstyle_aliass    r   	fix_stylezuse.<locals>.fix_style   sF    a1%A..$$U4KL.q1r   Fr<   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)rK   rL   r   hasattrmapr@   r   'suppress_matplotlib_deprecation_warningr   r   r   IOErrorformat)stylestylesrS   rcerrrR   s        @r   r   r   [   s    P %#t%)?%	:K Y' ?%#t-i ==? :_59: :g(?(UKR ?: :  ?''-ve}6 <???s$   >C5CC		D%D  D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  | 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)r=   
rc_context
rcdefaultsr   )r[   after_resets     r   r	   r	      s=     6 
	 NNE
	  s   A&A	AAAr   c                  $    t        t              } | S )z+Load style library defined in this package.)read_style_directoryBASE_LIBRARY_PATH)r   s    r   load_base_libraryrf      s     ##45GNr   c               #      K   t         D ]e  } t        j                  j                  |       } t        j                  j	                  |       sBt        j                  j                  |       sb|  g y w)N)USER_LIBRARY_PATHSospath
expanduserexistsisdir)stylelib_paths    r   iter_user_librariesro      sN     +  **=977>>-(RWW]]=-I s   AA2A2+A2c                     t        t        j                  j                  t              D ]  }t        |      }t        | |        | S )z0Update style library with user-defined rc files.)rW   ri   rj   rk   rh   rd   update_nested_dict)r   rn   r\   s      r   update_user_libraryrr      s>    RWW//1CD ,%m47F+, Nr   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)recordFrT   Nz	In %s: %s)dictr   globr   warningscatch_warningsr   stem_logwarningrJ   )	style_dirr\   rj   warnsws        r   rd   rd      s    VFY$$r/):%;< 7$$D1 	2U 35!2F499	2  	7ALLdAII6	7	7 M	2 	2s   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
setdefaultr?   )	main_dictnew_dictnamerc_dicts       r   rq   rq      s?     ") 7gT2&--g67r   c                       e Zd Zd Zy)_StyleLibraryc                     |t         v r$t        j                  dt               t         |   }t        j                  | |      S rI   )rN   r   rO   rP   ru   __getitem__)r   r9   s     r   r   z_StyleLibrary.__getitem__   s9    ,,  0GH,S1Cc**r   N)r   r   r   r   r    r   r   r   r      s    +r   r   c                      t         j                          t         j                  t        t                     t        t         j                               t        dd y)zReload the style library.N)r   clearr?   rr   _base_librarysortedrC   r
   r    r   r   r   r     s1    MMONN&}56',,.)IaLr   )T)F)6__doc__
contextlibloggingri   pathlibr   r   rw   
matplotlibr=   r   r   r   r   	getLoggerr   rz   __all__caching_module_getattrr   rj   joinget_data_pathre   get_configdirrh   r   r4   replacerN   rP   r:   r@   SubstitutionrW   rZ   r   rL   lowerr   contextmanagerr	   r   rf   ro   rr   rd   rq   ru   r   r   r   r
   r   )rQ   s   0r   <module>r      s     	  	   M Mw"
F D D D
 GGLL!2!2!2!4jA ggll#43#4#4#6
CD (	 qyyN++ ,, 
H IIc&--SYY!GHIG?G?T  B      	+D + %%67
/	*  Is   =F!