diff --git a/scripts/.sourcery.yaml b/scripts/.sourcery.yaml index 924b8c828376b0acd2c2669296d9bf951d65688f..a03b9ac867099504acb1eeea482e92697fe62530 100644 --- a/scripts/.sourcery.yaml +++ b/scripts/.sourcery.yaml @@ -19,7 +19,6 @@ rule_settings: - assign-if-exp - inline-immediately-returned-variable - remove-redundant-if - - list-comprehension - switch - dict-literal - low-code-quality diff --git a/scripts/changelog_generator.py b/scripts/changelog_generator.py index 23a386da4402dbb7e84127648ad9c9e177503b4a..72bf8f3e1409b4dbc5ea69ac0d2aea52fe8ef6c1 100755 --- a/scripts/changelog_generator.py +++ b/scripts/changelog_generator.py @@ -240,14 +240,10 @@ def main(args): logging.debug(options) gitlab = gl.Gitlab(options.gitlab_url, private_token=options.token) - projects = [] - for project in options.project: - projects.append(Project(gitlab.projects.get(project))) - - releases = [] - for t in projects[0].project.tags.list(search=options.branch): - releases.append(Release(Tag(t))) - + projects = [Project(gitlab.projects.get(project)) for project in options.project] + releases = [ + Release(Tag(t)) for t in projects[0].project.tags.list(search=options.branch) + ] # Add dummy release with date today for new unstaged commits releases.append( Release( diff --git a/scripts/generate_alphaplan_fwr_file.py b/scripts/generate_alphaplan_fwr_file.py index 301383c0075f617ea6f4fe59e4a69b6365f39f25..96af50c0317d4f68aeeed73d368cad61d562d24a 100755 --- a/scripts/generate_alphaplan_fwr_file.py +++ b/scripts/generate_alphaplan_fwr_file.py @@ -160,19 +160,17 @@ def generate_fwr_articles( ] if subarticles_uboot: - stueckliste_uboot = [] - for key in subarticles_uboot: - stueckliste_uboot.append( - generate_ap_subarticle( - files, - key, - machine, - machine_ap, - release_name_ap, - md5sums, - ) + stueckliste_uboot = [ + generate_ap_subarticle( + files, + key, + machine, + machine_ap, + release_name_ap, + md5sums, ) - + for key in subarticles_uboot + ] # At the moment there are no attributes specified for uboot FWR attribute_uboot = [None, None, "UBOOT"] data_uboot = new_ap_article( diff --git a/scripts/get_pipeline_jobs.py b/scripts/get_pipeline_jobs.py index 05a036590d2bcfb98ccb0a9666f4be069f9a3bde..acc3518a698dd84f873e0de08cdb0dbfc51bb028 100755 --- a/scripts/get_pipeline_jobs.py +++ b/scripts/get_pipeline_jobs.py @@ -44,10 +44,8 @@ def get_pipeline_jobs(gitlab, project, pipeline, name=None, stage=None): gl_project = gitlab.projects.get(project) pipeline_jobs = get_pipeline_pipelinejobs(gitlab, project, pipeline, name, stage) - jobs = [] # Project Jobs from Pipeline Job - for job in pipeline_jobs: - jobs.append(gl_project.jobs.get(job.id)) + jobs = [gl_project.jobs.get(job.id) for job in pipeline_jobs] return jobs diff --git a/scripts/gitlab_backup.py b/scripts/gitlab_backup.py index bb102927855ee3e4d7a783b040148ecb7bc318ab..0c148d712cffe9dbc9b619820051e79556565612 100755 --- a/scripts/gitlab_backup.py +++ b/scripts/gitlab_backup.py @@ -190,10 +190,10 @@ class MergeRequest: def get_projects_from_group(gitlab, base_group): """Recurse through all subgroups and create a flat list of all projects""" - p_list = [] - for group_project in base_group.projects.list(retry_transient_errors=True): - p_list.append(gitlab.projects.get(group_project.id)) - + p_list = [ + gitlab.projects.get(group_project.id) + for group_project in base_group.projects.list(retry_transient_errors=True) + ] for subgroup in base_group.subgroups.list(retry_transient_errors=True): group = gitlab.groups.get(subgroup.id) p_list += get_projects_from_group(gitlab, group) diff --git a/scripts/lava_create_testreport.py b/scripts/lava_create_testreport.py index 7995889d7eb2be1a71f85bd75d02ef26f1c0be13..ad7f0e6f28ef0cb527539208e3f3c48a0b1a8d9d 100755 --- a/scripts/lava_create_testreport.py +++ b/scripts/lava_create_testreport.py @@ -35,9 +35,7 @@ class TestCollection: if machine not in self.tests.keys(): return "" tests = self.tests[machine] - out = [] - for t in tests: - out.append("{:.2f}".format(float(t.measurement))) + out = ["{:.2f}".format(float(t.measurement)) for t in tests] if not out: return None return "/".join(out) @@ -80,13 +78,11 @@ class TestCollection: all_tests += suite.tests tests = {} - test_collections = [] for test in all_tests: if test.test_case_id not in tests.keys(): tests[test.test_case_id] = [] tests[test.test_case_id].append(test) - for k, v in tests.items(): - test_collections.append(TestCollection(k, v)) + test_collections = [TestCollection(k, v) for k, v in tests.items()] return test_collections def __str__(self): @@ -162,14 +158,11 @@ class SuiteCollection: continue all_suites += job.suites suites = {} - suite_collections = [] for suite in all_suites: if suite.name not in suites.keys(): suites[suite.name] = [] suites[suite.name].append(suite) - for k, v in suites.items(): - suite_collections.append(SuiteCollection(k, v)) - + suite_collections = [SuiteCollection(k, v) for k, v in suites.items()] suite_collections.sort() return suite_collections @@ -206,10 +199,7 @@ def lava_create_testreport(jobids, lava=None): lava_tags = LavaTag.taglist_from_lava(lava) lava_devices = LavaDevice.devicelist_from_lava(lava, lava_tags) - lava_jobs = [] - for jobid in jobids: - lava_jobs.append(LavaJob(lava, jobid, lava_devices)) - + lava_jobs = [LavaJob(lava, jobid, lava_devices) for jobid in jobids] suite_collections = SuiteCollection.collections_from_jobs(lava_jobs) all_machines = SuiteCollection.all_machines(suite_collections)