happi.backends.json_db.JSONBackend

class happi.backends.json_db.JSONBackend(path, initialize=False)

JSON database

The happi information is kept in a single dictionary large dictionary that is stored using simplejson

Parameters
  • path (str) – Path to JSON file

  • initialze (bool, optional) – Initialize a new empty JSON file to begin filling

__init__(path, initialize=False)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(path[, initialize])

Initialize self.

delete(_id)

Delete a device instance from the database

find(to_match)

Find an instance or instances that matches the search criteria

find_range(key, *, start[, stop])

Find an instance or instances that matches the search criteria, such that start <= entry[key] < stop.

find_regex(to_match, *[, flags])

Find an instance or instances that matches the search criteria, using regular expressions.

get_by_id(id_)

Get a device by ID if it exists, or None

initialize()

Initialize a new JSON file database

load()

Load the JSON database

save(_id, post[, insert])

Save information to the database

store(db)

Stache the database back into JSON

Attributes

all_devices

All of the devices in the database