diff options
author | Isis Lovecruft <isis@torproject.org> | 2013-02-15 19:27:53 +0000 |
---|---|---|
committer | Isis Lovecruft <isis@torproject.org> | 2013-02-15 19:27:53 +0000 |
commit | d486c13af17133e2e5a2bfe6e5a862bfea6736ff (patch) | |
tree | 4f68c594a6e3ff072c9c886a076d03d679c2f3c7 /src/leap/util/__init__.py | |
parent | 02e84d4ac48294bdfea49678d59ebd410010e2a9 (diff) |
Module directory layout changes, with corresponding __init__.py changes.
Diffstat (limited to 'src/leap/util/__init__.py')
-rw-r--r-- | src/leap/util/__init__.py | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/leap/util/__init__.py b/src/leap/util/__init__.py deleted file mode 100644 index 35e1297..0000000 --- a/src/leap/util/__init__.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- encoding: utf-8 -*- -""" - mx/util/__init__.py - ------------------- - Initialization file for leap_mx utilities. Some miscellaneous things are - stored here also. -""" - - -class Storage(dict): - """ - A Storage object is like a dictionary except `obj.foo` can be used - in addition to `obj['foo']`. - - >>> o = Storage(a=1) - >>> o.a - 1 - >>> o['a'] - 1 - >>> o.a = 2 - >>> o['a'] - 2 - >>> del o.a - >>> o.a - None - """ - def __getattr__(self, key): - try: - return self[key] - except KeyError, k: - return None - - def __setattr__(self, key, value): - self[key] = value - - def __delattr__(self, key): - try: - del self[key] - except KeyError, k: - raise AttributeError, k - - def __repr__(self): - return '<Storage ' + dict.__repr__(self) + '>' - - def __getstate__(self): - return dict(self) - - def __setstate__(self, value): - for (k, v) in value.items(): - self[k] = v |