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

Skip to content

Commit 748e022

Browse files
authored
Merge pull request #16540 from timhoffm/clean-import
Cleanup imports
2 parents 781991d + bc1913b commit 748e022

File tree

5 files changed

+11
-16
lines changed

5 files changed

+11
-16
lines changed

lib/matplotlib/cbook/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import types
2525
import warnings
2626
import weakref
27-
from weakref import WeakMethod
2827

2928
import numpy as np
3029

@@ -180,7 +179,7 @@ def connect(self, s, func):
180179
"""
181180
self._func_cid_map.setdefault(s, {})
182181
try:
183-
proxy = WeakMethod(func, self._remove_proxy)
182+
proxy = weakref.WeakMethod(func, self._remove_proxy)
184183
except TypeError:
185184
proxy = _StrongRef(func)
186185
if proxy in self._func_cid_map[s]:

lib/matplotlib/offsetbox.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
from matplotlib.image import BboxImage
3434
from matplotlib.patches import (
3535
FancyBboxPatch, FancyArrowPatch, bbox_artist as mbbox_artist)
36-
from matplotlib.text import _AnnotationBase
3736
from matplotlib.transforms import Bbox, BboxBase, TransformedBbox
3837

3938

@@ -1410,7 +1409,7 @@ def draw(self, renderer):
14101409
self.stale = False
14111410

14121411

1413-
class AnnotationBbox(martist.Artist, _AnnotationBase):
1412+
class AnnotationBbox(martist.Artist, mtext._AnnotationBase):
14141413
"""
14151414
Container for an `OffsetBox` referring to a specific position *xy*.
14161415
@@ -1475,10 +1474,10 @@ def __init__(self, offsetbox, xy,
14751474
"""
14761475

14771476
martist.Artist.__init__(self, **kwargs)
1478-
_AnnotationBase.__init__(self,
1479-
xy,
1480-
xycoords=xycoords,
1481-
annotation_clip=annotation_clip)
1477+
mtext._AnnotationBase.__init__(self,
1478+
xy,
1479+
xycoords=xycoords,
1480+
annotation_clip=annotation_clip)
14821481

14831482
self.offsetbox = offsetbox
14841483

lib/mpl_toolkits/axisartist/axis_artist.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@
9494
import matplotlib.artist as martist
9595
import matplotlib.text as mtext
9696

97-
from matplotlib.artist import Artist
9897
from matplotlib.collections import LineCollection
9998
from matplotlib.lines import Line2D
10099
from matplotlib.patches import PathPatch
@@ -158,7 +157,7 @@ def draw(self, renderer):
158157

159158
class AttributeCopier:
160159
@cbook.deprecated("3.2")
161-
def __init__(self, ref_artist, klass=Artist):
160+
def __init__(self, ref_artist, klass=martist.Artist):
162161
self._klass = klass
163162
self._ref_artist = ref_artist
164163
super().__init__()

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import matplotlib.docstring as docstring
2525
import matplotlib.scale as mscale
2626
from matplotlib.axes import Axes, rcParams
27-
from matplotlib.colors import Normalize, LightSource
2827
from matplotlib.transforms import Bbox
2928
from matplotlib.tri.triangulation import Triangulation
3029

@@ -1650,7 +1649,7 @@ def _shade_colors(self, color, normals, lightsource=None):
16501649
"""
16511650
if lightsource is None:
16521651
# chosen for backwards-compatibility
1653-
lightsource = LightSource(azdeg=225, altdeg=19.4712)
1652+
lightsource = mcolors.LightSource(azdeg=225, altdeg=19.4712)
16541653

16551654
with np.errstate(invalid="ignore"):
16561655
shade = ((normals / np.linalg.norm(normals, axis=1, keepdims=True))
@@ -1659,8 +1658,8 @@ def _shade_colors(self, color, normals, lightsource=None):
16591658

16601659
if mask.any():
16611660
# convert dot product to allowed shading fractions
1662-
in_norm = Normalize(-1, 1)
1663-
out_norm = Normalize(0.3, 1).inverse
1661+
in_norm = mcolors.Normalize(-1, 1)
1662+
out_norm = mcolors.Normalize(0.3, 1).inverse
16641663

16651664
def norm(x):
16661665
return out_norm(in_norm(x))

setupext.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import tarfile
1717
import textwrap
1818
import urllib.request
19-
from urllib.request import Request
2019
import versioneer
2120

2221
_log = logging.getLogger(__name__)
@@ -99,7 +98,7 @@ def write_cache(local_fn, data):
9998
# default User-Agent, but not (for example) wget; so I don't feel too
10099
# bad passing in an empty User-Agent.
101100
with urllib.request.urlopen(
102-
Request(url, headers={"User-Agent": ""})) as req:
101+
urllib.request.Request(url, headers={"User-Agent": ""})) as req:
103102
file_contents = BytesIO(req.read())
104103
file_contents.seek(0)
105104

0 commit comments

Comments
 (0)