def gen_data_from_z(z):
"""
Given the z axis values (2d list of failures) generate data that would have
given us this z value.
:param z: a list of lists of failures.
:return: the data that would have given this z value, the z value, the x value
(stages) and the y value (projects).
"""
data = []
projects_len = len(z)
stages_len = 0 if projects_len == 0 else len(z[0])
projects = [uuid4() for _ in xrange(projects_len)]
stages = [uuid4() for _ in xrange(stages_len)]
for pidx, project in enumerate(projects):
for sidx, stage in enumerate(stages):
failures = z[pidx][sidx]
repo = strings.example()
for _ in xrange(failures):
data.append(MockPipelineRun(stage_failed=stage, project=project, repository=repo))
return data, z, stages, projects
评论列表
文章目录