pudl_diff.terminal
¶
Text rendering of a PUDL diff for a terminal.
TerminalProgress
¶
Prints the column headings, then a line about each table as it's compared.
Meant to be used as the callbacks of run_dataset_diff().
Keeps each table's TableOutcome, in
outcomes, for the summary at the end.
Unless verbose, only prints the tables that aren't identical, and leaves out
the size columns; outcomes still has every table. The column headings wait for
the first table to print, and finish() says so if none did.
Source code in src/pudl_diff/terminal.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | |
__init__(left_root, right_root, *, explicit, show_progress, intro=None, verbose=True)
¶
Set up to describe a comparison of two datasets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
left_root
|
str
|
Where the left dataset is, for the introduction. |
required |
right_root
|
str
|
Where the right dataset is. |
required |
explicit
|
bool
|
Whether the tables to compare were named, rather than being all those in both datasets. |
required |
show_progress
|
bool
|
Whether to start each line with a |
required |
intro
|
str | None
|
What to say before the column headings instead of the usual description of the comparison, e.g. when showing a saved report. |
None
|
verbose
|
bool
|
Whether to print identical tables and the size columns. |
True
|
Source code in src/pudl_diff/terminal.py
finish()
¶
If no table was listed because all were identical, say so instead.
Source code in src/pudl_diff/terminal.py
table_compared(table_name, report)
¶
Print a line about a table that has just been compared.
Source code in src/pudl_diff/terminal.py
tables_resolved(tables)
¶
Say what's about to be compared, and print the column headings.
Source code in src/pudl_diff/terminal.py
echo_intro(tables, left_root, right_root, *, explicit)
¶
Say which tables are about to be compared, and between what.
Source code in src/pudl_diff/terminal.py
echo_summary(report, outcomes, report_path, *, saved=True)
¶
Print how the run went: table counts, what was compared, time and memory.
Ends by saying the report was written to report_path, or, if saved is
False, that it was read from there.
Source code in src/pudl_diff/terminal.py
format_header(progress_width=0, *, verbose=True)
¶
The two lines of column headings for the lines made by format_outcome().
Unless verbose, leaves out the size columns, as format_outcome() does.
A heading may name its column on the first line and say what it holds on the second, so that it needn't be wider than the values below it. The second line is the one that sits directly above the values.
Source code in src/pudl_diff/terminal.py
format_outcome(outcome, progress='', *, verbose=True)
¶
One line summarizing a table's comparison.
Unless verbose, leaves out the sizes and their change.
The table name goes last, so that the (variable length) names don't disturb the alignment of everything before it.