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

Skip to content

Commit b4880c9

Browse files
committed
Add more instances of lazy loading
1 parent 1761a03 commit b4880c9

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

lib/matplotlib/testing/compare.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import matplotlib
1919
from matplotlib.testing.exceptions import ImageComparisonFailure
20-
from matplotlib import _png, cbook
20+
from matplotlib import cbook
2121

2222
__all__ = ['compare_float', 'compare_images', 'comparable_formats']
2323

@@ -386,6 +386,8 @@ def compare_images(expected, actual, tol, in_decorator=False):
386386
compare_images(img1, img2, 0.001):
387387
388388
"""
389+
from matplotlib import _png
390+
389391
if not os.path.exists(actual):
390392
raise Exception("Output image %s does not exist." % actual)
391393

lib/matplotlib/texmanager.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
import numpy as np
4141

4242
import matplotlib as mpl
43-
from matplotlib import _png, cbook, dviread, rcParams
43+
from matplotlib import cbook, dviread, rcParams
4444

4545
_log = logging.getLogger(__name__)
4646

@@ -414,6 +414,7 @@ def get_ps_bbox(self, tex, fontsize):
414414

415415
def get_grey(self, tex, fontsize=None, dpi=None):
416416
"""Return the alpha channel."""
417+
from matplotlib import _png
417418
key = tex, self.get_font_config(), fontsize, dpi
418419
alpha = self.grey_arrayd.get(key)
419420
if alpha is None:

lib/matplotlib/tri/tricontour.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from matplotlib.contour import ContourSet
44
from matplotlib.tri.triangulation import Triangulation
5-
import matplotlib._tri as _tri
65

76

87
class TriContourSet(ContourSet):
@@ -44,6 +43,7 @@ def _process_args(self, *args, **kwargs):
4443
if self.levels is None:
4544
self.levels = args[0].levels
4645
else:
46+
from matplotlib import _tri
4747
tri, z = self._contour_args(args, kwargs)
4848
C = _tri.TriContourGenerator(tri.get_cpp_triangulation(), z)
4949
self._mins = [tri.x.min(), tri.y.min()]

lib/matplotlib/tri/trifinder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import numpy as np
22

33
from matplotlib.tri import Triangulation
4-
import matplotlib._tri as _tri
54

65

76
class TriFinder(object):
@@ -35,6 +34,7 @@ class TrapezoidMapTriFinder(TriFinder):
3534
this should not be relied upon.
3635
"""
3736
def __init__(self, triangulation):
37+
from matplotlib import _tri
3838
TriFinder.__init__(self, triangulation)
3939
self._cpp_trifinder = _tri.TrapezoidMapTriFinder(
4040
triangulation.get_cpp_triangulation())

0 commit comments

Comments
 (0)