MCPcopy Index your code
hub / github.com/tortoise/tortoise-orm / Node

Class Node

tortoise/migrations/graph.py:21–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19
20@total_ordering
21class Node:
22 def __init__(self, key: MigrationKey):
23 self.key = key
24 self.children: set[Node] = set()
25 self.parents: set[Node] = set()
26
27 def __eq__(self, other: object) -> bool:
28 if isinstance(other, Node):
29 return self.key == other.key
30 return self.key == other
31
32 def __lt__(self, other: object) -> bool:
33 if isinstance(other, Node):
34 return self.key < other.key
35 return self.key < other # type: ignore[operator]
36
37 def __hash__(self) -> int:
38 return hash(self.key)
39
40 def __getitem__(self, item: int) -> str:
41 return (self.key.app_label, self.key.name)[item]
42
43 def __str__(self) -> str:
44 return str(self.key)
45
46 def __repr__(self) -> str:
47 return f"<{self.__class__.__name__}: ({self.key.app_label!r}, {self.key.name!r})>"
48
49 def add_child(self, child: Node) -> None:
50 self.children.add(child)
51
52 def add_parent(self, parent: Node) -> None:
53 self.parents.add(parent)
54
55
56class DummyNode(Node):

Callers 1

add_nodeMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…