Developer Interface¶
This part of the documentation covers all the interfaces of bpyutils.
Utilities¶
- class bpyutils.util._dict.AutoDict¶
- bpyutils.util._dict.autodict(*args, **kwargs)¶
Automatically adds a key to a dictionary.
Example:
>>> d = bpy.autodict() >>> d['foo']['bar']['baz'] = 'boo' {'foo': {'bar': {'baz': 'boo'}}}
- bpyutils.util._dict.dict_from_list(keys, values=None)¶
Generate a dictionary from a list of keys and values.
- Parameters
keys – A list of keys.
values – A list of values.
- Returns
dict
Example:
>>> bpy.dict_from_list(['a', 'b', 'c'], [1, 2, 3]) {'a': 1, 'b': 2, 'c': 3}
- bpyutils.util._dict.lkeys(d)¶
Get the keys of a dictionary as a list.
- Parameters
d – A dictionary.
- Returns
list
Example:
>>> bpy.lkeys({ 'foo': 'bar', 'baz': 'boo' }) ['foo', 'baz']
- bpyutils.util._dict.lvalues(d)¶
Get the values of a dictionary as a list.
- Parameters
d – A dictionary.
- Returns
list
Example:
>>> bpy.lvalues({ 'foo': 'bar', 'baz': 'boo' }) ['bar', 'boo']
- bpyutils.util._dict.merge_dict(*args, **kwargs)¶
Merge Dictionaries.
- Parameters
args – arguments of dictionaries to be merged. merge_dict will override keys from right to left.
- Returns
dict
Example:
>>> bpy.merge_dict({ 'foo': 'bar' }, { 'bar': 'baz' }, { 'baz': 'boo' }) {'foo': 'bar', 'bar': 'baz', 'baz': 'boo'} >>> bpy.merge_dict({ 'foo': 'bar' }, { 'foo': 'baz', 'bar': 'boo' }) {'foo': 'baz', 'bar': 'boo'}