API

Do JSON translation.

class dojson.overdo.Index(rules=None, flags=0, branch_size=99)[source]

Index implementation based on build-in Python SRE module.

query(key)[source]

Return data matching the key.

class dojson.overdo.Overdo(bases=None, entry_point_group=None)[source]

Translation index.

build()[source]

Build.

do(blob, ignore_missing=True, exception_handlers=None)[source]

Translate blob values and instantiate new model instance.

Raises MissingRule when no rule matched and ignore_missing is False.

Parameters:
  • blobdict-like object on which the matching rules are going to be applied.
  • ignore_missing – Set to False if you prefer to raise an exception MissingRule for the first key that it is not matching any rule.
  • exception_handlers – Give custom exception handlers to take care of non-standard codes that are installation specific.

Changed in version 1.0.0: ignore_missing allows to specify if the function should raise an exception.

Changed in version 1.1.0: exception_handlers allows to set custom handlers for non-standard MARC codes.

missing(blob)[source]

Return keys with missing rules.

over(name, *source_tags)[source]

Register creator rule.

Errors

Define all DoJSON exceptions.

exception dojson.errors.DoJSONException[source]

Parent for all DoJSON exceptions.

New in version 1.0.0.

exception dojson.errors.IgnoreItem[source]

The corresponding item from the current iterable has been ignored.

New in version 1.3.0.

exception dojson.errors.IgnoreKey[source]

The corresponding key has been ignored.

New in version 0.2.0.

exception dojson.errors.MissingRule[source]

Raise when no matching rule was found.

New in version 1.0.0.

CLI

Define chainable commands for processing loaded data.

dojson.cli.command.process_do = <click.core.Command object>

Process data using given rule.

dojson.cli.command.process_missing = <click.core.Command object>

List fields with missing rules.

dojson.cli.command.process_schema = <click.core.Command object>

Add $schema to an item.

Utility function to manage CLI entry points

dojson.cli.utils.open_entry_point(group_name)[source]

Open entry point.

dojson.cli.utils.with_plugins(group_name)[source]

Register external CLI commands.

Contrib

There are set of rules to manage translation from other formats.

MARC21

MARC standards based on www.loc.gov/marc/.