From c457ca0570d863c7bce8c1c19b55a1d618b4cafa Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Tue, 23 Oct 2018 16:34:19 +0300 Subject: [PATCH] build_manifest.py: Use fstrings for string formatting --- gitlab/build_manifest.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/gitlab/build_manifest.py b/gitlab/build_manifest.py index bf92b8a1ee..71a5f57fcd 100755 --- a/gitlab/build_manifest.py +++ b/gitlab/build_manifest.py @@ -47,21 +47,23 @@ def find_repository_sha(module: str, branchname: str) -> Tuple[str, str]: # print("No 'namespace' in: %s - ignoring?" % project, file=sys.stderr) continue + id = project['id'] if project['namespace']['name'] in useful_namespaces: if project['namespace']['name'] == user_namespace: # If we have a branch with same name, use it. - for branch in request('%s/repository/branches' % project['id']): + for branch in request(f"{id}/repository/branches"): if branch['name'] == branchname: - print("%s/%s" % (project['namespace']['name'], branchname)) + name = project['namespace']['name'] + print(f"{name}/{branchname}") return 'user', branch['commit']['id'] else: - for branch in request('%s/repository/branches"' % project['id']): + for branch in request(f"{id}/repository/branches"): if branch['name'] == branchname: - print("gstreamer/%s" % (branchname)) + print(f"gstreamer/{branchname}") return 'gstreamer', branch['commit']['id'] - branch, = request('%s/repository/branches?search=master' % project['id']) + branch, = request(f"{id}/repository/branches?search=master") print('gstreamer/master') return 'gstreamer', branch.attributes['commit']['id'] @@ -83,14 +85,14 @@ if __name__ == "__main__": project_template: str = ' \n' user_remote: str = os.path.dirname(os.environ['CI_PROJECT_URL']) for module in GSTREAMER_MODULES: - print("Checking %s:" % module, end=' ') + print(f"Checking {module}:", end=' ') - remote = "origin" + remote = 'origin' revision = None if module == project_name: revision = os.environ['CI_COMMIT_SHA'] - remote = "user" - print("%s/%s" % (user_namespace, branchname)) + remote = 'user' + print(f"{user_namespace}/{branchname}") else: remote, revision = find_repository_sha(module, branchname)