MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __repr__

Method __repr__

data_structures/binary_tree/treap.py:18–26  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

16 self.right: Node | None = None
17
18 def __repr__(self) -> str:
19 from pprint import pformat
20
21 if self.left is None and self.right is None:
22 return f"'{self.value}: {self.prior:.5}'"
23 else:
24 return pformat(
25 {f"{self.value}: {self.prior:.5}": (self.left, self.right)}, indent=1
26 )
27
28 def __str__(self) -> str:
29 value = str(self.value) + " "

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected