add FA, ICN, ISC, LOG, PIE and PYI linting

This commit is contained in:
Jörg Thalheim
2024-09-02 15:41:20 +02:00
parent c43bde3254
commit 8fbc76ecac
9 changed files with 32 additions and 13 deletions

View File

@@ -36,7 +36,6 @@ def open_file(file_request: FileRequest) -> list[str] | None:
Abstract api method to open a file dialog window.
It must return the name of the selected file or None if no file was selected.
"""
pass
@dataclass

View File

@@ -13,6 +13,7 @@ import errno
import json
import logging
import socket
import types
from typing import Any
@@ -153,7 +154,12 @@ class QEMUMonitorProtocol:
# Implement context manager enter function.
return self
def __exit__(self, exc_type: Any, exc_value: Any, exc_traceback: Any) -> bool:
def __exit__(
self,
exc_type: type[BaseException] | None,
exc_value: BaseException | None,
traceback: types.TracebackType | None,
) -> None:
# Implement context manager exit function.
self.close()
return False

View File

@@ -44,7 +44,7 @@ class CommandFormatter(logging.Formatter):
colorcode = 0
if record.levelno == logging.ERROR:
colorcode = 31 # red
if record.levelno == logging.WARN:
if record.levelno == logging.WARNING:
colorcode = 33 # yellow
color, prefix_color, color_reset = "", "", ""
@@ -224,7 +224,6 @@ class Host:
cmdlog.info(
line, extra={"command_prefix": self.command_prefix}
)
pass
else:
cmdlog.error(
line, extra={"command_prefix": self.command_prefix}

View File

@@ -1,4 +1,4 @@
from typing import Any
import types
import pytest
from pytest import CaptureFixture
@@ -15,7 +15,12 @@ class CaptureOutput:
self.capsys.readouterr()
return self
def __exit__(self, exc_type: Any, exc_value: Any, exc_traceback: Any) -> None:
def __exit__(
self,
exc_type: type[BaseException] | None,
exc_value: BaseException | None,
traceback: types.TracebackType | None,
) -> None:
res = self.capsys.readouterr()
self.out = res.out
self.err = res.err

View File

@@ -267,7 +267,7 @@ class VMObject(GObject.Object):
def start(self) -> None:
if self.is_running():
log.warn("VM is already running. Ignoring start request")
log.warning("VM is already running. Ignoring start request")
self.emit("vm_status_changed", self)
return
log.debug(f"VM state dir {self.log_dir.name}")

View File

@@ -47,8 +47,6 @@ def listen(port: int, cert: str, uuid: str, state_file: str) -> bool:
client_socket.sendall(response.encode("utf-8"))
if pair_type == "native":
pass
# url = unquote(data_str.split()[1])
# rec_uuid = parse_qs(urlparse(url).query).get("uuid", [""])[0]
# rec_cert = parse_qs(urlparse(url).query).get("cert", [""])[0]