Skip to content

hertzforge.report.skeleton

skeleton

Skeleton sections: every section a test report needs, in order (report feature skeleton_sections).

A test report is read by people who look for each part of it in the same place every time, so a section that is missing tells them nothing: they cannot tell "nothing happened" from "nobody wrote it down". With the feature on, the report is laid out on the twelve sections of SECTIONS and closed with the end mark, whatever the project holds.

What Hertzforge generates falls under the sections it answers (place): the pass/fail box and the opening description under the Summary, the geometry, the photographs and the channel table under Instrumentation, the closing reading guide under the Conclusion, and every other figure and its text under Results.

What only the author can write (the article, the setup and method, the chronology, the deviations, the discussion, the conclusion's wording) is never generated. Each such section holds the author's own words, a text block marked with the section's key ({'kind': 'text', 'text': ..., 'section': key}), and until that block says something the page shows the section as owed: NOT YET WRITTEN, with what belongs there. A section with nothing to report says so in one step (write(..., none=True)): "No deviations. No anomalies. No nonconformances." The discussion carries who interpreted (by), and the conclusion carries the sentence that the results relate only to the item tested.

check lists what is still owed, for the export to ask about and for a script (Project.report_check). write is the one place a section's words change; the editor's pane and Project.report_section both call it.

The arrangement is made on the page being rendered (arrange, finish), not on the report: the report's own blocks keep their order, a section block is drawn only while the feature is on, and turning the feature off gives back the page it was.

Classes:

Name Description
Section

One section of the skeleton.

Owed

A section check found still owed: which, and why.

Functions:

Name Description
section

The section named key.

blocks_of

The indices of report's blocks holding section key's words,

words

What the author has written in section key, stripped; '' while

write

Set what section key says, and return the index of its block.

state

'written', 'owed' or 'quiet' (a filled section with nothing of

instrumentation

Whether a block shows what was tested and how it was instrumented:

place

The section each generated block falls under.

check

The sections of report still owed, in order: each section the

arrange

The page's blocks laid out on the skeleton.

under

arrange's blocks with extra added at the end of section

finish

Draw each head arrange made, in place, once its words are HTML:

Classes

Section dataclass

Section(key: str, number: int, title: str, description: str, required: bool = True, none: str = '')

One section of the skeleton.

required sections are the author's to write and are owed until they say something. The others (Instrumentation, Results) are filled by what the project generates and are owed only when nothing falls under them. none is what one step writes when the section has nothing to report, or '' for a section that always has something (every report describes the article it tested).

Attributes:

Name Type Description
heading str

'9. Deviations, Anomalies and Nonconformances'.

Attributes
heading property
heading: str

'9. Deviations, Anomalies and Nonconformances'.

Owed dataclass

Owed(key: str, number: int, title: str, reason: str)

A section check found still owed: which, and why.

Functions:

section

section(key: Any) -> Section

The section named key.

Raises ValueError for a key that is not a section, naming the sections, and TypeError for one that is not a string.

blocks_of

blocks_of(report: Any, key: str) -> list[int]

The indices of report's blocks holding section key's words, in order. Normally one; none until the section is first written.

words

words(report: Any, key: str) -> str

What the author has written in section key, stripped; '' while it is owed.

write

write(report: Any, key: str, text: str | None = None, *, none: bool = False, by: str | None = None) -> int

Set what section key says, and return the index of its block.

The section's block is added at the end of the report the first time (where it sits among the blocks does not matter: the page lays the sections out in order). text replaces the section's words. none writes the section's own "nothing to report" wording, as one step. by is who made the interpretation, for the discussion only; an empty by clears it. With none of them, the block is made if it is missing and nothing else changes.

Refused, before anything changes: an unknown section; text and none together; none for a section that always has something to say; by for a section other than the discussion.

Raises:

Type Description
ValueError

For a refusal; the message names the section and the reason.

TypeError

When key, text or by is not a string.

state

state(found: Section, text: str, by: str = '', generated: bool = False) -> str

'written', 'owed' or 'quiet' (a filled section with nothing of the author's in it, which shows its heading only).

text is what the author wrote, by who interpreted, and generated whether anything the project generates falls under the section. The discussion, written without saying by whom, is 'unattributed'.

instrumentation

instrumentation(block: Mapping[str, Any], objects: Mapping[str, Any], object_groups: Sequence[Mapping[str, Any]] | None = None) -> bool

Whether a block shows what was tested and how it was instrumented: a photograph, the geometry or a DOF scene (a scene with no shapes), or a channel table.

place

place(entries: Sequence[tuple[Mapping[str, Any], bool, bool]]) -> list[str]

The section each generated block falls under.

entries is the report's blocks in their order, other than the section blocks, each as (block, is a drawn figure, shows the instrumentation). The blocks are read in the sections their ## headings make. A section holding the pass/fail box goes under the Summary, and so does a section of text only that comes before every figure (the description that opens a generated report). A section with a drawn photograph, geometry, DOF scene or channel table goes under Instrumentation. A section of text only after every figure (the reading guide that closes it) goes under the Conclusion. Everything else is Results.

check

check(report: Any, objects: Mapping[str, Any], object_groups: Sequence[Mapping[str, Any]] | None = None) -> tuple[Owed, ...]

The sections of report still owed, in order: each section the author has not written, a filled section with nothing in it, and a discussion that does not say by whom. Empty when nothing is owed.

A generated block counts as filling its section when its bindings resolve in objects (a text block always does), which is what the reading page draws.

Raises ValueError when the report does not have the skeleton sections enabled: there is then no skeleton to check it against, and an empty list would read as a report complete.

arrange

arrange(built: Sequence[dict[str, Any]], origins: Sequence[Mapping[str, Any]], held: Mapping[str, Sequence[tuple[int, Mapping[str, Any], dict[str, Any]]]], objects: Mapping[str, Any], object_groups: Sequence[Mapping[str, Any]] | None = None, edit: bool = False) -> list[dict[str, Any]]

The page's blocks laid out on the skeleton.

built is the page's blocks as built, in the report's order, and origins the report block each was built from. held is each section's own blocks, by key, as (index in the report, the block, the block built: its text with live references resolved). Returns the blocks in skeleton order: for each section, a head (its heading and the author's words, or the owed card) and then what falls under it; and last the end mark. A head carries skeleton for finish to draw once the text is rendered. On the edit page, a head carries the index of the section's block, or 'section:' while it has none, so a click on it opens it.

under

under(blocks: Sequence[dict[str, Any]], key: str, extra: Sequence[dict[str, Any]]) -> list[dict[str, Any]]

arrange's blocks with extra added at the end of section key: after the author's words and whatever already falls under it, before the next section's head (or the end mark). For blocks a feature generates into a section, such as the data index under the record. Raises ValueError for a key that is not a section.

finish

finish(blocks: Sequence[dict[str, Any]], end: str = END) -> None

Draw each head arrange made, in place, once its words are HTML: the heading, then the author's words, the owed card or nothing; the discussion's attribution and the conclusion's sentence. end is the last line ('End of amendment.' for an amendment, from the identity feature).