MCPcopy
hub / github.com/dbcli/pgcli / Visualizer

Class Visualizer

pgcli/pyev.py:27–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25
26
27class Visualizer:
28 def __init__(self, terminal_width=100, color=True):
29 self.color = color
30 self.terminal_width = terminal_width
31 self.string_lines = []
32
33 def load(self, explain_dict):
34 self.plan = explain_dict.pop("Plan")
35 self.explain = explain_dict
36 self.process_all()
37 self.generate_lines()
38
39 def process_all(self):
40 self.plan = self.process_plan(self.plan)
41 self.plan = self.calculate_outlier_nodes(self.plan)
42
43 #
44 def process_plan(self, plan):
45 plan = self.calculate_planner_estimate(plan)
46 plan = self.calculate_actuals(plan)
47 self.calculate_maximums(plan)
48 #
49 for index in range(len(plan.get("Plans", []))):
50 _plan = plan["Plans"][index]
51 plan["Plans"][index] = self.process_plan(_plan)
52 return plan
53
54 def prefix_format(self, v):
55 if self.color:
56 return color(v, fg="bright_black")
57 return v
58
59 def tag_format(self, v):
60 if self.color:
61 return color(v, fg="white", bg="red")
62 return v
63
64 def muted_format(self, v):
65 if self.color:
66 return color(v, fg="bright_black")
67 return v
68
69 def bold_format(self, v):
70 if self.color:
71 return color(v, fg="white")
72 return v
73
74 def good_format(self, v):
75 if self.color:
76 return color(v, fg="green")
77 return v
78
79 def warning_format(self, v):
80 if self.color:
81 return color(v, fg="yellow")
82 return v
83
84 def critical_format(self, v):

Callers 1

format_outputMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected