8000 Merge pull request #14391 from timhoffm/remove-object-inheritance · matplotlib/matplotlib@52aa26b · GitHub
[go: up one dir, main page]

Skip to content

Commit 52aa26b

Browse files
authored
Merge pull request #14391 from timhoffm/remove-object-inheritance
Remove explicit inheritance from object
2 parents f67d556 + 50d8690 commit 52aa26b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+64
-64
lines changed

doc/sphinxext/gallery_order.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __call__(self, item):
6464
explicit_subsection_order = [item + ".py" for item in list_all]
6565

6666

67-
class MplExplicitSubOrder(object):
67+
class MplExplicitSubOrder:
6868
"""For use within the 'within_subsection_order' key."""
6969
def __init__(self, src_dir):
7070
self.src_dir = src_dir # src_dir is unused here

examples/animation/bayes_update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def beta_pdf(x, a, b):
2121
/ (math.gamma(a) * math.gamma(b)))
2222

2323

24-
class UpdateDist(object):
24+
class UpdateDist:
2525
def __init__(self, ax, prob=0.5):
2626
self.success = 0
2727
self.prob = prob

examples/animation/strip_chart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import matplotlib.animation as animation
1313

1414

15-
class Scope(object):
15+
class Scope:
1616
def __init__(self, ax, maxt=2, dt=0.02):
1717
self.ax = ax
1818
self.dt = dt

examples/event_handling/data_browser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import numpy as np
1313

1414

15-
class PointBrowser(object):
15+
class PointBrowser:
1616
"""
1717
Click on a point to select and highlight it -- the data that
1818
generated the point will be shown in the lower axes. Use the 'n'

examples/event_handling/image_slices_viewer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import matplotlib.pyplot as plt
1111

1212

13-
class IndexTracker(object):
13+
class IndexTracker:
1414
def __init__(self, ax, X):
1515
self.ax = ax
1616
ax.set_title('use scroll wheel to navigate images')

examples/event_handling/lasso_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import numpy as np
1919

2020

21-
class Datum(object):
21+
class Datum:
2222
colorin = mcolors.to_rgba("red")
2323
colorout = mcolors.to_rgba("blue")
2424

@@ -31,7 +31,7 @@ def __init__(self, x, y, include=False):
3131
self.color = self.colorout
3232

3333

34-
class LassoManager(object):
34+
class LassoManager:
3535
def __init__(self, ax, data):
3636
self.axes = ax
3737
self.canvas = ax.figure.canvas

examples/event_handling/looking_glass.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
ax.set_title("Left click and drag to move looking glass")
2525

2626

27-
class EventHandler(object):
27+
class EventHandler:
2828
def __init__(self):
2929
fig.canvas.mpl_connect('button_press_event', self.onpress)
3030
fig.canvas.mpl_connect('button_release_event', self.onrelease)

examples/event_handling/path_editor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
ax.add_patch(patch)
3636

3737

38-
class PathInteractor(object):
38+
class PathInteractor:
3939
"""
4040
An path editor.
4141

examples/event_handling/pipong.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"""
3535

3636

37-
class Pad(object):
37+
class Pad:
3838
def __init__(self, disp, x, y, type='l'):
3939
self.disp = disp
4040
self.x = x
@@ -57,7 +57,7 @@ def contains(self, loc):
5757
return self.disp.get_bbox().contains(loc.x, loc.y)
5858

5959

60-
class Puck(object):
60+
class Puck:
6161
def __init__(self, disp, pad, field):
6262
self.vmax = .2
6363
self.disp = disp
@@ -120,7 +120,7 @@ def _speedlimit(self):
120120
self.vy = -self.vmax
121121

122122

123-
class Game(object):
123+
class Game:
124124
def __init__(self, ax):
125125
# create the initial line
126126
self.ax = ax

examples/event_handling/poly_editor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def dist_point_to_segment(p, s0, s1):
3939
return dist(p, pb)
4040

4141

42-
class PolygonInteractor(object):
42+
class PolygonInteractor:
4343
"""
4444
A polygon editor.
4545

examples/event_handling/resample.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
# A class that will downsample the data and recompute when zoomed.
16-
class DataDisplayDownsampler(object):
16+
class DataDisplayDownsampler:
1717
def __init__(self, xdata, ydata):
1818
self.origYData = ydata
1919
self.origXData = xdata

examples/event_handling/viewlims.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def __call__(self, ax):
2323
# A class that will regenerate a fractal set as we zoom in, so that you
2424
# can actually see the increasing detail. A box in the left panel will show
2525
# the area to which we are zoomed.
26-
class MandelbrotDisplay(object):
26+
class MandelbrotDisplay:
2727
def __init__(self, h=500, w=500, niter=50, radius=2., power=2):
2828
self.height = h
2929
self.width = w

examples/misc/cursor_demo_sgskip.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import numpy as np
2222

2323

24-
class Cursor(object):
24+
class Cursor:
2525
def __init__(self, ax):
2626
self.ax = ax
2727
self.lx = ax.axhline(color='k') # the horiz line
@@ -43,7 +43,7 @@ def mouse_move(self, event):
4343
self.ax.figure.canvas.draw()
4444

4545

46-
class SnaptoCursor(object):
46+
class SnaptoCursor:
4747
"""
4848
Like Cursor but the crosshair snaps to the nearest x, y point.
4949
For simplicity, this assumes that *x* is sorted.

examples/misc/demo_agg_filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def smooth2d(A, sigma=3):
3333
return A4
3434

3535

36-
class BaseFilter(object):
36+
class BaseFilter:
3737
def prepare_image(self, src_image, dpi, pad):
3838
ny, nx, depth = src_image.shape
3939
# tgt_image = np.zeros([pad*2+ny, pad*2+nx, depth], dtype="d")

examples/misc/multiprocess_sgskip.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#
2828

2929

30-
class ProcessPlotter(object):
30+
class ProcessPlotter:
3131
def __init__(self):
3232
self.x = []
3333
self.y = []
@@ -75,7 +75,7 @@ def __call__(self, pipe):
7575
#
7676

7777

78-
class NBPlot(object):
78+
class NBPlot:
7979
def __init__(self):
8080
self.plot_pipe, plotter_pipe = mp.Pipe()
8181
self.plotter = ProcessPlotter()

examples/units/basic_units.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import matplotlib.ticker as ticker
1414

1515

16-
class ProxyDelegate(object):
16+
class ProxyDelegate:
1717
def __init__(self, fn_name, proxy_type):
1818
self.proxy_type = proxy_type
1919
self.fn_name = fn_name
@@ -30,7 +30,7 @@ def __init__(self, name, bases, dict):
3030
ProxyDelegate(fn_name, self._proxies[fn_name]))
3131

3232

33-
class PassThroughProxy(object):
33+
class PassThroughProxy:
3434
def __init__(self, fn_name, obj):
3535
self.fn_name = fn_name
3636
self.target = obj.proxy_target
@@ -184,7 +184,7 @@ def get_unit(self):
184184
return self.unit
185185

186186

187-
class BasicUnit(object):
187+
class BasicUnit:
188188
def __init__(self, name, fullname=None):
189189
self.name = name
190190
if fullname is None:
@@ -245,7 +245,7 @@ def get_unit(self):
245245
return self
246246

247247

248-
class UnitResolver(object):
248+
class UnitResolver:
249249
def addition_rule(self, units):
250250
for unit_1, unit_2 in zip(units[:-1], units[1:]):
251251
if unit_1 != unit_2:

examples/units/evans_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import matplotlib.pyplot as plt
1717

1818

19-
class Foo(object):
19+
class Foo:
2020
def __init__(self, val, unit=1.0):
2121
self.unit = unit
2222
self._val = val * unit

examples/user_interfaces/fourier_demo_wx_sgskip.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from matplotlib.figure import Figure
1313

1414

15-
class Knob(object):
15+
class Knob:
1616
"""
1717
Knob - simple class with a "setKnob" method.
1818
A Knob instance is attached to a Param instance, e.g., param.attach(knob)
@@ -23,7 +23,7 @@ def setKnob(self, value):
2323
pass
2424

2525

26-
class Param(object):
26+
class Param:
2727
"""
2828
The idea of the "Param" class is that some parameter in the GUI may have
2929
several knobs that both control it and reflect the parameter's state, e.g.

examples/user_interfaces/mpl_with_glade3_sgskip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import numpy as np
1818

1919

20-
class Window1Signals(object):
20+
class Window1Signals:
2121
def on_window1_destroy(self, widget):
2222
Gtk.main_quit()
2323

examples/widgets/buttons.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
l, = plt.plot(t, s, lw=2)
2323

2424

25-
class Index(object):
25+
class Index:
2626
ind = 0
2727

2828
def next(self, event):

examples/widgets/lasso_selector_demo_sgskip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from matplotlib.path import Path
1818

1919

20-
class SelectFromCollection(object):
20+
class SelectFromCollection:
2121
"""Select indices from a matplotlib collection using `LassoSelector`.
2222
2323
Selected indices are saved in the `ind` attribute. This tool fades out the

examples/widgets/menu.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import matplotlib.image as image
1414

1515

16-
class ItemProperties(object):
16+
class ItemProperties:
1717
def __init__(self, fontsize=14, labelcolor='black', bgcolor='yellow',
1818
alpha=1.0):
1919
self.fontsize = fontsize
@@ -121,7 +121,7 @@ def set_hover(self, event):
121121
return changed
122122

123123

124-
class Menu(object):
124+
class Menu:
125125
def __init__(self, fig, menuitems):
126126
self.figure = fig
127127
fig.suppressComposite = True

examples/widgets/polygon_selector_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from matplotlib.path import Path
1313

1414

15-
class SelectFromCollection(object):
15+
class SelectFromCollection:
1616
"""Select indices from a matplotlib collection using `PolygonSelector`.
1717
1818
Selected indices are saved in the `ind` attribute. This tool fades out the

lib/mpl_toolkits/axes_grid1/axes_divider.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from . import axes_size as Size
1818

1919

20-
class Divider(object):
20+
class Divider:
2121
"""
2222
This class calculates the axes position. It
2323
divides the given rectangular area into several
@@ -293,7 +293,7 @@ def add_auto_adjustable_area(self,
293293
self.append_size(d, padded_size)
294294

295295

296-
class AxesLocator(object):
296+
class AxesLocator:
297297
"""
298298
A simple callable object, initialized with AxesDivider class,
299299
returns the position and size of the given cell.

lib/mpl_toolkits/axes_grid1/axes_grid.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _tick_only(ax, bottom_on, left_on):
2828
ax.axis["left"].toggle(ticklabels=left_off, label=left_off)
2929

3030

31-
class CbarAxesBase(object):
31+
class CbarAxesBase:
3232

3333
def colorbar(self, mappable, *, locator=None, **kwargs):
3434

@@ -111,7 +111,7 @@ def cla(self):
111111
self._config_axes()
112112

113113

114-
class Grid(object):
114+
class Grid:
115115
"""
116116
A class that creates a grid of Axes. In matplotlib, the axes
117117
location (and size) is specified in the normalized figure

lib/mpl_toolkits/axes_grid1/axes_rgb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def imshow_rgb(ax, r, g, b, **kwargs):
7171
return im_rgb
7272

7373

74-
class RGBAxesBase(object):
74+
class RGBAxesBase:
7575
"""base class for a 4-panel imshow (RGB, R, G, B)
7676
7777
Layout:

lib/mpl_toolkits/axes_grid1/axes_size.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class (or others) to determine the size of each axes. The unit
1515
from matplotlib.axes import Axes
1616

1717

18-
class _Base(object):
18+
class _Base:
1919
"Base class"
2020

2121
def __rmul__(self, other):
@@ -293,7 +293,7 @@ def get_size(self, renderer):
293293
return rel_size, abs_size
294294

295295

296-
class GetExtentHelper(object):
296+
class GetExtentHelper:
297297
_get_func_map = {
298298
"left": lambda self, axes_bbox: axes_bbox.xmin - self.xmin,
299299
"right": lambda self, axes_bbox: self.xmax - axes_bbox.xmax,

lib/mpl_toolkits/axes_grid1/colorbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
#docstring.interpd.update(colorbar_doc=colorbar_doc)
172172

173173

174-
class CbarAxesLocator(object):
174+
class CbarAxesLocator:
175175
"""
176176
CbarAxesLocator is a axes_locator for colorbar axes. It adjust the
177177
position of the axes to make a room for extended ends, i.e., the

lib/mpl_toolkits/axes_grid1/inset_locator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from .parasite_axes import HostAxes
1414

1515

16-
class InsetPosition(object):
16+
class InsetPosition:
1717
@docstring.dedent_interpd
1818
def __init__(self, parent, lbwh):
1919
"""

lib/mpl_toolkits/axes_grid1/mpl_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from matplotlib.axis import XAxis, YAxis
44

55

6-
class SimpleChainedObjects(object):
6+
class SimpleChainedObjects:
77
def __init__(self, objects):
88
self._objects = objects
99

0 commit comments

Comments
 (0)
0