nodify.context.NodeContext

class nodify.context.NodeContext(*maps)[source]

Bases: ChainMap

Extension of Chainmap that always checks on the temporal context first.

Using this class is equivalent to forcing users to have the temporal context always in the first position of the chainmap. Since this is not a very nice thing to force on users, we use this class instead.

Keys:
lazy: bool

If False, nodes will automatically recompute if any of their inputs have changed, even if no other node needs their output yet.

lazy_init: bool or None

Whether the node should compute on initialization. If None, defaults to lazy.

debug: bool

Whether to print debugging information.

debug_show_inputs:

Whether to print the inputs of the node when debugging.

__init__(*maps)

Initialize a ChainMap by setting maps to the given mappings. If no mappings are provided, a single empty dictionary is used.

Methods

__init__(*maps)

Initialize a ChainMap by setting maps to the given mappings.

clear()

Clear maps[0], leaving maps[1:] intact.

copy()

New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]

fromkeys(iterable, *args)

Create a ChainMap with a single dict created from the iterable.

get(k[,d])

items()

keys()

new_child([m])

New ChainMap with a new map followed by all previous maps.

pop(key, *args)

Remove key from maps[0] and return its value.

popitem()

Remove and return an item pair from maps[0].

setdefault(k[,d])

update([E, ]**F)

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values()

Attributes

parents

].

clear()

Clear maps[0], leaving maps[1:] intact.

copy()

New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]

classmethod fromkeys(iterable, *args)

Create a ChainMap with a single dict created from the iterable.

get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
new_child(m=None, **kwargs)

New ChainMap with a new map followed by all previous maps. If no map is provided, an empty dict is used. Keyword arguments update the map or new empty dict.

property parents

].

Type:

New ChainMap from maps[1

pop(key, *args)

Remove key from maps[0] and return its value. Raise KeyError if key not in maps[0].

popitem()

Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values