File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -132,9 +132,16 @@ def _read_entry_points(self):
132
132
# format):
133
133
# [project.entry-points."matplotlib.backend"]
134
134
# inline = "matplotlib_inline.backend_inline"
135
- import importlib_metadata as im
135
+ import importlib .metadata as im
136
+ import sys
137
+
138
+ # entry_points group keyword not available before Python 3.10
136
139
group = "matplotlib.backend"
137
- entries = [(entry .name , entry .value ) for entry in im .entry_points (group = group )]
140
+ if sys .version_info >= (3 , 10 ):
141
+ entry_points = im .entry_points (group = group )
142
+ else :
143
+ entry_points = im .entry_points ().get (group , {})
144
+ entries = [(entry .name , entry .value ) for entry in entry_points ]
138
145
139
146
# For backward compatibility, if matplotlib-inline and/or ipympl are installed
140
147
# but too old to include entry points, create them. Do not import ipympl
Original file line number Diff line number Diff line change @@ -413,7 +413,7 @@ def draw_if_interactive() -> None:
413
413
if newbackend in ("ipympl" , "widget" ):
414
414
# ipympl < 0.9.4 expects rcParams["backend"] to be the fully-qualified backend
415
415
# name "module://ipympl.backend_nbagg" not short names "ipympl" or "widget".
416
- import importlib_metadata as im
416
+ import importlib . metadata as im
417
417
from matplotlib import _parse_to_version_info # type: ignore[attr-defined]
418
418
try :
419
419
module_version = im .version ("ipympl" )
You can’t perform that action at this time.
0 commit comments