modelrunner.storage.backend.json module

Defines a class storing data in memory and writing it to a file in JSON format

class JSONStorage(path, *, mode='read', simplify=True, **kwargs)[source]

Bases: TextStorageBase

storage that stores data in a JSON text file

Note that the data is only written once the storage is closed.

Parameters:
  • path (str or Path) – File path to the file

  • mode (str or AccessMode) – The file mode with which the storage is accessed. Determines allowed operations.

  • simplify (bool) – Flag indicating whether the data is stored in a simplified form

extensions: list[str] = ['json']

all file extensions supported by this storage

Type:

list of str

mode: AccessMode

access mode

Type:

AccessMode