当前位置: 首页>>代码示例>>Python>>正文


Python ConfigurationManager.getDefaultedConfigOptions方法代码示例

本文整理汇总了Python中socorro.lib.ConfigurationManager.getDefaultedConfigOptions方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigurationManager.getDefaultedConfigOptions方法的具体用法?Python ConfigurationManager.getDefaultedConfigOptions怎么用?Python ConfigurationManager.getDefaultedConfigOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在socorro.lib.ConfigurationManager的用法示例。


在下文中一共展示了ConfigurationManager.getDefaultedConfigOptions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: newConfiguration

# 需要导入模块: from socorro.lib import ConfigurationManager [as 别名]
# 或者: from socorro.lib.ConfigurationManager import getDefaultedConfigOptions [as 别名]
def newConfiguration(**kwargs):
  """ This used as an alternate constructor for class Config so that applications can
      be lax in defining all the required paramters in the right order.
  """
  kw = socorro_config.getDefaultedConfigOptions()
  kw.update(kwargs)
  return DynamicConfig(**kw)
开发者ID:Earth4,项目名称:socorro,代码行数:9,代码来源:dynamicConfigurationManager.py

示例2: __init__

# 需要导入模块: from socorro.lib import ConfigurationManager [as 别名]
# 或者: from socorro.lib.ConfigurationManager import getDefaultedConfigOptions [as 别名]
  def __init__(self,*args,**kwargs):
    """
    Passes appropriate kwargs to Config, pays local attention to these keys:
    updateInterval: default: '0' format: 'dd:hh:mm:ss', leading parts optional. Must be >= 0 seconds.
    updateFunction: default: noop(). Takes self as argument. Behavior: Updates default values in argument
    reEvaluateFunction: default: noop(). Takes self as argument. Behavior: Mutates values in argument
    signalNumber: default: SIGALRM (14). If 0, then signals will not be handled.
      Instances that share the same signalNumber will all be update()-ed at every signal.

    self.internal.updateFunction may be set after construction if desired: Avoids double-work at construction
    self.internal.reEvalutateFunction may be set after construction if desired, but this is not recommended.
    """
    skwargs = dict([(x,kwargs[x]) for x in socorro_config.getDefaultedConfigOptions().keys() if x in kwargs])
    for i in range(len(args)):
      skwargs[socorro_config.namedConfigOptions[i]] = args[i]
    super(DynamicConfig,self).__init__(**skwargs)
    self.internal.updateFunction = kwargs.get('updateFunction',noop)
    self.internal.reEvaluateFunction = kwargs.get('reEvaluateFunction',noop)
    self.internal.signalNumber = kwargs.get('signalNumber',14)
    self.internal.nextUpdate = None
    updateInterval = kwargs.get('updateInterval','0:0:0:0')
    self.internal.updateDelta = socorro_config.timeDeltaConverter(updateInterval)
    if self.internal.updateDelta:
      if self.internal.updateDelta < datetime.timedelta(0):
        raise ValueError("updateInterval must be non-negative, but %s"%self.internal.updateDelta)
      self.internal.nextUpdate = utc_now() + self.internal.updateDelta

    # finally: make sure we are current
    if self.internal.signalNumber:
      priorSignal = signal.signal(self.internal.signalNumber,DynamicConfig.handleAlarm)
    self.doUpdate()
    DynamicConfig.instances[id(self)] = self
开发者ID:Earth4,项目名称:socorro,代码行数:34,代码来源:dynamicConfigurationManager.py


注:本文中的socorro.lib.ConfigurationManager.getDefaultedConfigOptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。