Skip to content

Commit

Permalink
Cleanup imports
Browse files Browse the repository at this point in the history
  • Loading branch information
timhoffm committed Feb 16, 2020
1 parent 7d10cb6 commit bc1913b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 16 deletions.
3 changes: 1 addition & 2 deletions lib/matplotlib/cbook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import types
import warnings
import weakref
from weakref import WeakMethod

import numpy as np

Expand Down Expand Up @@ -180,7 +179,7 @@ def connect(self, s, func):
"""
self._func_cid_map.setdefault(s, {})
try:
proxy = WeakMethod(func, self._remove_proxy)
proxy = weakref.WeakMethod(func, self._remove_proxy)
except TypeError:
proxy = _StrongRef(func)
if proxy in self._func_cid_map[s]:
Expand Down
11 changes: 5 additions & 6 deletions lib/matplotlib/offsetbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
from matplotlib.image import BboxImage
from matplotlib.patches import (
FancyBboxPatch, FancyArrowPatch, bbox_artist as mbbox_artist)
from matplotlib.text import _AnnotationBase
from matplotlib.transforms import Bbox, BboxBase, TransformedBbox


Expand Down Expand Up @@ -1410,7 +1409,7 @@ def draw(self, renderer):
self.stale = False


class AnnotationBbox(martist.Artist, _AnnotationBase):
class AnnotationBbox(martist.Artist, mtext._AnnotationBase):
"""
Container for an `OffsetBox` referring to a specific position *xy*.
Expand Down Expand Up @@ -1475,10 +1474,10 @@ def __init__(self, offsetbox, xy,
"""

martist.Artist.__init__(self, **kwargs)
_AnnotationBase.__init__(self,
xy,
xycoords=xycoords,
annotation_clip=annotation_clip)
mtext._AnnotationBase.__init__(self,
xy,
xycoords=xycoords,
annotation_clip=annotation_clip)

self.offsetbox = offsetbox

Expand Down
3 changes: 1 addition & 2 deletions lib/mpl_toolkits/axisartist/axis_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
import matplotlib.artist as martist
import matplotlib.text as mtext

from matplotlib.artist import Artist
from matplotlib.collections import LineCollection
from matplotlib.lines import Line2D
from matplotlib.patches import PathPatch
Expand Down Expand Up @@ -158,7 +157,7 @@ def draw(self, renderer):

class AttributeCopier:
@cbook.deprecated("3.2")
def __init__(self, ref_artist, klass=Artist):
def __init__(self, ref_artist, klass=martist.Artist):
self._klass = klass
self._ref_artist = ref_artist
super().__init__()
Expand Down
7 changes: 3 additions & 4 deletions lib/mpl_toolkits/mplot3d/axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import matplotlib.docstring as docstring
import matplotlib.scale as mscale
from matplotlib.axes import Axes, rcParams
from matplotlib.colors import Normalize, LightSource
from matplotlib.transforms import Bbox
from matplotlib.tri.triangulation import Triangulation

Expand Down Expand Up @@ -1650,7 +1649,7 @@ def _shade_colors(self, color, normals, lightsource=None):
"""
if lightsource is None:
# chosen for backwards-compatibility
lightsource = LightSource(azdeg=225, altdeg=19.4712)
lightsource = mcolors.LightSource(azdeg=225, altdeg=19.4712)

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

if mask.any():
# convert dot product to allowed shading fractions
in_norm = Normalize(-1, 1)
out_norm = Normalize(0.3, 1).inverse
in_norm = mcolors.Normalize(-1, 1)
out_norm = mcolors.Normalize(0.3, 1).inverse

def norm(x):
return out_norm(in_norm(x))
Expand Down
3 changes: 1 addition & 2 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import tarfile
import textwrap
import urllib.request
from urllib.request import Request
import versioneer

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

Expand Down

0 comments on commit bc1913b

Please sign in to comment.