MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / assert_not_in_reference_cycle

Function assert_not_in_reference_cycle

lib/matplotlib/tests/test_axes.py:10032–10043  ·  view source on GitHub ↗
(start)

Source from the content-addressed store, hash-verified

10030)
10031def test_axes_clear_reference_cycle():
10032 def assert_not_in_reference_cycle(start):
10033 # Breadth first search. Return True if we encounter the starting node
10034 to_visit = deque([start])
10035 explored = set()
10036 while len(to_visit) > 0:
10037 parent = to_visit.popleft()
10038 for child in gc.get_referents(parent):
10039 if id(child) in explored:
10040 continue
10041 assert child is not start
10042 explored.add(id(child))
10043 to_visit.append(child)
10044
10045 fig = Figure()
10046 ax = fig.add_subplot()

Callers 1

Calls 1

addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…