本文整理汇总了Python中Task.Task.__setattr__方法的典型用法代码示例。如果您正苦于以下问题:Python Task.__setattr__方法的具体用法?Python Task.__setattr__怎么用?Python Task.__setattr__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task.Task
的用法示例。
在下文中一共展示了Task.__setattr__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __setattr__
# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import __setattr__ [as 别名]
def __setattr__(self, name, value):
if name in self._data_adverbs:
prefix = name.replace('data', '')
Task.__setattr__(self, prefix + 'name', value.name)
Task.__setattr__(self, prefix + 'class', value.klass)
Task.__setattr__(self, prefix + 'disk', value.disk)
Task.__setattr__(self, prefix + 'seq', value.seq)
elif name == 'intable':
Task.__setattr__(self, 'inext', value.name)
Task.__setattr__(self, 'invers', value.version)
else:
# We treat 'infile', 'outfile' and 'outprint' special.
# Instead of checking the length of the complete string,
# we only check the length of the final component of the
# pathname. The backend will split of the direcrory
# component and use that as an "area".
attr = self._findattr(name)
if attr in self._file_adverbs and type(value) == str and \
os.path.dirname(value):
if len(os.path.basename(value)) > self._strlen_dict[attr] - 2:
msg = "string '%s' is too long for attribute '%s'" \
% (value, attr)
raise ValueError, msg
self.__dict__[attr] = value
else:
Task.__setattr__(self, name, value)
pass
pass
return