本文整理汇总了Python中Direct.ReductionHelpers.gen_getter方法的典型用法代码示例。如果您正苦于以下问题:Python ReductionHelpers.gen_getter方法的具体用法?Python ReductionHelpers.gen_getter怎么用?Python ReductionHelpers.gen_getter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Direct.ReductionHelpers
的用法示例。
在下文中一共展示了ReductionHelpers.gen_getter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __getattribute__
# 需要导入模块: from Direct import ReductionHelpers [as 别名]
# 或者: from Direct.ReductionHelpers import gen_getter [as 别名]
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
示例2: test_gen_getter
# 需要导入模块: from Direct import ReductionHelpers [as 别名]
# 或者: from Direct.ReductionHelpers import gen_getter [as 别名]
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')
示例3: __getattr__
# 需要导入模块: from Direct import ReductionHelpers [as 别名]
# 或者: from Direct.ReductionHelpers import gen_getter [as 别名]
def __getattr__(self,name):
return helpers.gen_getter(self.__dict__,name)
示例4: __get__
# 需要导入模块: from Direct import ReductionHelpers [as 别名]
# 或者: from Direct.ReductionHelpers import gen_getter [as 别名]
def __get__(self,instance,type=None):
if instance is None:
return self
return prop_helpers.gen_getter(instance.__dict__,'use_hard_mask_only')