@@ -72,7 +72,7 @@ def use(style):
7272
7373 Parameters
7474 ----------
75- style : str, dict, list or Path object
75+ style : str, dict, Path or list object
7676 A style specification. Valid options are:
7777
7878 +------+-------------------------------------------------------------+
@@ -91,8 +91,7 @@ def use(style):
9191 """
9292 style_alias = {'mpl20' : 'default' ,
9393 'mpl15' : 'classic' }
94- if isinstance (style , str ) or hasattr (style , 'keys' ) or \
95- isinstance (style , Path ):
94+ if isinstance (style , (str , Path )) or hasattr (style , 'keys' ):
9695 # If name is a single str, Path or dict, make it a single element list.
9796 styles = [style ]
9897 else :
@@ -101,7 +100,7 @@ def use(style):
101100 styles = (style_alias .get (s , s ) if isinstance (s , str ) else s
102101 for s in styles )
103102 for style in styles :
104- if not isinstance (style , str ) and not isinstance ( style , Path ):
103+ if not isinstance (style , ( str , Path ) ):
105104 _apply_style (style )
106105 elif style == 'default' :
107106 # Deprecation warnings were already handled when creating
@@ -111,8 +110,6 @@ def use(style):
111110 elif style in library :
112111 _apply_style (library [style ])
113112 else :
114- if isinstance (style , Path ):
115- style = str (style )
116113 try :
117114 rc = rc_params_from_file (style , use_default_template = False )
118115 _apply_style (rc )
@@ -129,7 +126,7 @@ def context(style, after_reset=False):
129126
130127 Parameters
131128 ----------
132- style : str, dict, or list
129+ style : str, dict, Path or list
133130 A style specification. Valid options are:
134131
135132 +------+-------------------------------------------------------------+
@@ -139,8 +136,10 @@ def context(style, after_reset=False):
139136 | dict | Dictionary with valid key/value pairs for |
140137 | | `matplotlib.rcParams`. |
141138 +------+-------------------------------------------------------------+
142- | list | A list of style specifiers (str or dict) applied from first |
143- | | to last in the list. |
139+ | Path | A Path object which is a path to a style file. |
140+ +------+-------------------------------------------------------------+
141+ | list | A list of style specifiers (str, Path or dict) applied from |
142+ | | first to last in the list. |
144143 +------+-------------------------------------------------------------+
145144
146145 after_reset : bool
0 commit comments