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

Skip to content

Commit 7722070

Browse files
committed
Remove nonworking ArtistInspector.findobj.
1 parent 69702f3 commit 7722070

2 files changed

Lines changed: 4 additions & 48 deletions

File tree

doc/api/api_changes/code_removal.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ The ``GraphicsContextBase.set_graylevel``, ``FigureCanvasBase.onHilite`` and
1919
``mpl_toolkits.axes_grid1.mpl_axes.Axes.toggle_axisline`` methods have been
2020
removed.
2121

22+
The ``ArtistInspector.findobj`` method, which was never working due to the lack
23+
of a ``get_children`` method, has been removed.
24+
2225

2326
`Axes.set_aspect("normal")`
2427
---------------------------

lib/matplotlib/artist.py

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,15 +1081,7 @@ def matchfunc(x):
10811081
raise ValueError('match must be None, a matplotlib.artist.Artist '
10821082
'subclass, or a callable')
10831083

1084-
artists = []
1085-
1086-
for c in self.get_children():
1087-
if matchfunc(c):
1088-
artists.append(c)
1089-
artists.extend([thisc for thisc in
1090-
c.findobj(matchfunc, include_self=False)
1091-
if matchfunc(thisc)])
1092-
1084+
artists = sum([c.findobj(matchfunc) for c in self.get_children()], [])
10931085
if include_self and matchfunc(self):
10941086
artists.append(self)
10951087
return artists
@@ -1409,45 +1401,6 @@ def pprint_getters(self):
14091401
lines.append(' %s = %s' % (name, s))
14101402
return lines
14111403

1412-
def findobj(self, match=None):
1413-
"""
1414-
Recursively find all :class:`matplotlib.artist.Artist`
1415-
instances contained in *self*.
1416-
1417-
If *match* is not None, it can be
1418-
1419-
- function with signature ``boolean = match(artist)``
1420-
1421-
- class instance: e.g., :class:`~matplotlib.lines.Line2D`
1422-
1423-
used to filter matches.
1424-
"""
1425-
if match is None: # always return True
1426-
def matchfunc(x):
1427-
return True
1428-
elif issubclass(match, Artist):
1429-
def matchfunc(x):
1430-
return isinstance(x, match)
1431-
elif callable(match):
1432-
matchfunc = func
1433-
else:
1434-
raise ValueError('match must be None, a matplotlib.artist.Artist '
1435-
'subclass, or a callable')
1436-
1437-
artists = []
1438-
1439-
for c in self.get_children():
1440-
if matchfunc(c):
1441-
artists.append(c)
1442-
artists.extend([thisc
1443-
for thisc
1444-
in c.findobj(matchfunc)
1445-
if matchfunc(thisc)])
1446-
1447-
if matchfunc(self):
1448-
artists.append(self)
1449-
return artists
1450-
14511404

14521405
def getp(obj, property=None):
14531406
"""

0 commit comments

Comments
 (0)