WeldxFile.update(mapping=(), **kwargs)#

Update this file from mapping or iterable mapping and kwargs.

  • mapping (Mapping | Iterable) – a key, value paired like structure or an iterable of keys.

  • kwargs (Any) – any key value pair you can think of.


Let the mapping parameter denote E, and let the kwargs parameter denote F. If 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


Let us update one weldx file with another one. >>> a = WeldxFile(tree=dict(x=42), mode=”rw”) >>> b = WeldxFile(tree=dict(x=23, y=0), mode=”rw”)

We pass all data of b to a while adding another key value pair.

>>> a.update(b, foo="bar")

Or we can update with an iterable of key, value tuples. >>> data = [(‘x’, 0), (‘y’, -1)] >>> a.update(data) >>> a[“foo”], a[“x”], a[“y”] (‘bar’, 0, -1)

Another possibility is to directly pass keyword arguments. >>> a.update(x=-1, z=42) >>> a[“x”], a[“z”] (-1, 42)