kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'bugfix/idf_py_fix_property_dict' into 'master'
idf.py: Fix PropertyDict implementation See merge request espressif/esp-idf!5775pull/4068/head
commit
f4763a3e1a
17
tools/idf.py
17
tools/idf.py
|
@ -540,9 +540,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():
|
||||||
|
|
Ładowanie…
Reference in New Issue