本文整理汇总了Python中twitter.pants.goal.Phase.all方法的典型用法代码示例。如果您正苦于以下问题:Python Phase.all方法的具体用法?Python Phase.all怎么用?Python Phase.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twitter.pants.goal.Phase
的用法示例。
在下文中一共展示了Phase.all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: graph
# 需要导入模块: from twitter.pants.goal import Phase [as 别名]
# 或者: from twitter.pants.goal.Phase import all [as 别名]
def graph():
def get_cluster_name(phase):
return 'cluster_%s' % phase.name.replace('-', '_')
def get_goal_name(phase, goal):
name = '%s_%s' % (phase.name, goal.name)
return name.replace('-', '_')
phase_by_phasename = {}
for phase, goals in Phase.all():
phase_by_phasename[phase.name] = phase
yield '\n'.join([
'digraph G {',
' rankdir=LR;',
' graph [compound=true];',
])
for phase, installed_goals in Phase.all():
yield '\n'.join([
' subgraph %s {' % get_cluster_name(phase),
' node [style=filled];',
' color = blue;',
' label = "%s";' % phase.name,
])
for installed_goal in installed_goals:
yield ' %s [label="%s"];' % (get_goal_name(phase, installed_goal),
installed_goal.name)
yield ' }'
edges = set()
for phase, installed_goals in Phase.all():
for installed_goal in installed_goals:
for dependency in installed_goal.dependencies:
tail_goal = phase_by_phasename.get(dependency.name).goals()[-1]
edge = 'ltail=%s lhead=%s' % (get_cluster_name(phase),
get_cluster_name(Phase.of(tail_goal)))
if edge not in edges:
yield ' %s -> %s [%s];' % (get_goal_name(phase, installed_goal),
get_goal_name(Phase.of(tail_goal), tail_goal),
edge)
edges.add(edge)
yield '}'
示例2: execute
# 需要导入模块: from twitter.pants.goal import Phase [as 别名]
# 或者: from twitter.pants.goal.Phase import all [as 别名]
def execute(self, targets):
print('Installed goals:')
documented_rows = []
undocumented = []
max_width = 0
for phase, _ in Phase.all():
if phase.description:
documented_rows.append((phase.name, phase.description))
max_width = max(max_width, len(phase.name))
elif self.context.options.goal_list_all:
undocumented.append(phase.name)
for name, description in documented_rows:
print(' %s: %s' % (name.rjust(max_width), description))
if undocumented:
print('\nUndocumented goals:\n %s' % ' '.join(undocumented))
示例3: report
# 需要导入模块: from twitter.pants.goal import Phase [as 别名]
# 或者: from twitter.pants.goal.Phase import all [as 别名]
def report():
yield 'Installed goals:'
documented_rows = []
undocumented = []
max_width = 0
for phase, _ in Phase.all():
if phase.description:
documented_rows.append((phase.name, phase.description))
max_width = max(max_width, len(phase.name))
elif self.context.options.goal_list_all:
undocumented.append(phase.name)
for name, description in documented_rows:
yield ' %s: %s' % (name.rjust(max_width), description)
if undocumented:
yield ''
yield 'Undocumented goals:'
yield ' %s' % ' '.join(undocumented)
示例4: console_output
# 需要导入模块: from twitter.pants.goal import Phase [as 别名]
# 或者: from twitter.pants.goal.Phase import all [as 别名]
def console_output(self, targets):
yield "Installed goals:"
documented_rows = []
undocumented = []
max_width = 0
for phase, _ in Phase.all():
if phase.description:
documented_rows.append((phase.name, phase.description))
max_width = max(max_width, len(phase.name))
elif self.context.options.goal_list_all:
undocumented.append(phase.name)
for name, description in documented_rows:
yield " %s: %s" % (name.rjust(max_width), description)
if undocumented:
yield ""
yield "Undocumented goals:"
yield " %s" % " ".join(undocumented)