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

Method create_lines

pgcli/pyev.py:238–395  ·  view source on GitHub ↗
(self, plan, prefix, depth, width, last_child)

Source from the content-addressed store, hash-verified

236 return "%s%s" % (self.prefix_format(current_prefix), string)
237
238 def create_lines(self, plan, prefix, depth, width, last_child):
239 current_prefix = prefix
240 self.string_lines.append(self.output_fn(current_prefix, self.prefix_format("│")))
241
242 joint = "├"
243 if last_child:
244 joint = "└"
245 #
246 self.string_lines.append(
247 self.output_fn(
248 current_prefix,
249 "%s %s%s %s"
250 % (
251 self.prefix_format(joint + "─⌠"),
252 self.bold_format(plan["Node Type"]),
253 self.format_details(plan),
254 self.format_tags(plan),
255 ),
256 )
257 )
258 #
259 if last_child:
260 prefix += " "
261 else:
262 prefix += "│ "
263
264 current_prefix = prefix + "│ "
265
266 cols = width - len(current_prefix)
267
268 for line in self.wrap_string(
269 DESCRIPTIONS.get(plan["Node Type"], "Not found : %s" % plan["Node Type"]),
270 cols,
271 ):
272 self.string_lines.append(self.output_fn(current_prefix, "%s" % self.muted_format(line)))
273 #
274 if plan.get("Actual Duration"):
275 self.string_lines.append(
276 self.output_fn(
277 current_prefix,
278 "○ %s %s (%.0f%%)"
279 % (
280 "Duration:",
281 self.duration_to_string(plan["Actual Duration"]),
282 (plan["Actual Duration"] / self.explain["Execution Time"]) * 100,
283 ),
284 )
285 )
286
287 self.string_lines.append(
288 self.output_fn(
289 current_prefix,
290 "○ %s %s (%.0f%%)"
291 % (
292 "Cost:",
293 self.intcomma(plan["Actual Cost"]),
294 (plan["Actual Cost"] / self.explain["Total Cost"]) * 100,
295 ),

Callers 1

generate_linesMethod · 0.95

Calls 11

output_fnMethod · 0.95
prefix_formatMethod · 0.95
bold_formatMethod · 0.95
format_detailsMethod · 0.95
format_tagsMethod · 0.95
wrap_stringMethod · 0.95
muted_formatMethod · 0.95
duration_to_stringMethod · 0.95
intcommaMethod · 0.95
get_terminatorMethod · 0.95
output_formatMethod · 0.95

Tested by

no test coverage detected