From dc267a72deb6eb7bdd1a4e0f9d5c5257275d3f4c Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Wed, 9 Feb 2022 19:55:11 +0200 Subject: [PATCH] Prospector fixes. Updated Prospector because it's failing again. Found new issues, addressed them. --- .pre-commit-config.yaml | 2 +- Documents/bin/git-namespace-backup | 32 ++++++++++++++++-------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4b4d8b7..0a204fa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -46,7 +46,7 @@ repos: --line-length=79 - repo: https://github.com/PyCQA/prospector - rev: 1.5.0.1 + rev: 1.6.0 hooks: - id: prospector exclude: *excluded_pythonscripts diff --git a/Documents/bin/git-namespace-backup b/Documents/bin/git-namespace-backup index d401704..8ad8e8b 100755 --- a/Documents/bin/git-namespace-backup +++ b/Documents/bin/git-namespace-backup @@ -32,11 +32,9 @@ def namespace_path(namespace): """ path = pathlib.Path(os.path.expanduser("~/Repositories/" + namespace)) if not path.exists(): - raise argparse.ArgumentTypeError("Path {} does not exit.".format(path)) + raise argparse.ArgumentTypeError(f"Path {path} does not exit.") if not path.is_dir(): - raise argparse.ArgumentTypeError( - "Path {} is not a directory.".format(path) - ) + raise argparse.ArgumentTypeError(f"Path {path} is not a directory.") return path @@ -55,8 +53,9 @@ if __name__ == "__main__": try: group = conn.groups.get(args.namespace.name) print( - "Using existing group id: {}, name: {}, path: {}.".format( - group.id, group.name, group.path + ( + f"Using existing group id: {group.id}," + f" name: {group.name}, path: {group.path}." ), file=sys.stderr, ) @@ -69,8 +68,9 @@ if __name__ == "__main__": } ) print( - "Created new group id: {}, name: {}, path: {}.".format( - group.id, group.name, group.path + ( + f"Created new group id: {group.id}," + f"name: {group.name}, path: {group.path}." ), file=sys.stderr, ) @@ -80,8 +80,9 @@ if __name__ == "__main__": f"{group.path}/{repo.name}" ) print( - "Using existing project id: {}, name: {}, path: {}.".format( # noqa: E501 - project.id, project.name, project.path + ( + f"Using existing project id: {project.id}," + f" name: {project.name}, path: {project.path}." ), file=sys.stderr, ) @@ -90,15 +91,16 @@ if __name__ == "__main__": {"name": repo.name, "namespace_id": group.id} ) print( - "Created new project id: {}, name: {}, path: {}.".format( - project.id, project.name, project.path + ( + f"Created new project id: {project.id}," + f"name: {project.name}, path: {project.path}." ), file=sys.stderr, ) with sh.pushd(repo): if "shore.co.il" in git.remote().splitlines(): print( - "Setting the remote URL in {}.".format(repo.name), + f"Setting the remote URL in {repo.name}.", file=sys.stderr, ) git.remote( @@ -106,12 +108,12 @@ if __name__ == "__main__": ) else: print( - "Adding remote in {}.".format(repo.name), + f"Adding remote in {repo.name}.", file=sys.stderr, ) git.remote("add", "shore.co.il", project.ssh_url_to_repo) print( - "Pushing to {}.".format(project.ssh_url_to_repo), + f"Pushing to {project.ssh_url_to_repo}.", file=sys.stderr, ) git.push("--all", "shore.co.il") -- GitLab