diff options
author | hut <hut@lavabit.com> | 2010-03-11 11:53:12 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-03-12 00:46:47 +0100 |
commit | 6d7253853ca11320dd7d08720f8e7312c5fc5b2e (patch) | |
tree | fc8ee6d2abc5668ae6520281944e237dd2c35b45 /ranger | |
parent | b4a0c3878d573f9278ca123350a7d2563850ab82 (diff) | |
download | ranger-6d7253853ca11320dd7d08720f8e7312c5fc5b2e.tar.gz |
openstruct: faster implementation, removed ReferencedOpenStruct
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/ext/openstruct.py | 25 | ||||
-rw-r--r-- | ranger/gui/colorscheme.py | 1 |
2 files changed, 5 insertions, 21 deletions
diff --git a/ranger/ext/openstruct.py b/ranger/ext/openstruct.py index 56f7de06..11363127 100644 --- a/ranger/ext/openstruct.py +++ b/ranger/ext/openstruct.py @@ -13,23 +13,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -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__ - -class ReferencedOpenStruct(OpenStruct): - def __init__(self, dictionary): - self.__dict__ = dictionary +class OpenStruct(dict): + """The fusion of dict and struct""" + def __init__(self, *args, **keywords): + dict.__init__(self, *args, **keywords) + self.__dict__ = self diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py index 867aec70..99ea6ff7 100644 --- a/ranger/gui/colorscheme.py +++ b/ranger/gui/colorscheme.py @@ -41,7 +41,6 @@ If your colorscheme-file contains more than one colorscheme, specify it with: colorscheme = colorschemes.filename.classname """ -from ranger.ext.openstruct import ReferencedOpenStruct from curses import color_pair from ranger.gui.color import get_color from ranger.gui.context import Context |