timetoshare.validation.flow#

Flow rules: flow control, FlowMaps and virtual timelines.

The schema checks the shape of every flow-control element, FlowMap and virtual timeline; the rules here reach beyond it.

Before the schema, an element written in the earlier form of flow control (the key type with jump_from, jump_to or flow_marker, or the key target) is refused with the name of the converter (flow_control_form).

After the schema, timeline by timeline, the rules read the elements that are not rejected. An element is rejected when an entry of its provenance holds a belief false: a repair rejects an element and adds another, so a rejected jump and its replacement may share a coordinate. In document order: a coordinate lies from 0 to the timeline’s known length (flow_coordinate); a root and its descendants have one jump at a position on the root’s axis, each coordinate carried to the root by adding the offsets of its ancestors (jump_repeated); the destinations of a jump are distinct places (jump_destination); a to names a jump target or a region of the timeline, a child of it or the timeline itself (dangling_target); a place reached by by lies from 0 to the known length (flow_coordinate); an after names exactly one destination of another jump of the timeline (dangling_target).

Then the FlowMaps: timeline names a root (flow_map_timeline), every chunk ID a region or a child timeline inside that root’s tree, or a virtual timeline of a timeline of it (flow_map_chunk), and at most one FlowMap of a timeline is canonical (flow_map_canonical); and the virtual timelines: map names a FlowMap or a conversion map, timeline a timeline or another virtual timeline (dangling_target). A virtual timeline comes, virtual timeline by virtual timeline, from a timeline: none comes from itself through others. Where its map is a FlowMap and it states no through, the timeline it comes from lies in the tree of the FlowMap’s root, and its length is the sum of the FlowMap’s chunks and gaps where all of them lie on its own axis (virtual_timeline); with through neither is read.

Last the property flow of the manifest’s own graphical layer (flow_rule): no style sets it, a rule setting it selects by addresses alone, each the address of a timeline’s cards, and its value names a FlowMap of each such timeline, or a virtual timeline applying one to it without through.

A manifestation or a convention outside the format’s vocabulary, and members of one group that each state a flow, are valid: flow_warnings() reports them.

timetoshare.validation.flow.CONVERTER = 'scripts/convert_flow_control.py'#

The script that converts the earlier form of flow control, by its path in the TimeToShare repository.

timetoshare.validation.flow.EARLIER_ROLES = ('jump_from', 'jump_to', 'flow_marker')#

The values of type in the earlier form of flow control.

timetoshare.validation.flow.MANIFESTATIONS: Mapping[str, tuple[str, ...]] = {'barline': ('double_barline', 'final_barline'), 'break': ('fine', 'volta'), 'destination': ('repeat_end', 'da_capo', 'da_capo_al_fine', 'da_capo_al_coda', 'dal_segno', 'dal_segno_al_fine', 'dal_segno_al_coda', 'to_coda', 'volta', 'ossia'), 'jump_target': ('repeat_start', 'segno', 'coda', 'volta', 'ossia'), 'section_break': ()}#

The manifestations the format defines: of a jump’s destination, and of an element by its role. The vocabulary is open; any other word is reported as unknown and never refused.

timetoshare.validation.flow.CONVENTIONS = ('default', 'single', 'printed')#

The conventions the format defines for a FlowMap; the vocabulary is open.

timetoshare.validation.flow.earlier_form_problems(manifest)[source]#

Yield every flow-control element written in the earlier form.

Root by root, each timeline’s elements before its children’s. The walk reads any value and either form of an ID.

timetoshare.validation.flow.rejected(element)[source]#

Whether an entry of an element’s provenance holds a belief false.

timetoshare.validation.flow.JumpPositions#

The jumps of a root’s tree by their exact position on the root’s axis: the ID of the first jump there and of the timeline stating it.

alias of dict[Fraction, tuple[str, str]]

timetoshare.validation.flow.timeline_flow_problems(timeline, path, start=Fraction(0, 1), jumps_at=None)[source]#

Yield the problems of one timeline’s flow control, in document order.

The timeline’s own elements only; its children are the caller’s, who passes start, the timeline’s start on its root’s axis (the sum of the offsets from the root down), and one jumps_at for the whole tree, so that a jump at the position of an earlier jump of the root or of another descendant is refused as one at a coordinate of its own timeline is.

timetoshare.validation.flow.Axis#

The unit and the number type of an axis.

alias of tuple[str, str]

timetoshare.validation.flow.flow_map_problems(manifest)[source]#

Yield the problems of the FlowMaps, then of the virtual timelines.

FlowMap by FlowMap: its timeline, its chunks in their order (none where the timeline is no root), then a second canonical FlowMap of its timeline. Virtual timeline by virtual timeline: its map, then its timeline, then the virtual timelines it comes from itself through, and, where it comes from a timeline and applies a FlowMap of a root without through, the FlowMap of another root, else its length.

timetoshare.validation.flow.flow_rule_problems(manifest)[source]#

Yield the problems of the property flow.

Each style setting it, in code-point order of the style names; then, rule by rule in array order, a selector that does not name the cards of timelines by their addresses alone, then a value naming no FlowMap and no virtual timeline, or else, address by address, a value that is no FlowMap of that timeline and no virtual timeline applying one to it without through.

timetoshare.validation.flow.flow_warnings(manifest)[source]#

Return the flow warnings of a valid manifest, in document order.

manifestation_unknown at the manifestation of a flow-control element or of a jump’s destination that the format does not define for it, convention_unknown at the convention of a FlowMap that is none of the format’s, and flow_conflict at the members of a group of which more than one member’s cards a rule sets flow on: the group’s frame is then drawn as written.