ruff: also enforce variable naming rules
This commit is contained in:
@@ -180,9 +180,9 @@ def process_args(
|
|||||||
|
|
||||||
def register_parser(
|
def register_parser(
|
||||||
parser: argparse.ArgumentParser,
|
parser: argparse.ArgumentParser,
|
||||||
optionsFile: Optional[Union[str, Path]] = os.environ.get("CLAN_OPTIONS_FILE"),
|
options_file: Optional[Union[str, Path]] = os.environ.get("CLAN_OPTIONS_FILE"),
|
||||||
) -> None:
|
) -> None:
|
||||||
if not optionsFile:
|
if not options_file:
|
||||||
# use nix eval to evaluate .#clanOptions
|
# use nix eval to evaluate .#clanOptions
|
||||||
# this will give us the evaluated config with the options attribute
|
# this will give us the evaluated config with the options attribute
|
||||||
proc = subprocess.run(
|
proc = subprocess.run(
|
||||||
@@ -200,7 +200,7 @@ def register_parser(
|
|||||||
with open(file) as f:
|
with open(file) as f:
|
||||||
options = json.load(f)
|
options = json.load(f)
|
||||||
else:
|
else:
|
||||||
with open(optionsFile) as f:
|
with open(options_file) as f:
|
||||||
options = json.load(f)
|
options = json.load(f)
|
||||||
return _register_parser(parser, options)
|
return _register_parser(parser, options)
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class CommandFormatter(logging.Formatter):
|
|||||||
self.hostnames: List[str] = []
|
self.hostnames: List[str] = []
|
||||||
self.hostname_color_offset = 1 # first host shouldn't get agressive red
|
self.hostname_color_offset = 1 # first host shouldn't get agressive red
|
||||||
|
|
||||||
def formatMessage(self, record: logging.LogRecord) -> str:
|
def format(self, record: logging.LogRecord) -> str:
|
||||||
colorcode = 0
|
colorcode = 0
|
||||||
if record.levelno == logging.ERROR:
|
if record.levelno == logging.ERROR:
|
||||||
colorcode = 31 # red
|
colorcode = 31 # red
|
||||||
@@ -68,7 +68,7 @@ class CommandFormatter(logging.Formatter):
|
|||||||
setattr(record, "prefix_color", prefix_color)
|
setattr(record, "prefix_color", prefix_color)
|
||||||
setattr(record, "color_reset", color_reset)
|
setattr(record, "color_reset", color_reset)
|
||||||
|
|
||||||
return super().formatMessage(record)
|
return super().format(record)
|
||||||
|
|
||||||
def hostname_colorcode(self, hostname: str) -> int:
|
def hostname_colorcode(self, hostname: str) -> int:
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ def ssh(
|
|||||||
subprocess.run(cmd)
|
subprocess.run(cmd)
|
||||||
|
|
||||||
|
|
||||||
def qrcode_scan(pictureFile: str) -> str:
|
def qrcode_scan(picture_file: str) -> str:
|
||||||
return (
|
return (
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
nix_shell(
|
nix_shell(
|
||||||
@@ -42,7 +42,7 @@ def qrcode_scan(pictureFile: str) -> str:
|
|||||||
"zbarimg",
|
"zbarimg",
|
||||||
"--quiet",
|
"--quiet",
|
||||||
"--raw",
|
"--raw",
|
||||||
pictureFile,
|
picture_file,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ ignore_missing_imports = true
|
|||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
line-length = 88
|
line-length = 88
|
||||||
|
|
||||||
select = [ "E", "F", "I", "U"]
|
select = [ "E", "F", "I", "U", "N"]
|
||||||
ignore = [ "E501" ]
|
ignore = [ "E501" ]
|
||||||
|
|
||||||
[tool.black]
|
[tool.black]
|
||||||
|
|||||||
Reference in New Issue
Block a user