Fix some type issues

This commit is contained in:
Johannes Kirschbauer
2024-07-11 17:05:57 +02:00
parent af4e843131
commit b324e1a4f4
2 changed files with 12 additions and 9 deletions

View File

@@ -63,18 +63,11 @@ def create_clan(options: CreateOptions) -> CreateClanResponse:
) )
out = run(command, cwd=directory) out = run(command, cwd=directory)
# Write inventory.json file ## Begin: setup git
inventory = Inventory.load_file(directory)
if options.meta is not None:
inventory.meta = options.meta
command = nix_shell(["nixpkgs#git"], ["git", "init"]) command = nix_shell(["nixpkgs#git"], ["git", "init"])
out = run(command, cwd=directory) out = run(command, cwd=directory)
cmd_responses["git init"] = out cmd_responses["git init"] = out
# Persist also create a commit message for each change
inventory.persist(directory, "Init inventory")
command = nix_shell(["nixpkgs#git"], ["git", "add", "."]) command = nix_shell(["nixpkgs#git"], ["git", "add", "."])
out = run(command, cwd=directory) out = run(command, cwd=directory)
cmd_responses["git add"] = out cmd_responses["git add"] = out
@@ -88,6 +81,14 @@ def create_clan(options: CreateOptions) -> CreateClanResponse:
) )
out = run(command, cwd=directory) out = run(command, cwd=directory)
cmd_responses["git config"] = out cmd_responses["git config"] = out
## End: setup git
# Write inventory.json file
inventory = Inventory.load_file(directory)
if options.meta is not None:
inventory.meta = options.meta
# Persist creates a commit message for each change
inventory.persist(directory, "Init inventory")
command = ["nix", "flake", "update"] command = ["nix", "flake", "update"]
out = run(command, cwd=directory) out = run(command, cwd=directory)

View File

@@ -1,6 +1,8 @@
import os import os
from collections import defaultdict from collections import defaultdict
from collections.abc import Callable
from pathlib import Path from pathlib import Path
from typing import Any
import pytest import pytest
from age_keys import SopsSetup from age_keys import SopsSetup
@@ -14,7 +16,7 @@ def def_value() -> defaultdict:
# allows defining nested dictionary in a single line # allows defining nested dictionary in a single line
nested_dict = lambda: defaultdict(def_value) nested_dict: Callable[[], dict[str, Any]] = lambda: defaultdict(def_value)
@pytest.mark.impure @pytest.mark.impure