From 5b9e38fe4e43a8ac60bcd7825c95fe35f3a97470 Mon Sep 17 00:00:00 2001 From: Sergei Silnov Date: Tue, 13 Aug 2019 11:35:51 +0200 Subject: [PATCH] idf.py: Fix PropertyDict implementation --- tools/idf.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tools/idf.py b/tools/idf.py index 1083d1d02..a8fe6089d 100755 --- a/tools/idf.py +++ b/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():