cottax.consumers.json.refusals module

Why a graph is not written or read as JSON, and why a spelling or a codec is refused: a word another one is registered under (one_per_kind, one_per_tag).

one_per_kind(spelling: Spelling, registered: tuple[Spelling, ...])[source]

A kind names one spelling: a file is read by it.

Return type:

Iterator[Violation]

one_per_tag(codec: PlaceCodec | LabelCodec, registered: tuple[PlaceCodec | LabelCodec, ...])[source]

A tag names one codec of its interface: a file’s header is read by it.

Return type:

Iterator[Violation]

class SpelledTwice(what: str, first: str, second: str)[source]

Bases: Violation

what: str
first: str
second: str
template: AbstractClassVar[str] = '{what} is spelled by {first} already, so {second} is refused: which one reads it would be chosen by import order'

e.g. ‘output {place!r} is owned by both {other!r} and {node!r}’

Type:

Wording

class CodedTwice(what: str, first: str, second: str)[source]

Bases: Violation

what: str
first: str
second: str
template: AbstractClassVar[str] = '{what} is written by the codec {first} already, so {second} is refused: which one reads it would be chosen by import order'

e.g. ‘output {place!r} is owned by both {other!r} and {node!r}’

Type:

Wording

class Unexportable(node: object, what: str, reason: str)[source]

Bases: Violation

node: object
what: str
reason: str
template: AbstractClassVar[str] = '{node!r}: {what} is not written as JSON -- {reason}'

e.g. ‘output {place!r} is owned by both {other!r} and {node!r}’

Type:

Wording

class NotAGraph(format: object, version: object, expected: str, current: int)[source]

Bases: Violation

format: object
version: object
expected: str
current: int
template: AbstractClassVar[str] = 'a {format!r} file of version {version!r}, not {expected!r} version {current}'

e.g. ‘output {place!r} is owned by both {other!r} and {node!r}’

Type:

Wording

class UnknownCodec(interface: str, written: object)[source]

Bases: Violation

interface: str
written: object
template: AbstractClassVar[str] = 'written by the {interface} {written!r}, which is not registered: import the module that registers it (a feature registers its own when its `consumers` is imported)'

e.g. ‘output {place!r} is owned by both {other!r} and {node!r}’

Type:

Wording

class UnknownKind(node: object, kind: str)[source]

Bases: Violation

node: object
kind: str
template: AbstractClassVar[str] = '{node!r}: {kind!r} is no node kind with a spelling registered -- import the module that registers it (a feature registers its own when its `consumers` is imported)'

e.g. ‘output {place!r} is owned by both {other!r} and {node!r}’

Type:

Wording

class Inconsistent(node: object, side: str)[source]

Bases: Violation

node: object
side: str
template: AbstractClassVar[str] = "{node!r}: the file's {side} roles disagree with its driver's"

e.g. ‘output {place!r} is owned by both {other!r} and {node!r}’

Type:

Wording

class NotLoaded(name: str, module: str)[source]

Bases: Violation

name: str
module: str
template: AbstractClassVar[str] = '{name!r}: {module!r} is not imported. Loading imports nothing: import it first, or pass a `resolve` of your own'

e.g. ‘output {place!r} is owned by both {other!r} and {node!r}’

Type:

Wording