|
Packit |
6978fb |
# -*- coding: utf-8 -*-
|
|
Packit |
6978fb |
#
|
|
Packit |
6978fb |
# metamodule.py
|
|
Packit |
6978fb |
#
|
|
Packit |
6978fb |
# Copyright (C) 2012 - Jesse van den Kieboom
|
|
Packit |
6978fb |
#
|
|
Packit |
6978fb |
# This program is free software; you can redistribute it and/or modify
|
|
Packit |
6978fb |
# it under the terms of the GNU General Public License as published by
|
|
Packit |
6978fb |
# the Free Software Foundation; either version 2 of the License, or
|
|
Packit |
6978fb |
# (at your option) any later version.
|
|
Packit |
6978fb |
#
|
|
Packit |
6978fb |
# This program is distributed in the hope that it will be useful,
|
|
Packit |
6978fb |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6978fb |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
6978fb |
# GNU General Public License for more details.
|
|
Packit |
6978fb |
#
|
|
Packit |
6978fb |
# You should have received a copy of the GNU General Public License
|
|
Packit |
6978fb |
# along with this program; if not, write to the Free Software
|
|
Packit |
6978fb |
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
Packit |
6978fb |
# Boston, MA 02110-1301, USA.
|
|
Packit |
6978fb |
|
|
Packit |
6978fb |
class MetaModule(object):
|
|
Packit |
6978fb |
def __init__(self, mod):
|
|
Packit |
6978fb |
object.__setattr__(self, '_mod', mod)
|
|
Packit |
6978fb |
|
|
Packit |
6978fb |
def __getattribute__(self, name):
|
|
Packit |
6978fb |
return getattr(object.__getattribute__(self, "_mod"), name)
|
|
Packit |
6978fb |
|
|
Packit |
6978fb |
def __delattr__(self, name):
|
|
Packit |
6978fb |
delattr(object.__getattribute__(self, "_mod"), name)
|
|
Packit |
6978fb |
|
|
Packit |
6978fb |
def __setattr__(self, name, value):
|
|
Packit |
6978fb |
setattr(object.__getattribute__(self, "_mod"), name, value)
|
|
Packit |
6978fb |
|
|
Packit |
6978fb |
def __getitem__(self, item):
|
|
Packit |
6978fb |
return object.__getattribute__(self, "_mod")[item]
|
|
Packit |
6978fb |
|
|
Packit |
6978fb |
def __setitem__(self, item, value):
|
|
Packit |
6978fb |
object.__getattribute__(self, "_mod")[item] = value
|
|
Packit |
6978fb |
|
|
Packit |
6978fb |
def __delitem__(self, item):
|
|
Packit |
6978fb |
del object.__getattribute__(self, "_mod")[item]
|
|
Packit |
6978fb |
|
|
Packit |
6978fb |
def __iter__(self):
|
|
Packit |
6978fb |
return iter(object.__getattribute__(self, "_mod"))
|
|
Packit |
6978fb |
|
|
Packit |
6978fb |
def __contains__(self, item):
|
|
Packit |
6978fb |
return item in object.__getattribute__(self, "_mod")
|
|
Packit |
6978fb |
|
|
Packit |
6978fb |
def __call__(self, *args, **kw):
|
|
Packit |
6978fb |
object.__getattribute__(self, "_mod").__default__(*args, **kw)
|
|
Packit |
6978fb |
|
|
Packit |
6978fb |
# vi:ts=4:et
|