add FA, ICN, ISC, LOG, PIE and PYI linting
This commit is contained in:
@@ -3,6 +3,7 @@ import os
|
||||
import re
|
||||
import subprocess
|
||||
import time
|
||||
import types
|
||||
from collections.abc import Callable
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
@@ -95,10 +96,11 @@ class Machine:
|
||||
def get_unit_info(self, unit: str) -> dict[str, str]:
|
||||
proc = self.systemctl(f'--no-pager show "{unit}"')
|
||||
if proc.returncode != 0:
|
||||
raise Exception(
|
||||
msg = (
|
||||
f'retrieving systemctl info for unit "{unit}"'
|
||||
+ f" failed with exit code {proc.returncode}"
|
||||
f" failed with exit code {proc.returncode}"
|
||||
)
|
||||
raise Exception(msg)
|
||||
|
||||
line_pattern = re.compile(r"^([^=]+)=(.*)$")
|
||||
|
||||
@@ -311,7 +313,12 @@ class Driver:
|
||||
def __enter__(self) -> "Driver":
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None:
|
||||
def __exit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_value: BaseException | None,
|
||||
traceback: types.TracebackType | None,
|
||||
) -> None:
|
||||
for machine in self.machines:
|
||||
machine.release()
|
||||
|
||||
|
||||
@@ -103,7 +103,6 @@ def initialize_certificates(
|
||||
finally:
|
||||
# Close the connection
|
||||
conn.close()
|
||||
pass
|
||||
|
||||
|
||||
def calculate_digest(cert: str) -> str:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}")
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -20,8 +20,14 @@ lint.select = [
|
||||
"E",
|
||||
"EM",
|
||||
"F",
|
||||
"FA",
|
||||
"I",
|
||||
"ICN",
|
||||
"ISC",
|
||||
"LOG",
|
||||
"N",
|
||||
"PIE",
|
||||
"PYI",
|
||||
"RUF",
|
||||
"T10",
|
||||
"TID",
|
||||
|
||||
Reference in New Issue
Block a user