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


Python reflect.accumulateClassList函数代码示例

本文整理汇总了Python中twisted.python.reflect.accumulateClassList函数的典型用法代码示例。如果您正苦于以下问题:Python accumulateClassList函数的具体用法?Python accumulateClassList怎么用?Python accumulateClassList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getConfigDict

 def getConfigDict(self):
     compare_attrs = []
     reflect.accumulateClassList(
         self.__class__, 'compare_attrs', compare_attrs)
     return {k: getattr(self, k)
             for k in compare_attrs
             if hasattr(self, k) and k not in ("passwd", "password")}
开发者ID:ewongbb,项目名称:buildbot,代码行数:7,代码来源:__init__.py

示例2: getSpec

 def getSpec(self):
     spec_attributes = []
     accumulateClassList(self.__class__, 'spec_attributes', spec_attributes)
     ret = {}
     for i in spec_attributes:
         ret[i] = getattr(self, i)
     return ret
开发者ID:sigma-star,项目名称:buildbot,代码行数:7,代码来源:forcesched.py

示例3: _gather_parameters

    def _gather_parameters(self):
        """
        Gather options which take a value.
        """
        longOpt, shortOpt = [], ''
        docs, settings, synonyms, dispatch = {}, {}, {}, {}

        parameters = []

        reflect.accumulateClassList(self.__class__, 'optParameters',
                                    parameters)

        synonyms = {}

        for parameter in parameters:
            long, short, default, doc, paramType = util.padTo(5, parameter)
            if not long:
                raise ValueError("A parameter cannot be without a name.")

            docs[long] = doc
            settings[long] = default
            if short:
                shortOpt = shortOpt + short + ':'
                synonyms[short] = long
            longOpt.append(long + '=')
            synonyms[long] = long
            if paramType is not None:
                dispatch[long] = CoerceParameter(self, paramType)
            else:
                dispatch[long] = CoerceParameter(self, str)

        return longOpt, shortOpt, docs, settings, synonyms, dispatch
开发者ID:12019,项目名称:OpenWrt_Luci_Lua,代码行数:32,代码来源:usage.py

示例4: _startStep_2

    def _startStep_2(self, res):
        if self.stopped:
            self.finished(EXCEPTION)
            return

        if self.progress:
            self.progress.start()

        if isinstance(self.doStepIf, bool):
            doStep = defer.succeed(self.doStepIf)
        else:
            doStep = defer.maybeDeferred(self.doStepIf, self)

        renderables = []
        accumulateClassList(self.__class__, 'renderables', renderables)

        def setRenderable(res, attr):
            setattr(self, attr, res)

        dl = [ doStep ]
        for renderable in renderables:
            d = self.build.render(getattr(self, renderable))
            d.addCallback(setRenderable, renderable)
            dl.append(d)
        dl = defer.gatherResults(dl)

        dl.addCallback(self._startStep_3)
        return dl
开发者ID:Sleft,项目名称:buildbot,代码行数:28,代码来源:buildstep.py

示例5: reconfigServiceWithSibling

 def reconfigServiceWithSibling(self, sibling):
     # only reconfigure if sibling is configured differently.
     # sibling == self is using ComparableMixin's implementation
     # only compare compare_attrs
     if self.configured and sibling == self:
         defer.returnValue(None)
     self.configured = True
     # render renderables in parallel
     # Properties import to resolve cyclic import issue
     from buildbot.process.properties import Properties
     p = Properties()
     p.master = self.master
     # render renderables in parallel
     secrets = []
     kwargs = {}
     accumulateClassList(self.__class__, 'secrets', secrets)
     for k, v in sibling._config_kwargs.items():
         if k in secrets:
             value = yield p.render(v)
             setattr(self, k, value)
             kwargs.update({k: value})
         else:
             kwargs.update({k: v})
     d = yield self.reconfigService(*sibling._config_args,
                                    **sibling._config_kwargs)
     defer.returnValue(d)
开发者ID:Cray,项目名称:buildbot,代码行数:26,代码来源:service.py

示例6: reconfigServiceWithSibling

    def reconfigServiceWithSibling(self, sibling):
        # only reconfigure if sibling is configured differently.
        # sibling == self is using ComparableMixin's implementation
        # only compare compare_attrs
        if self.configured and sibling == self:
            return None
        self.configured = True
        # render renderables in parallel
        # Properties import to resolve cyclic import issue
        from buildbot.process.properties import Properties
        p = Properties()
        p.master = self.master
        # render renderables in parallel
        secrets = []
        kwargs = {}
        accumulateClassList(self.__class__, 'secrets', secrets)
        for k, v in sibling._config_kwargs.items():
            if k in secrets:
                # for non reconfigurable services, we force the attribute
                v = yield p.render(v)
                setattr(sibling, k, v)
                setattr(self, k, v)
            kwargs[k] = v

        d = yield self.reconfigService(*sibling._config_args,
                                       **kwargs)
        return d
开发者ID:ewongbb,项目名称:buildbot,代码行数:27,代码来源:service.py

示例7: _gather_flags

    def _gather_flags(self):
        """
        Gather up boolean (flag) options.
        """

        longOpt, shortOpt = [], ''
        docs, settings, synonyms, dispatch = {}, {}, {}, {}

        flags = []
        reflect.accumulateClassList(self.__class__, 'optFlags', flags)

        for flag in flags:
            long, short, doc = util.padTo(3, flag)
            if not long:
                raise ValueError("A flag cannot be without a name.")

            docs[long] = doc
            settings[long] = 0
            if short:
                shortOpt = shortOpt + short
                synonyms[short] = long
            longOpt.append(long)
            synonyms[long] = long
            dispatch[long] = self._generic_flag

        return longOpt, shortOpt, docs, settings, synonyms, dispatch
开发者ID:Almad,项目名称:twisted,代码行数:26,代码来源:usage.py

示例8: __hash__

    def __hash__(self):
        compare_attrs = []
        reflect.accumulateClassList(
            self.__class__, 'compare_attrs', compare_attrs)

        alist = [self.__class__] + \
                [getattr(self, name, self._None) for name in compare_attrs]
        return hash(tuple(map(str, alist)))
开发者ID:ewongbb,项目名称:buildbot,代码行数:8,代码来源:__init__.py

示例9: __init__

 def __init__(self, name, **kw):
     SchemaNode.__init__(self, name)
     self.elements = list()
     reflect.accumulateClassList(reflect.getClass(self),
                                 'elements', self.elements)
     self.attributes = list()
     reflect.accumulateClassList(reflect.getClass(self),
                                 'attributes', self.attributes)
     self.__dict__.update(kw)
开发者ID:jrydberg,项目名称:edgy,代码行数:9,代码来源:schema.py

示例10: _absorbFlags

 def _absorbFlags(self):
     twistd_flags = []
     reflect.accumulateClassList(self.__class__, 'optFlags',
                                 twistd_flags)
     for flag in twistd_flags:
         key = flag[0].replace('-', '_')
         if hasattr(FLAGS, key):
             continue
         flags.DEFINE_boolean(key, None, str(flag[-1]))
开发者ID:anotherjesse,项目名称:nova,代码行数:9,代码来源:twistd.py

示例11: GetCommands

def GetCommands(steplist):
  """Extract shell commands from a step.

  Take the BuildSteps from MockBuild() and, if they inherit from ShellCommand,
  renders any renderables and extracts out the actual shell command to be
  executed. Returns a list of command hashes.
  """
  commands = []
  for step in steplist:
    cmdhash = {}
    StripBuildrunnerIgnore(step)
    cmdhash['name'] = step.name
    cmdhash['doStep'] = None
    cmdhash['stepclass'] = '%s.%s' % (step.__class__.__module__,
                                      step.__class__.__name__)
    if hasattr(step, 'command'):
      # None signifies this is not a buildrunner-added step.
      if step.brDoStepIf is None:
        doStep = step.brDoStepIf
      # doStep may modify build properties, so it must run before rendering.
      elif isinstance(step.brDoStepIf, bool):
        doStep = step.brDoStepIf
      else:
        doStep = step.brDoStepIf(step)

      renderables = []
      accumulateClassList(step.__class__, 'renderables', renderables)

      for renderable in renderables:
        setattr(step, renderable, step.build.render(getattr(step,
                renderable)))

      cmdhash['doStep'] = doStep
      cmdhash['command'] = step.command
      cmdhash['quoted_command'] = shell_quote(step.command)
      cmdhash['workdir'] = step.workdir
      cmdhash['quoted_workdir'] = shell_quote([step.workdir])
      cmdhash['haltOnFailure'] = step.haltOnFailure
      if hasattr(step, 'env'):
        cmdhash['env'] = step.env
      else:
        cmdhash['env'] = {}
      if hasattr(step, 'timeout'):
        cmdhash['timeout'] = step.timeout
      if hasattr(step, 'maxTime'):
        cmdhash['maxTime'] = step.maxTime

      cmdhash['description'] = step.description
      cmdhash['descriptionDone'] = step.descriptionDone
    commands.append(cmdhash)
  return commands
开发者ID:alexmos17,项目名称:build_internal,代码行数:51,代码来源:builder_utils.py

示例12: _absorbParameters

 def _absorbParameters(self):
     twistd_params = []
     reflect.accumulateClassList(self.__class__, 'optParameters',
                                 twistd_params)
     for param in twistd_params:
         key = param[0].replace('-', '_')
         if hasattr(FLAGS, key):
             continue
         if len(param) > 4:
             flags.DEFINE(FlagParser(param[4]),
                          key, param[2], str(param[3]),
                          serializer=gflags.ArgumentSerializer())
         else:
             flags.DEFINE_string(key, param[2], str(param[3]))
开发者ID:anotherjesse,项目名称:nova,代码行数:14,代码来源:twistd.py

示例13: _getPreprocessors

def _getPreprocessors(inst):
    """
    Accumulate elements from the sequences bound at the C{preprocessors}
    attribute on all classes in the inheritance hierarchy of the class of
    C{inst}.  A C{preprocessors} attribute on the given instance overrides
    all preprocessors from the class inheritance hierarchy.
    """
    if 'preprocessors' in vars(inst):
        return inst.preprocessors
    preprocessors = []
    accumulateClassList(
        inst.__class__,
        'preprocessors',
        preprocessors)
    return preprocessors
开发者ID:UstadMobile,项目名称:exelearning-ustadmobile-work,代码行数:15,代码来源:rend.py

示例14: getRenderingFor

    def getRenderingFor(self, props):
        renderables = []
        accumulateClassList(self.__class__, 'renderables', renderables)

        def setRenderable(res, attr):
            setattr(self, attr, res)

        dl = []
        for renderable in renderables:
            d = props.render(getattr(self, renderable))
            d.addCallback(setRenderable, renderable)
            dl.append(d)
        dl = defer.gatherResults(dl)

        dl.addCallback(self.make_command)
        return dl
开发者ID:asford,项目名称:rosetta_buildbot,代码行数:16,代码来源:build_support.py

示例15: _cmp_common

    def _cmp_common(self, them):
        if type(self) != type(them):
            return (False, None, None)

        if self.__class__ != them.__class__:
            return (False, None, None)

        compare_attrs = []
        reflect.accumulateClassList(
            self.__class__, 'compare_attrs', compare_attrs)

        self_list = [getattr(self, name, self._None)
                     for name in compare_attrs]
        them_list = [getattr(them, name, self._None)
                     for name in compare_attrs]
        return (True, self_list, them_list)
开发者ID:ewongbb,项目名称:buildbot,代码行数:16,代码来源:__init__.py


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