defernia.world.serializer — Fact serializer

defernia.world.serializer.dump(fact, file)

Dumps the passed fact object into the file.

Parameters:
  • fact (Fact) – a fact object to serialize
  • file (file object) – a file to be written
defernia.world.serializer.load(file, reference_loader=None)

Loads the fact object from the passed file object.

Parameters:
  • file (file object) – a file to read
  • reference_loader (callable object) – a function that takes a fact id and returns a fact of it
Returns:

a loaded fact object

Return type:

Fact

Note

It doesn’t initialize loaded fact object’s metadata attributes e.g.:

  • __repo__
  • __rev__
  • __fact_id__
defernia.world.serializer.loads(str, *args, **kwargs)

Does the same operations as load() function does except it takes a string instead of a file object.

Project Versions

Previous topic

defernia.world.types — Transcendental fact types

Next topic

defernia.world.repo — Revision control of world

This Page