Preload

Maps to change the loaded .yaml from nwb schema before it’s given to the nwb_schema_language models

class SCOPE_TYPES(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

When a mapping should be applied

Todo

This is likely deprecated, check usage.

namespace = 'namespace'
class PHASES(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

The times that a mapping can happen

Todo

This is likely deprecated, check usage.

postload = 'postload'

After the YAML for a model has been loaded

class KeyMap(scope: str, scope_type: SCOPE_TYPES, source: str, target: str, transform: callable | None = None, phase: PHASES | None = None, **_kwargs)

Map for renaming keys used in schemas according to some rule

Todo

This is likely deprecated, check usage.

scope: str

The namespace that the map is relevant to

scope_type: SCOPE_TYPES
source: str

The path within the schema to select the element to transform

target: str

The path where the element should end

transform: callable | None = None

Some transformation function, currently not implemented.

phase: PHASES | None = None
instances: ClassVar[List[KeyMap]] = [KeyMap(scope='hdmf-common', scope_type=<SCOPE_TYPES.namespace: 'namespace'>, source="'data_type_def'", target="'neurodata_type_def'", transform=None, phase=<PHASES.postload: 'postload'>), KeyMap(scope='hdmf-common', scope_type=<SCOPE_TYPES.namespace: 'namespace'>, source="'data_type_inc'", target="'neurodata_type_inc'", transform=None, phase=<PHASES.postload: 'postload'>)]

Maps that get defined!!!

apply(input: dict) dict

Change all keys from source to target in a super naive way.

Convert the dictionary to a string. Do regex. parse ast

apply_postload(ns_dict: dict) dict

Apply all post-load maps to a YAML schema