本文整理汇总了Python中cola.settings.Settings.update方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.update方法的具体用法?Python Settings.update怎么用?Python Settings.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cola.settings.Settings
的用法示例。
在下文中一共展示了Settings.update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: JobDescription
# 需要导入模块: from cola.settings import Settings [as 别名]
# 或者: from cola.settings.Settings import update [as 别名]
class JobDescription(object):
def __init__(self, name, url_patterns, opener_cls, user_conf, starts,
unit_cls=None, login_hook=None, error_handler=None,
finish_callback=None, **kw):
self.name = name
if not JOB_NAME_RE.match(name):
raise ConfigurationError('Job name can only contain alphabet, number and space.')
self.uniq_name = self._get_uniq_name(self.name)
self.url_patterns = url_patterns
self.opener_cls = opener_cls
self.user_conf = user_conf
self.starts = starts
self.login_hook = login_hook
self.error_handler = error_handler
self.finish_callback = finish_callback
self.settings = Settings(user_conf=user_conf, **kw)
self.unit_cls = unit_cls or \
(Bundle if self.settings.job.mode == 'bundle' else Url)
def _get_uniq_name(self, name):
hash_val = hashlib.md5(name).hexdigest()[8:-8]
return base58_encode(int(hash_val, 16))
def add_urlpattern(self, url_pattern):
self.url_patterns += url_pattern
def update_settings(self, settings):
self.settings.update(settings)