osmith has uploaded this change for review.

View Change

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(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-dev refs/changes/00/42900/1
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()

To view, visit change 42900. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-Change-Id: Id8da8e6b3325c8301276fd164ba218e8c5a95951
Gerrit-Change-Number: 42900
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>