Skip to content

Commit 99a6b8a

Browse files
committed
STY: Use consistent (class)method parameter names.
1 parent 34d8eb2 commit 99a6b8a

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

examples/units/basic_units.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ def __get__(self, obj, objtype=None):
2525

2626

2727
class TaggedValueMeta(type):
28-
def __init__(cls, name, bases, dict):
29-
for fn_name in cls._proxies:
28+
def __init__(self, name, bases, dict):
29+
for fn_name in self._proxies:
3030
try:
31-
dummy = getattr(cls, fn_name)
31+
dummy = getattr(self, fn_name)
3232
except AttributeError:
33-
setattr(cls, fn_name,
34-
ProxyDelegate(fn_name, cls._proxies[fn_name]))
33+
setattr(self, fn_name,
34+
ProxyDelegate(fn_name, self._proxies[fn_name]))
3535

3636

3737
class PassThroughProxy(object):

lib/matplotlib/patches.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,7 +1858,7 @@ class _Style(object):
18581858
where actual styles are declared as subclass of it, and it
18591859
provides some helper functions.
18601860
"""
1861-
def __new__(self, stylename, **kw):
1861+
def __new__(cls, stylename, **kw):
18621862
"""
18631863
return the instance of the subclass with the given style name.
18641864
"""
@@ -1869,7 +1869,7 @@ def __new__(self, stylename, **kw):
18691869
_list = stylename.replace(" ", "").split(",")
18701870
_name = _list[0].lower()
18711871
try:
1872-
_cls = self._style_list[_name]
1872+
_cls = cls._style_list[_name]
18731873
except KeyError:
18741874
raise ValueError("Unknown style : %s" % stylename)
18751875

@@ -1883,29 +1883,29 @@ def __new__(self, stylename, **kw):
18831883
return _cls(**_args)
18841884

18851885
@classmethod
1886-
def get_styles(klass):
1886+
def get_styles(cls):
18871887
"""
18881888
A class method which returns a dictionary of available styles.
18891889
"""
1890-
return klass._style_list
1890+
return cls._style_list
18911891

18921892
@classmethod
1893-
def pprint_styles(klass):
1893+
def pprint_styles(cls):
18941894
"""
18951895
A class method which returns a string of the available styles.
18961896
"""
1897-
return _pprint_styles(klass._style_list)
1897+
return _pprint_styles(cls._style_list)
18981898

18991899
@classmethod
1900-
def register(klass, name, style):
1900+
def register(cls, name, style):
19011901
"""
19021902
Register a new style.
19031903
"""
19041904

1905-
if not issubclass(style, klass._Base):
1905+
if not issubclass(style, cls._Base):
19061906
raise ValueError("%s must be a subclass of %s" % (style,
1907-
klass._Base))
1908-
klass._style_list[name] = style
1907+
cls._Base))
1908+
cls._style_list[name] = style
19091909

19101910

19111911
def _register_style(style_list, cls=None, *, name=None):

lib/matplotlib/tests/test_animation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def __init__(self, fps=None, codec=None, bitrate=None,
109109
pass
110110

111111
@classmethod
112-
def isAvailable(self):
112+
def isAvailable(cls):
113113
return True
114114

115115

lib/mpl_toolkits/axes_grid1/axes_size.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,17 +290,17 @@ def get_size(self, renderer):
290290

291291

292292
class GetExtentHelper(object):
293-
def _get_left(tight_bbox, axes_bbox):
294-
return axes_bbox.xmin - tight_bbox.xmin
293+
def _get_left(self, axes_bbox):
294+
return axes_bbox.xmin - self.xmin
295295

296-
def _get_right(tight_bbox, axes_bbox):
297-
return tight_bbox.xmax - axes_bbox.xmax
296+
def _get_right(self, axes_bbox):
297+
return self.xmax - axes_bbox.xmax
298298

299-
def _get_bottom(tight_bbox, axes_bbox):
300-
return axes_bbox.ymin - tight_bbox.ymin
299+
def _get_bottom(self, axes_bbox):
300+
return axes_bbox.ymin - self.ymin
301301

302-
def _get_top(tight_bbox, axes_bbox):
303-
return tight_bbox.ymax - axes_bbox.ymax
302+
def _get_top(self, axes_bbox):
303+
return self.ymax - axes_bbox.ymax
304304

305305
_get_func_map = dict(left=_get_left,
306306
right=_get_right,

0 commit comments

Comments
 (0)