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

Skip to content

Commit b1b5827

Browse files
authored
Merge pull request #15222 from anntzer/projections
Cleanup projections/__init__.py.
2 parents cf406b7 + 62dd28b commit b1b5827

File tree

2 files changed

+10
-24
lines changed

2 files changed

+10
-24
lines changed

lib/matplotlib/figure.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
import matplotlib.artist as martist
2525
from matplotlib.artist import Artist, allow_rasterization
26-
from matplotlib.backend_bases import FigureCanvasBase
26+
from matplotlib.backend_bases import FigureCanvasBase, NonGuiException
2727
import matplotlib.cbook as cbook
2828
import matplotlib.colorbar as cbar
2929
import matplotlib.image as mimage
@@ -33,18 +33,14 @@
3333
from matplotlib.gridspec import GridSpec
3434
import matplotlib.legend as mlegend
3535
from matplotlib.patches import Rectangle
36-
from matplotlib.projections import (get_projection_names,
37-
process_projection_requirements)
36+
from matplotlib.projections import process_projection_requirements
3837
from matplotlib.text import Text, TextWithDash
3938
from matplotlib.transforms import (Affine2D, Bbox, BboxTransformTo,
4039
TransformedBbox)
4140
import matplotlib._layoutbox as layoutbox
42-
from matplotlib.backend_bases import NonGuiException
4341

4442
_log = logging.getLogger(__name__)
4543

46-
docstring.interpd.update(projection_names=get_projection_names())
47-
4844

4945
def _stale_figure_callback(self, val):
5046
if self.figure:

lib/matplotlib/projections/__init__.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,27 @@
1-
from .. import axes, cbook
1+
from .. import axes, docstring, cbook
22
from .geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
33
from .polar import PolarAxes
44
from mpl_toolkits.mplot3d import Axes3D
55

66

77
class ProjectionRegistry:
8-
"""
9-
Manages the set of projections available to the system.
10-
"""
8+
"""A mapping of registered projection names to projection classes."""
9+
1110
def __init__(self):
1211
self._all_projection_types = {}
1312

1413
def register(self, *projections):
15-
"""
16-
Register a new set of projections.
17-
"""
14+
"""Register a new set of projections."""
1815
for projection in projections:
1916
name = projection.name
2017
self._all_projection_types[name] = projection
2118

2219
def get_projection_class(self, name):
23-
"""
24-
Get a projection class from its *name*.
25-
"""
20+
"""Get a projection class from its *name*."""
2621
return self._all_projection_types[name]
2722

2823
def get_projection_names(self):
29-
"""
30-
Get a list of the names of all projections currently registered.
31-
"""
24+
"""Return the names of all projections currently registered."""
3225
return sorted(self._all_projection_types)
3326

3427

@@ -68,8 +61,5 @@ def process_projection_requirements(figure, *args, **kwargs):
6861
return figure._process_projection_requirements(*args, **kwargs)
6962

7063

71-
def get_projection_names():
72-
"""
73-
Get a list of acceptable projection names.
74-
"""
75-
return projection_registry.get_projection_names()
64+
get_projection_names = projection_registry.get_projection_names
65+
docstring.interpd.update(projection_names=get_projection_names())

0 commit comments

Comments
 (0)