modernize code with ruff

This commit is contained in:
Jörg Thalheim
2023-12-06 17:13:32 +01:00
parent 02f2b3700e
commit 5e34e55fff
4 changed files with 9 additions and 16 deletions

View File

@@ -1,13 +1,12 @@
import argparse
import json
import subprocess
from typing import Optional
from ..errors import ClanError
from ..machines.machines import Machine
def create_backup(machine: Machine, provider: Optional[str] = None) -> None:
def create_backup(machine: Machine, provider: str | None = None) -> None:
backup_scripts = json.loads(
machine.eval_nix(f"nixosConfigurations.{machine.name}.config.clanCore.backups")
)

View File

@@ -1,13 +1,12 @@
import argparse
import pprint
from pathlib import Path
from typing import Optional
from ..errors import ClanError
def list_backups(
flake_dir: Path, machine: str, provider: Optional[str] = None
flake_dir: Path, machine: str, provider: str | None = None
) -> dict[str, dict[str, list[dict[str, str]]]]:
dummy_data = {
"testhostname": {

View File

@@ -1,6 +1,5 @@
import argparse
from pathlib import Path
from typing import Optional
from ..errors import ClanError
@@ -10,7 +9,7 @@ def restore_backup(
machine: str,
provider: str,
backup_id: str,
service: Optional[str] = None,
service: str | None = None,
) -> None:
if service is None:
print("would restore backup", machine, provider, backup_id)