idf.py: Fix PropertyDict implementation
This commit is contained in:
parent
abdf12dc9e
commit
9ca33a260f
1 changed files with 14 additions and 3 deletions
17
tools/idf.py
17
tools/idf.py
|
@ -524,9 +524,20 @@ def get_default_serial_port():
|
|||
|
||||
|
||||
class PropertyDict(dict):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(PropertyDict, self).__init__(*args, **kwargs)
|
||||
self.__dict__ = self
|
||||
def __getattr__(self, name):
|
||||
if name in 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():
|
||||
|
|
Loading…
Reference in a new issue