1 # class Facade(object):
3 # # def _fwd_mth(self, mth_name, tgt_mth):
4 # # def fun(*args, **kwargs): return tgt_mth(*args, **kwargs)
5 # # setattr(self, mth_name, fun)
7 # # def _fwd_prop(self, prop_name, tgt_prop):
8 # # setattr(self.__class__, prop_name, property(lambda self: tgt_prop))
10 # def __init__(self, prop_lst=[], mth_lst=[]):
11 # list(map(lambda args: self.__fwd_prop(*args), prop_lst))
12 # list(map(lambda args: self.__fwd_mth(*args), mth_lst))
13 # # try detecting if the forwarded item is a prop or a method, so we
14 # # can pass only a single list
16 # def __fwd_mth(self, mth_name, tgt_mth):
17 # def fun(*args, **kwargs): return tgt_mth(self)(*args, **kwargs)
18 # setattr(self, mth_name, fun)
20 # def __fwd_prop(self, prop_name, tgt_prop):
21 # setattr(self.__class__, prop_name, property(tgt_prop))
23 # def destroy(self): pass