krrood.class_diagrams.progress_report#

What a class diagram reports about its own building.

Building a diagram of a large package resolves the type of every field of every class and takes long enough to be worth watching. A process that starts another one to do it sees only its output, so the progress is written there, one line per class, for that process to read back.

Attributes#

LINE_PREFIX

What marks a line of output as a progress report rather than something a log wrote.

Classes#

ProgressEnvironmentVariable

Environment variables asking a class diagram to report its progress.

ProgressField

Names a report carries its parts under.

ClassDiagramProgress

One class of a diagram, finished.

Functions#

is_progress_wanted(→ bool)

Whether whoever started this process reads progress reports.

report_progress(→ None)

Write one finished class to the output the starting process reads.

Module Contents#

krrood.class_diagrams.progress_report.LINE_PREFIX = 'krrood-class-diagram-progress '#

What marks a line of output as a progress report rather than something a log wrote.

class krrood.class_diagrams.progress_report.ProgressEnvironmentVariable#

Bases: enum.StrEnum

Environment variables asking a class diagram to report its progress.

REPORT_PROGRESS = 'KRROOD_REPORT_CLASS_DIAGRAM_PROGRESS'#

Set by a process that reads the reports back; unset, nothing is written.

class krrood.class_diagrams.progress_report.ProgressField#

Bases: enum.StrEnum

Names a report carries its parts under.

CLASS_NAME = 'class_name'#

The class the report is about.

TOTAL_CLASSES = 'total_classes'#

How many classes the diagram being built holds.

class krrood.class_diagrams.progress_report.ClassDiagramProgress#

One class of a diagram, finished.

class_name: str#

Name of the class whose relations were just created.

total_classes: int#

How many classes the diagram holds, so a reader knows what to count towards.

classmethod from_line(line: str) ClassDiagramProgress | None#

Read a report back from a line of a process’s output.

Parameters:

line – One line of output, of any kind.

Returns:

The report the line carries, or nothing when it carries none.

to_line() str#

Render this report as one line of output.

Returns:

The line, without its terminating line break.

krrood.class_diagrams.progress_report.is_progress_wanted() bool#

Whether whoever started this process reads progress reports.

Returns:

Whether to report.

krrood.class_diagrams.progress_report.report_progress(class_name: str, total_classes: int) None#

Write one finished class to the output the starting process reads.

Parameters:
  • class_name – Name of the class that is done.

  • total_classes – How many classes the diagram holds.