Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1ec609a

Browse files
authored
Merge pull request #19585 from anntzer/unstyle
Deprecate trivial helpers in style.core.
2 parents 1a75a72 + 4fdaca8 commit 1ec609a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
matplotlib.style.core deprecations
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
``STYLE_FILE_PATTERN``, ``load_base_library``, and ``iter_user_libraries`` are
4+
deprecated.

lib/matplotlib/style/core.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
# Users may want multiple library paths, so store a list of paths.
3131
USER_LIBRARY_PATHS = [os.path.join(mpl.get_configdir(), 'stylelib')]
3232
STYLE_EXTENSION = 'mplstyle'
33+
34+
# Deprecated in Matplotlib 3.5.
3335
STYLE_FILE_PATTERN = re.compile(r'([\S]+).%s$' % STYLE_EXTENSION)
3436

3537

@@ -155,12 +157,14 @@ def context(style, after_reset=False):
155157
yield
156158

157159

160+
@_api.deprecated("3.5")
158161
def load_base_library():
159162
"""Load style library defined in this package."""
160163
library = read_style_directory(BASE_LIBRARY_PATH)
161164
return library
162165

163166

167+
@_api.deprecated("3.5")
164168
def iter_user_libraries():
165169
for stylelib_path in USER_LIBRARY_PATHS:
166170
stylelib_path = os.path.expanduser(stylelib_path)
@@ -170,7 +174,7 @@ def iter_user_libraries():
170174

171175
def update_user_library(library):
172176
"""Update style library with user-defined rc files."""
173-
for stylelib_path in iter_user_libraries():
177+
for stylelib_path in map(os.path.expanduser, USER_LIBRARY_PATHS):
174178
styles = read_style_directory(stylelib_path)
175179
update_nested_dict(library, styles)
176180
return library
@@ -204,10 +208,8 @@ def update_nested_dict(main_dict, new_dict):
204208

205209
# Load style library
206210
# ==================
207-
_base_library = load_base_library()
208-
211+
_base_library = read_style_directory(BASE_LIBRARY_PATH)
209212
library = None
210-
211213
available = []
212214

213215

0 commit comments

Comments
 (0)