def __getattribute__(self, name): if name[:2] == '__': attr = object.__getattribute__(self, name) return attr else: attr_dic = object.__getattribute__(self, '__dict__') if name == '__dict__': return attr_dic else: return helpers.gen_getter(attr_dic, name) pass
def __getattribute__(self,name): if name[:2] == '__': attr = object.__getattribute__(self,name) return attr else: attr_dic = object.__getattribute__(self,'__dict__') if name is '__dict__': return attr_dic else: return helpers.gen_getter(attr_dic,name) pass
def test_gen_getter(self): kkdict = {} kkdict['first']='kkk1:kkk2' kkdict['kkk1']=19 kkdict['kkk2']=1000 kkdict['other']='unrelated' kkdict['second']='ssss1:ssss2:third' kkdict['third']='Babara' subst = {} subst['ssss1']='kkk1' subst['ssss2']='other' subst_dict,descr = helpers.build_properties_dict(kkdict,subst) self.assertEqual(helpers.gen_getter(subst_dict,'kkk1'),19) self.assertEqual(helpers.gen_getter(subst_dict,'kkk2'),1000) self.assertEqual(helpers.gen_getter(subst_dict,'first'),(19,1000)) self.assertEqual(helpers.gen_getter(subst_dict,'other'),'unrelated') self.assertEqual(helpers.gen_getter(subst_dict,'second'),[19,'unrelated','Babara']) self.assertEqual(helpers.gen_getter(subst_dict,'third'),'Babara')
def __getattr__(self,name): return helpers.gen_getter(self.__dict__,name)
def __getattr__(self,name): if name is 'special': return self.__special else: tDict = object.__getattribute__(self,'__dict__') return helpers.gen_getter(tDict,name)
def __getattr__(self, name): return helpers.gen_getter(self.__dict__, name)
def __getattr__(self, name): if name == 'special': return self.__special else: tDict = object.__getattribute__(self, '__dict__') return helpers.gen_getter(tDict, name)
def __get__(self,instance,type=None): if instance is None: return self return prop_helpers.gen_getter(instance.__dict__,'use_hard_mask_only')