本文整理汇总了Python中sherpa.utils.NoNewAttributesAfterInit.__setattr__方法的典型用法代码示例。如果您正苦于以下问题:Python NoNewAttributesAfterInit.__setattr__方法的具体用法?Python NoNewAttributesAfterInit.__setattr__怎么用?Python NoNewAttributesAfterInit.__setattr__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sherpa.utils.NoNewAttributesAfterInit
的用法示例。
在下文中一共展示了NoNewAttributesAfterInit.__setattr__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __setattr__
# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __setattr__ [as 别名]
def __setattr__(self, name, val):
par = getattr(self, name.lower(), None)
if (par is not None) and isinstance(par, Parameter):
par.val = val
else:
NoNewAttributesAfterInit.__setattr__(self, name, val)
示例2: __setattr__
# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __setattr__ [as 别名]
def __setattr__(self, name, val):
rmf = None
try:
rmf = RMF1D.__getattribute__(self, '_rmf')
except:
pass
if rmf is not None and hasattr(rmf, name):
DataRMF.__setattr__(rmf, name, val)
else:
NoNewAttributesAfterInit.__setattr__(self, name, val)
示例3: __setattr__
# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __setattr__ [as 别名]
def __setattr__(self, name, val):
par = getattr(self, name.lower(), None)
if (par is not None) and isinstance(par, Parameter):
# When setting an attribute that is a Parameter, set the parameter's
# value instead.
par.val = val
else:
NoNewAttributesAfterInit.__setattr__(self, name, val)
if isinstance(val, Parameter):
# Update parameter index
self._par_index[val.name.lower()] = val
if val.aliases:
# Update index of aliases, if necessary
for alias in val.aliases:
self._par_index[alias] = val
示例4: __setattr__
# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __setattr__ [as 别名]
def __setattr__(self, name, val):
if name in self.__dict__.get('config', ()):
self.config[name] = val
else:
NoNewAttributesAfterInit.__setattr__(self, name, val)