MCPcopy
hub / github.com/django/django / leaf_nodes

Method leaf_nodes

django/db/migrations/graph.py:255–269  ·  view source on GitHub ↗

Return all leaf nodes - that is, nodes with no dependents in their app. These are the "most current" version of an app's schema. Having more than one per app is technically an error, but one that gets handled further up, in the interactive command - it's usually the

(self, app=None)

Source from the content-addressed store, hash-verified

253 return sorted(roots)
254
255 def leaf_nodes(self, app=None):
256 """
257 Return all leaf nodes - that is, nodes with no dependents in their app.
258 These are the "most current" version of an app's schema.
259 Having more than one per app is technically an error, but one that
260 gets handled further up, in the interactive command - it's usually the
261 result of a VCS merge and needs some user input.
262 """
263 leaves = set()
264 for node in self.nodes:
265 if all(key[0] != node[0] for key in self.node_map[node].children) and (
266 not app or app == node[0]
267 ):
268 leaves.add(node)
269 return sorted(leaves)
270
271 def ensure_not_cyclic(self):
272 # Algo from GvR:

Callers 15

make_stateMethod · 0.95
test_simple_graphMethod · 0.95
test_complex_graphMethod · 0.95
check_migrationsMethod · 0.80
show_listMethod · 0.80
show_planMethod · 0.80
handleMethod · 0.80
check_keyMethod · 0.80
detect_conflictsMethod · 0.80
_create_project_stateMethod · 0.80
migrateMethod · 0.80

Calls 1

addMethod · 0.45

Tested by 3

test_simple_graphMethod · 0.76
test_complex_graphMethod · 0.76