timetoshare.validation.diagnostics#

The validator’s diagnostics and the small readers every rule module shares.

The error a rule raises with its code and path, the JSON pointer of a path, the readers of a schema-checked object’s members, and the walks of the IDs of a root’s tree and of the whole manifest, which read any value. A leaf module: it imports no rule module and no validator, so the rule modules and timetoshare.validate both import it without a cycle.

timetoshare.validation.diagnostics.InstancePath#

The path of a value in a manifest: its member names and array indices from the root.

alias of tuple[str | int, …]

timetoshare.validation.diagnostics.ValidationCode#

The code of a validation error: the rule of the schema or of the format the value breaks.

alias of Literal[‘not_a_manifest’, ‘schema’, ‘representation’, ‘duplicate_id’, ‘dangling_target’, ‘flow_control_form’, ‘flow_coordinate’, ‘jump_repeated’, ‘jump_destination’, ‘flow_map_timeline’, ‘flow_map_chunk’, ‘flow_map_canonical’, ‘virtual_timeline’, ‘flow_rule’, ‘conversion_map’, ‘child_unit’, ‘child_offset’, ‘child_end’, ‘segment_line’, ‘group_member’, ‘manifest_id’, ‘order_key’, ‘display_order’, ‘band_order’, ‘timestamp_timeline’, ‘timestamp_coordinate’, ‘groupstamp’, ‘elision_timeline’, ‘elision_stretch’, ‘match_timestamp’, ‘alignment_anchor’, ‘matchstamp’, ‘resource_timeline’, ‘resource_type’, ‘calendar_date’, ‘finite_number’, ‘context’, ‘reserved_key’, ‘iri’, ‘element_value’, ‘provenance_duplicate’, ‘belief_actor’]

timetoshare.validation.diagnostics.WarningCode#

The codes of the warnings a valid manifest may draw.

alias of Literal[‘context_absent’, ‘bundle_blank’, ‘manifestation_unknown’, ‘convention_unknown’, ‘flow_conflict’]

class timetoshare.validation.diagnostics.ManifestWarning[source]#

Bases: TypedDict

A warning about a valid manifest: its code, its path and its message.

timetoshare.validation.diagnostics.connected_sets(pairs)[source]#

Map every member of the pairs to the representative of its connected set.

Two members share a representative exactly when a chain of pairs joins them (union-find with path halving). The MatchStamp rule counts the sets a named MatchStamp’s anchors form; the table types group the unique anchors of a MatchClaim table into potential MatchStamps by it.

timetoshare.validation.diagnostics.json_pointer(path)[source]#

Render a path as a JSON pointer in URI fragment form (# for the root).

exception timetoshare.validation.diagnostics.SchemaValidationError(code, path, message)[source]#

Bases: ValueError

Raised when a value violates the schema or a semantic rule.

timetoshare.validation.diagnostics.duplicate_problem(identifier, path, first, code='duplicate_id')[source]#

The problem of an ID at path that the manifest holds first at first.

timetoshare.validation.diagnostics.entries_of(owner, key)[source]#

The list an object holds at key, else an empty list.

timetoshare.validation.diagnostics.string_id(element)[source]#

Return an element’s id where it is an object holding a string id.

timetoshare.validation.diagnostics.tree_ids(root, path)[source]#

Yield every ID of a root’s tree with its path, in the order of the rules.

The timelines depth first, each with its conversion maps’, regions’ and flow-control elements’ IDs before its children’s; then the IDs of the maps other maps hold, timeline by timeline in the same order, each held map before those it holds, a CombinationMap’s outputs by name in code-point order. An element that is no object or holds no string id is passed over, so the walk reads any value.

timetoshare.validation.diagnostics.listed_ids(manifest)[source]#

Yield the IDs of the elements a manifest lists outside its timelines.

The groups, the MeasureMaps, the named timestamps, the elisions, the named MatchStamps, each followed by its alignment anchors, the resources, the FlowMaps and the virtual timelines, in that order, each with its path. An entry that is no object or holds no string id is passed over, so the walk reads any value.

timetoshare.validation.diagnostics.manifest_ids(manifest)[source]#

Yield every ID of a manifest with its path, in the order of the rules.

Each root’s tree (tree_ids), then the listed elements (listed_ids), then the manifest’s own id. The walk reads any value.

timetoshare.validation.diagnostics.timelines_by_id(manifest)[source]#

Return every timeline of a manifest, at any depth, by ID.

Of a repeated ID the first timeline in document order is kept.

timetoshare.validation.diagnostics.axes_by_id(manifest)[source]#

Return every timeline of a manifest, at any depth, and every virtual timeline, by ID: what a named timestamp, a group member or a resource may name.

Of a repeated ID the first in this order is kept, the timelines in document order before the virtual timelines.

timetoshare.validation.diagnostics.timestamps_of(manifest)[source]#

Return the named timestamps of a manifest’s graphical object, or none.

timetoshare.validation.diagnostics.elisions_of(manifest)[source]#

Return the elisions of a manifest’s graphical object, or none.

timetoshare.validation.diagnostics.matchstamps_of(manifest)[source]#

Return the named MatchStamps of a manifest’s graphical object, or none.

timetoshare.validation.diagnostics.number_type_of(timeline)[source]#

Return the number type of a timeline’s axis: its own, or its unit’s default.