References

Resolving references in imported data to Factors and text passages.

authorityspoke.io.references.log_mentioned_context(func)

Retrieve cached Factor instead of building one with the decorated method.

Decorator for read_factor() and read_enactment().

If factor_record is a str instead of a dict, looks up the corresponding factor in “mentioned” and returns that instead of constructing a new Factor. Also, if the newly-constructed Factor has a name attribute, logs the Factor in mentioned for later use.

class authorityspoke.io.references.SelectorSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)
split_text(text)

Break up shorthand text selector format into three fields.

Tries to break up the string into prefix, exact, and suffix, by splitting on the pipe characters.

Parameters

text (str) – a string or dict representing a text passage

Return type

Tuple[str, …]

Returns

a tuple of the three values

expand_shorthand(data, **kwargs)

Convert input from shorthand format to normal selector format.

Return type

Dict[str, str]

authorityspoke.io.references.read_selector(record, source=None)

Create new selector from JSON user input.

Parameters

record (Union[dict, str]) – a string or dict representing a text passage

Return type

TextQuoteSelector

Returns

a new TextQuoteSelector

authorityspoke.io.references.read_selectors(records)

Create list of TextQuoteSelectors from JSON user input.

If the input is a str, tries to break up the string into prefix, exact, and suffix, by splitting on the pipe characters.

Parameters

record – a string or dict representing a text passage, or list of strings and dicts.

Return type

List[TextQuoteSelector]

Returns

a list of TextQuoteSelectors