labthings_fastapi.thing_settings

Settings management for things

ThingSettings is a dictionary-like object that manages settings for one Thing

Module Contents

Classes

ReactiveDict

ThingSettings

API

class labthings_fastapi.thing_settings.ReactiveDict(data: Optional[collections.abc.Mapping] = None, name: Optional[str] = None, callback: Optional[Callable] = None)

Bases: collections.abc.Mapping

__getitem__(key)
notify_callbacks(path=None)
child_callback(child: labthings_fastapi.thing_settings.ReactiveDict, path: Any = None)

Propagate updates from children up to the parent object

__setitem__(key, item)
__delitem__(key)
__iter__()
__len__()
update(data: collections.abc.Mapping)

Update many key-value pairs at once

replace(data: collections.abc.Mapping)

Erase all data, then update from the supplied mapping

property dict

Return a regular, non-reactive dict of the data

class labthings_fastapi.thing_settings.ThingSettings(filename: str)

Bases: labthings_fastapi.thing_settings.ReactiveDict

write_to_file(*args, **kwargs)

Persist the dictionary to a file