neural_compressor.conf.dotdict
Module Contents
Classes
Access yaml using attributes instead of using the dictionary notation. |
Functions
|
Get the dot key's item in nested dict |
|
Set the dot key's item in nested dict |
- neural_compressor.conf.dotdict.deep_get(dictionary, keys, default=None)[source]
- Get the dot key’s item in nested dict
eg person = {‘person’:{‘name’:{‘first’:’John’}}} deep_get(person, “person.name.first”) will output ‘John’.
- Parameters:
dictionary (dict) – The dict object to get keys
keys (dict) – The deep keys
default (object) – The return item if key not exists
- Returns:
the item of the deep dot keys
- Return type:
item
- neural_compressor.conf.dotdict.deep_set(dictionary, keys, value)[source]
- Set the dot key’s item in nested dict
eg person = {‘person’:{‘name’:{‘first’:’John’}}} deep_set(person, “person.sex”, ‘male’) will output {‘person’: {‘name’: {‘first’: ‘John’}, ‘sex’: ‘male’}}
- Parameters:
dictionary (dict) – The dict object to get keys
keys (dict) – The deep keys
value (object) – The value of the setting key