diff options
author | hut <hut@lavabit.com> | 2009-12-10 01:37:14 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2009-12-10 01:37:14 +0100 |
commit | 871c502d58055c7611f0763eaa71a7fafad7efdc (patch) | |
tree | 0f0080aac9f8bdbee5a7d6ca9bf6bb0d4866ffb7 /ranger/ext/openstruct.py | |
parent | aea67778ad2366b4e4171008af7b0dcd5d91f93b (diff) | |
download | ranger-871c502d58055c7611f0763eaa71a7fafad7efdc.tar.gz |
Restructuration
Diffstat (limited to 'ranger/ext/openstruct.py')
-rw-r--r-- | ranger/ext/openstruct.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ranger/ext/openstruct.py b/ranger/ext/openstruct.py new file mode 100644 index 00000000..0a899de6 --- /dev/null +++ b/ranger/ext/openstruct.py @@ -0,0 +1,16 @@ +class OpenStruct(object): + def __init__(self, __dictionary=None, **__keywords): + if __dictionary: + self.__dict__.update(__dictionary) + if __keywords: + self.__dict__.update(__keywords) + + def __getitem__(self, key): + return self.__dict__[key] + + def __setitem__(self, key, value): + self.__dict__[key] = value + return value + + def __contains__(self, key): + return key in self.__dict__ |