From efe0ef483038c9ce45f2be01e1cf52e5420e932f Mon Sep 17 00:00:00 2001 From: Matt Clarkson Date: Thu, 10 Oct 2024 16:47:46 +0100 Subject: [PATCH 1/3] chore: run `buildifier` --- bazel/labgrid/strategy/BUILD.bazel | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bazel/labgrid/strategy/BUILD.bazel b/bazel/labgrid/strategy/BUILD.bazel index 61fa29fc..43ba4cb6 100644 --- a/bazel/labgrid/strategy/BUILD.bazel +++ b/bazel/labgrid/strategy/BUILD.bazel @@ -3,13 +3,13 @@ load("@rules_python//python:defs.bzl", "py_library", "py_test") py_library( name = "strategy", srcs = [ - "qemu/strategy.py", "__init__.py", + "qemu/strategy.py", ], + visibility = ["//visibility:public"], deps = [ - "//labgrid:pkg" + "//labgrid:pkg", ], - visibility = ["//visibility:public"], ) py_test( -- GitLab From 555c93ab2bf7dd624cc8f75cc7ec730c9599bd66 Mon Sep 17 00:00:00 2001 From: Matt Clarkson Date: Thu, 10 Oct 2024 16:48:00 +0100 Subject: [PATCH 2/3] chore: sort Python imports --- bazel/labgrid/strategy/qemu/strategy.py | 4 ++-- qemu/seed/image/main.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bazel/labgrid/strategy/qemu/strategy.py b/bazel/labgrid/strategy/qemu/strategy.py index ef4be442..c910788a 100644 --- a/bazel/labgrid/strategy/qemu/strategy.py +++ b/bazel/labgrid/strategy/qemu/strategy.py @@ -2,11 +2,11 @@ import enum import attr -from labgrid.step import step -from labgrid.strategy import Strategy, StrategyError from labgrid.driver.qemudriver import QEMUDriver from labgrid.driver.shelldriver import ShellDriver from labgrid.factory import target_factory +from labgrid.step import step +from labgrid.strategy import Strategy, StrategyError class Status(enum.Enum): diff --git a/qemu/seed/image/main.py b/qemu/seed/image/main.py index 9ea9fe0d..472a70fc 100755 --- a/qemu/seed/image/main.py +++ b/qemu/seed/image/main.py @@ -1,7 +1,8 @@ -import paramiko +import io from argparse import ArgumentParser, ArgumentTypeError + +import paramiko import pycdlib -import io def arguments(prsr: ArgumentParser) -> None: -- GitLab From 5ff1a30ec5d71c2d4817b25e4f42c5aa03a23354 Mon Sep 17 00:00:00 2001 From: Matt Clarkson Date: Thu, 10 Oct 2024 16:48:28 +0100 Subject: [PATCH 3/3] chore: run `black` --- bazel/labgrid/strategy/qemu/strategy.py | 9 ++------- labgrid/executor/executor.py | 3 +++ labgrid/manager/passthrough.py | 3 +-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/bazel/labgrid/strategy/qemu/strategy.py b/bazel/labgrid/strategy/qemu/strategy.py index c910788a..28b071fa 100644 --- a/bazel/labgrid/strategy/qemu/strategy.py +++ b/bazel/labgrid/strategy/qemu/strategy.py @@ -17,10 +17,7 @@ class Status(enum.Enum): @target_factory.reg_driver class QEMUStrategy(Strategy): - bindings = { - "qemu": QEMUDriver, - "shell": ShellDriver - } + bindings = {"qemu": QEMUDriver, "shell": ShellDriver} status = attr.ib(default=Status.unknown) @@ -49,7 +46,5 @@ class QEMUStrategy(Strategy): # Wait until booted self.target.activate(self.shell) else: - raise StrategyError( - f"no transition found from {self.status} to {status}" - ) + raise StrategyError(f"no transition found from {self.status} to {status}") self.status = status diff --git a/labgrid/executor/executor.py b/labgrid/executor/executor.py index b5a0738b..9cc59d60 100644 --- a/labgrid/executor/executor.py +++ b/labgrid/executor/executor.py @@ -14,6 +14,7 @@ from subprocess import CalledProcessError, run from sys import argv, stderr from python.runfiles import Runfiles + from bazel.labgrid.executor.manager import Manager @@ -99,6 +100,7 @@ def main(exe: Path, *args: str) -> int: return 0 + def resolve_runfile(value): r = Runfiles.Create() location = r.Rlocation(value) @@ -106,6 +108,7 @@ def resolve_runfile(value): return location return value + def entry(): exit(main(Path(argv[0]), *argv[1:])) diff --git a/labgrid/manager/passthrough.py b/labgrid/manager/passthrough.py index 4f0fe402..cf7bb4c8 100644 --- a/labgrid/manager/passthrough.py +++ b/labgrid/manager/passthrough.py @@ -3,7 +3,6 @@ from __future__ import annotations from contextlib import contextmanager from typing import Iterator - from bazel.labgrid.executor.manager import Data @@ -12,4 +11,4 @@ def manager() -> Iterator[Data]: """ A passthrough LabGrid context manager """ - yield Data(env = {}) + yield Data(env={}) -- GitLab