本文整理汇总了Python中twisted.python.reflect.accumulateClassList函数的典型用法代码示例。如果您正苦于以下问题:Python accumulateClassList函数的具体用法?Python accumulateClassList怎么用?Python accumulateClassList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了accumulateClassList函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: updateDestinguishedName
def updateDestinguishedName(self, subject):
DN = {}
parameters = []
reflect.accumulateClassList(self.__class__, 'optParameters', parameters)
for parameter in parameters:
key, short, val, doc, _type = util.padTo(5, parameter)
if self.opts[key]:
val = _type and _type(self.opts[key]) or self.opts[key]
elif self.defaults[key]:
val = _type and _type(self.defaults[key]) or self.defaults[key]
if key == 'years':
val = 60 * 60 * 24 * 365 * val
if val and key in self.x509names:
try:
setattr(subject, self.x509names.get(key), val.strip())
except crypto.Error, err:
raise SysExit("Setting value of '%s' failed: %s",
key, err[0][0][2])
DN[self.x509names.get(key)] = val.strip()
开发者ID:UfSoft,项目名称:afm-new,代码行数:19,代码来源:certs.py
示例17: 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:
if hasattr(step, 'command'):
cmdhash = {}
renderables = []
accumulateClassList(step.__class__, 'renderables', renderables)
for renderable in renderables:
setattr(step, renderable, step.build.render(getattr(step,
renderable)))
if isinstance(step.brDoStepIf, bool):
doStep = step.brDoStepIf
else:
doStep = step.brDoStepIf()
StripBuildrunnerIgnore(step)
cmdhash['name'] = step.name
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])
if hasattr(step, 'env'):
cmdhash['env'] = step.env
else:
cmdhash['env'] = {}
if hasattr(step, 'timeout'):
cmdhash['timeout'] = step.timeout
cmdhash['description'] = step.description
cmdhash['descriptionDone'] = step.descriptionDone
commands.append(cmdhash)
return commands
开发者ID:Acidburn0zzz,项目名称:build,代码行数:42,代码来源:builder_utils.py
示例18: _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)
for renderable in renderables:
setattr(self, renderable, self.build.render(getattr(self, renderable)))
doStep.addCallback(self._startStep_3)
return doStep
开发者ID:bobbyi,项目名称:buildbot,代码行数:21,代码来源:buildstep.py
示例19: _set_defaults
def _set_defaults(self, parser, subCommands):
parser_defaults = parser.defaults()
for name, sname, options, doc in subCommands:
if hasattr(options, 'optParameters'):
parameters = []
instance = options().__class__
reflect.accumulateClassList(instance, 'optParameters',
parameters)
for idx, parameter in enumerate(parameters):
long, short, default, doc, type = util.padTo(5, parameter)
_def = parser_defaults.get(long, default)
if parser.has_option(name, long):
_def = parser.get(name, long, _def)
if _def != default:
option = [long, short, type and type(_def) or _def, doc]
if type:
option.append(type)
parameters[idx] = option
# Override class defaults with config-file defaults
options.optParameters = parameters
if hasattr(options, "subCommands"):
self._set_defaults(parser, options.subCommands)
开发者ID:UfSoft,项目名称:SSHgD,代码行数:22,代码来源:service.py
示例20: startStep
def startStep(self, remote):
self.remote = remote
# create and start the step, noting that the name may be altered to
# ensure uniqueness
self.stepid, self.number, self.name = yield self.master.data.updates.addStep(
buildid=self.build.buildid,
name=util.ascii2unicode(self.name))
yield self.master.data.updates.startStep(self.stepid)
self.locks = yield self.build.render(self.locks)
# convert all locks into their real form
self.locks = [(self.build.builder.botmaster.getLockFromLockAccess(access), access)
for access in self.locks]
# then narrow WorkerLocks down to the worker that this build is being
# run on
self.locks = [(l.getLock(self.build.workerforbuilder.worker), la)
for l, la in self.locks]
for l, la in self.locks:
if l in self.build.locks:
log.msg("Hey, lock %s is claimed by both a Step (%s) and the"
" parent Build (%s)" % (l, self, self.build))
raise RuntimeError("lock claimed by both Step and Build")
try:
# set up locks
yield self.acquireLocks()
if self.stopped:
raise BuildStepCancelled
# check doStepIf
if isinstance(self.doStepIf, bool):
doStep = self.doStepIf
else:
doStep = yield self.doStepIf(self)
# render renderables in parallel
renderables = []
accumulateClassList(self.__class__, 'renderables', renderables)
def setRenderable(res, attr):
setattr(self, attr, res)
dl = []
for renderable in renderables:
d = self.build.render(getattr(self, renderable))
d.addCallback(setRenderable, renderable)
dl.append(d)
yield defer.gatherResults(dl)
self.rendered = True
# we describe ourselves only when renderables are interpolated
self.realUpdateSummary()
# run -- or skip -- the step
if doStep:
try:
self._running = True
self.results = yield self.run()
finally:
self._running = False
else:
self.results = SKIPPED
# NOTE: all of these `except` blocks must set self.results immediately!
except BuildStepCancelled:
self.results = CANCELLED
except BuildStepFailed:
self.results = FAILURE
except error.ConnectionLost:
self.results = RETRY
except Exception:
self.results = EXCEPTION
why = Failure()
log.err(why, "BuildStep.failed; traceback follows")
yield self.addLogWithFailure(why)
if self.stopped and self.results != RETRY:
# We handle this specially because we don't care about
# the return code of an interrupted command; we know
# that this should just be exception due to interrupt
# At the same time we must respect RETRY status because it's used
# to retry interrupted build due to some other issues for example
# due to worker lost
if self.results != CANCELLED:
self.results = EXCEPTION
# update the summary one last time, make sure that completes,
# and then don't update it any more.
self.realUpdateSummary()
yield self.realUpdateSummary.stop()
# determine whether we should hide this step
hidden = self.hideStepIf
if callable(hidden):
#.........这里部分代码省略.........
开发者ID:daymanc,项目名称:buildbot,代码行数:101,代码来源:buildstep.py
注:本文中的twisted.python.reflect.accumulateClassList函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论