Merge branch 'bugfix/idf_py_fix_property_dict_v4.0' into 'release/v4.0'

idf.py: Fix PropertyDict implementation (v4.0)

See merge request espressif/esp-idf!6249
This commit is contained in:
Jiang Jiang Jian 2019-10-21 10:37:31 +08:00
commit 9f1d992ef9

View File

@ -524,9 +524,20 @@ def get_default_serial_port():
class PropertyDict(dict): class PropertyDict(dict):
def __init__(self, *args, **kwargs): def __getattr__(self, name):
super(PropertyDict, self).__init__(*args, **kwargs) if name in self:
self.__dict__ = self return self[name]
else:
raise AttributeError("'PropertyDict' object has no attribute '%s'" % name)
def __setattr__(self, name, value):
self[name] = value
def __delattr__(self, name):
if name in self:
del self[name]
else:
raise AttributeError("'PropertyDict' object has no attribute '%s'" % name)
def init_cli(): def init_cli():