From ca65b2256b2018bf1ed57d69a4425f8939e3db26 Mon Sep 17 00:00:00 2001 From: gmuloc Date: Thu, 6 Jul 2023 18:10:54 +0200 Subject: [PATCH] CI: They be linting --- anta/cli/exec/utils.py | 8 ++++---- anta/inventory/__init__.py | 2 +- anta/models.py | 1 - 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/anta/cli/exec/utils.py b/anta/cli/exec/utils.py index 6d0afe29b..edf352459 100644 --- a/anta/cli/exec/utils.py +++ b/anta/cli/exec/utils.py @@ -66,10 +66,10 @@ async def collect(dev: AntaDevice, command: str, outformat: Literal["json", "tex logger.error(f"Could not collect commands on device {dev.name}: {exc_to_str(c.failed)}") return if c.ofmt == "json": - outfile = outdir / (command + ".json") + outfile = outdir / f"{command}.json" content = json.dumps(c.json_output, indent=2) elif c.ofmt == "text": - outfile = outdir / (command + ".log") + outfile = outdir / f"{command}.log" content = c.text_output with outfile.open(mode="w", encoding="UTF-8") as f: f.write(content) @@ -88,7 +88,7 @@ async def collect(dev: AntaDevice, command: str, outformat: Literal["json", "tex if __DEBUG__: logger.exception(message, exc_info=r) else: - logger.error(message + f": {exc_to_str(r)}") + logger.error(f"{message}: {exc_to_str(r)}") async def collect_scheduled_show_tech(inv: AntaInventory, root_dir: Path, configure: bool, tags: Optional[List[str]] = None, latest: Optional[int] = None) -> None: @@ -150,7 +150,7 @@ async def collect(device: AntaDevice) -> None: if __DEBUG__: logger.exception(message) else: - logger.error(message + f": {exc_to_str(e)}") + logger.error(f"{message}: {exc_to_str(e)}") logger.info("Connecting to devices...") await inv.connect_inventory() diff --git a/anta/inventory/__init__.py b/anta/inventory/__init__.py index dd414dcdb..617651bb6 100644 --- a/anta/inventory/__init__.py +++ b/anta/inventory/__init__.py @@ -170,4 +170,4 @@ async def connect_inventory(self) -> None: if __DEBUG__: logger.exception(message, exc_info=r) else: - logger.error(message + f": {exc_to_str(r)}") + logger.error(f"{message}: {exc_to_str(r)}") diff --git a/anta/models.py b/anta/models.py index 308f02230..14b34513f 100644 --- a/anta/models.py +++ b/anta/models.py @@ -305,7 +305,6 @@ def update_progress(self) -> None: nrfu_task: TaskID = cast(TaskID, 0) self.progress.update(nrfu_task, advance=1) - @abstractmethod def test(self) -> Coroutine[Any, Any, TestResult]: """