clan_vm_manager: Fix mypy errors for clan_cli types
All checks were successful
checks / check-links (pull_request) Successful in 22s
checks / checks-impure (pull_request) Successful in 1m53s
checks / checks (pull_request) Successful in 3m56s

This commit is contained in:
Luis Hebendanz 2024-03-12 23:19:20 +07:00
parent 7c2e22de72
commit 4e5d051847
3 changed files with 8 additions and 6 deletions

View File

@ -116,7 +116,7 @@ class VMObject(GObject.Object):
@contextmanager
def _create_machine(self) -> Generator[Machine, None, None]:
uri = ClanURI.from_str(
url=self.data.flake.flake_url, machine_name=self.data.flake.flake_attr
url=str(self.data.flake.flake_url), machine_name=self.data.flake.flake_attr
)
if uri.flake_id.is_local():
self.machine = Machine(
@ -128,6 +128,7 @@ class VMObject(GObject.Object):
name=self.data.flake.flake_attr,
flake=uri.flake_id.url,
)
assert self.machine is not None
yield self.machine
self.machine = None

View File

@ -97,6 +97,7 @@ class JoinList:
def _on_join_finished(self, source: JoinValue) -> None:
log.info(f"Join finished: {source.url}")
self.discard(source)
assert source.entry is not None
ClanStore.use().push_history_entry(source.entry)
def discard(self, value: JoinValue) -> None:

View File

@ -73,18 +73,18 @@ class ClanStore:
def push_history_entry(self, entry: HistoryEntry) -> None:
# TODO: We shouldn't do this here but in the list view
if entry.flake.icon is None:
icon = assets.loc / "placeholder.jpeg"
icon: Path = assets.loc / "placeholder.jpeg"
else:
icon = entry.flake.icon
icon = Path(entry.flake.icon)
vm = VMObject(
icon=Path(icon),
icon=icon,
data=entry,
)
self.push(vm)
def push(self, vm: VMObject) -> None:
url = vm.data.flake.flake_url
url = str(vm.data.flake.flake_url)
# Only write to the store if the Clan is not already in it
# Every write to the KVStore rerenders bound widgets to the clan_store
@ -108,7 +108,7 @@ class ClanStore:
vm_store.append(vm)
def remove(self, vm: VMObject) -> None:
del self.clan_store[vm.data.flake.flake_url][vm.data.flake.flake_attr]
del self.clan_store[str(vm.data.flake.flake_url)][vm.data.flake.flake_attr]
def get_vm(self, uri: ClanURI) -> None | VMObject:
vm_store = self.clan_store.get(str(uri.flake_id))