treefmt/ruff: Set python lint version to 3.13. Fix all new lints coming up.
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
# ruff: noqa: N801
|
|
||||||
import gi
|
import gi
|
||||||
|
|
||||||
gi.require_version("Gtk", "4.0")
|
gi.require_version("Gtk", "4.0")
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import shutil
|
|||||||
import subprocess as sp
|
import subprocess as sp
|
||||||
import tempfile
|
import tempfile
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from collections.abc import Callable, Iterator
|
from collections.abc import Iterator
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, NamedTuple
|
from typing import NamedTuple
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from clan_cli.tests import age_keys
|
from clan_cli.tests import age_keys
|
||||||
@@ -38,7 +38,12 @@ def def_value() -> defaultdict:
|
|||||||
return defaultdict(def_value)
|
return defaultdict(def_value)
|
||||||
|
|
||||||
|
|
||||||
nested_dict: Callable[[], dict[str, Any]] = lambda: defaultdict(def_value)
|
def nested_dict() -> defaultdict:
|
||||||
|
"""
|
||||||
|
Creates a defaultdict that allows for arbitrary levels of nesting.
|
||||||
|
For example: d['a']['b']['c'] = value
|
||||||
|
"""
|
||||||
|
return defaultdict(def_value)
|
||||||
|
|
||||||
|
|
||||||
# Substitutes strings in a file.
|
# Substitutes strings in a file.
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
from collections import defaultdict
|
|
||||||
from collections.abc import Callable
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
|
|
||||||
def def_value() -> defaultdict:
|
|
||||||
return defaultdict(def_value)
|
|
||||||
|
|
||||||
|
|
||||||
# allows defining nested dictionary in a single line
|
|
||||||
nested_dict: Callable[[], dict[str, Any]] = lambda: defaultdict(def_value)
|
|
||||||
@@ -4,14 +4,13 @@ import logging
|
|||||||
from clan_cli.completions import add_dynamic_completer, complete_machines
|
from clan_cli.completions import add_dynamic_completer, complete_machines
|
||||||
from clan_lib.errors import ClanError
|
from clan_lib.errors import ClanError
|
||||||
from clan_lib.machines.machines import Machine
|
from clan_lib.machines.machines import Machine
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .generate import Var
|
from .generate import Var
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class VarStatus:
|
class VarStatus:
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ from typing import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from clan_lib.api.util import JSchemaTypeError
|
from clan_lib.api.util import JSchemaTypeError
|
||||||
|
from clan_lib.errors import ClanError
|
||||||
|
from .serde import dataclass_to_dict, from_dict, sanitize_string
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
from .serde import dataclass_to_dict, from_dict, sanitize_string
|
|
||||||
|
|
||||||
__all__ = ["dataclass_to_dict", "from_dict", "sanitize_string"]
|
__all__ = ["dataclass_to_dict", "from_dict", "sanitize_string"]
|
||||||
|
|
||||||
from clan_lib.errors import ClanError
|
|
||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,10 @@ def delete_machine(machine: Machine) -> None:
|
|||||||
|
|
||||||
# louis@(2025-02-04): clean-up legacy (pre-vars) secrets:
|
# louis@(2025-02-04): clean-up legacy (pre-vars) secrets:
|
||||||
sops_folder = sops_secrets_folder(machine.flake.path)
|
sops_folder = sops_secrets_folder(machine.flake.path)
|
||||||
filter_fn = lambda secret_name: secret_name.startswith(f"{machine.name}-")
|
|
||||||
|
def filter_fn(secret_name: str) -> bool:
|
||||||
|
return secret_name.startswith(f"{machine.name}-")
|
||||||
|
|
||||||
for secret_name in list_secrets(machine.flake.path, filter_fn):
|
for secret_name in list_secrets(machine.flake.path, filter_fn):
|
||||||
secret_path = sops_folder / secret_name
|
secret_path = sops_folder / secret_name
|
||||||
changed_paths.append(secret_path)
|
changed_paths.append(secret_path)
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
# ruff: noqa: SLF001
|
|
||||||
import ipaddress
|
import ipaddress
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
|
import re
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@@ -118,9 +119,6 @@ def epilog_to_md(text: str) -> str:
|
|||||||
return md
|
return md
|
||||||
|
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
|
|
||||||
def contains_https_link(line: str) -> bool:
|
def contains_https_link(line: str) -> bool:
|
||||||
pattern = r"https://\S+"
|
pattern = r"https://\S+"
|
||||||
return re.search(pattern, line) is not None
|
return re.search(pattern, line) is not None
|
||||||
|
|||||||
@@ -49,9 +49,12 @@ filterwarnings = "default::ResourceWarning"
|
|||||||
python_files = ["test_*.py", "*_test.py"]
|
python_files = ["test_*.py", "*_test.py"]
|
||||||
|
|
||||||
[tool.mypy]
|
[tool.mypy]
|
||||||
python_version = "3.12"
|
python_version = "3.13"
|
||||||
warn_redundant_casts = true
|
warn_redundant_casts = true
|
||||||
disallow_untyped_calls = true
|
disallow_untyped_calls = true
|
||||||
disallow_untyped_defs = true
|
disallow_untyped_defs = true
|
||||||
no_implicit_optional = true
|
no_implicit_optional = true
|
||||||
exclude = "clan_lib.nixpkgs"
|
exclude = "clan_lib.nixpkgs"
|
||||||
|
|
||||||
|
[tool.ruff]
|
||||||
|
target-version = "py313"
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
# ruff: noqa: RUF001
|
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
Reference in New Issue
Block a user