osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-dev/+/42900?usp=email )
Change subject: src/grd: apply ruff formatter ......................................................................
src/grd: apply ruff formatter
The src/grd script is not part of the default "include" pattern as the script does not end in ".py" (it used to be a shell script earlier). Add it to the config explicitly and run "ruff format".
Change-Id: Id8da8e6b3325c8301276fd164ba218e8c5a95951 --- M .ruff.toml M src/grd 2 files changed, 35 insertions(+), 12 deletions(-)
Approvals: osmith: Looks good to me, approved daniel: Looks good to me, but someone else must approve Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve
diff --git a/.ruff.toml b/.ruff.toml index 6c2df50..c673c3a 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -6,6 +6,10 @@ "osmo-cn-latest/provision-hlr.py", "sysmobts-calib.py", ] +include = [ + "*.py", + "src/grd", +]
[lint] # E741: Ambiguous variable name: `l` diff --git a/src/grd b/src/grd index e149c6f..64de140 100755 --- a/src/grd +++ b/src/grd @@ -14,9 +14,12 @@
def get_topdir(): try: - return subprocess.run(["git", "rev-parse", "--show-toplevel"], - check=True, capture_output=True, - encoding="UTF-8").stdout.rstrip() + return subprocess.run( + ["git", "rev-parse", "--show-toplevel"], + check=True, + capture_output=True, + encoding="UTF-8", + ).stdout.rstrip() except subprocess.CalledProcessError: print("ERROR: not running inside a git repository") exit(1) @@ -71,8 +74,9 @@ except subprocess.CalledProcessError: exit(1)
+ def git_cherry_pick_fetch_head(): - cmd = ["git", "cherry-pick", "FETCH_HEAD"]; + cmd = ["git", "cherry-pick", "FETCH_HEAD"] print(f"+ {' '.join(cmd)}")
try: @@ -80,6 +84,7 @@ except subprocess.CalledProcessError: exit(1)
+ def git_checkout_fetch_head(patch_id, rev): cmd = ["git", "checkout", "-B", f"gerrit/{patch_id}_{rev}", "FETCH_HEAD"] print(f"+ {' '.join(cmd)}") @@ -92,14 +97,28 @@
desc = "git review download: fetch and checkout a patch from gerrit" parser = argparse.ArgumentParser(description=desc) -parser.add_argument("patch_id", type=int, - help="gerrit review ID") -parser.add_argument("-c", "--cherry-pick", action="store_true", - help="cherry-pick into current branch instead of " - "fetching into a branch") -parser.add_argument("-r", "--revision", type=int, - help="patchset revision, default is latest") -parser.add_argument("-v", "--verbose", action="store_true") +parser.add_argument( + "patch_id", + type=int, + help="gerrit review ID", +) +parser.add_argument( + "-c", + "--cherry-pick", + action="store_true", + help="cherry-pick into current branch instead of fetching into a branch", +) +parser.add_argument( + "-r", + "--revision", + type=int, + help="patchset revision, default is latest", +) +parser.add_argument( + "-v", + "--verbose", + action="store_true", +) args = parser.parse_args()
host, project = get_config()