]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Get rid of unnecessary usage of TypeVar 1606/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 1 Jun 2023 11:08:21 +0000 (13:08 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 2 Jun 2023 07:47:36 +0000 (09:47 +0200)
mkosi/__init__.py

index 11848da5ee6f123476a2b33fbbc922c7ba87b066..c8bd9b09e5b96f7d35bac3a9884a5bea66e76414 100644 (file)
@@ -19,7 +19,7 @@ import uuid
 from collections.abc import Iterator, Sequence
 from pathlib import Path
 from textwrap import dedent
-from typing import Callable, ContextManager, Optional, TextIO, TypeVar, Union, cast
+from typing import Callable, ContextManager, Optional, TextIO, Union, cast
 
 from mkosi.btrfs import btrfs_maybe_snapshot_subvolume
 from mkosi.config import (
@@ -57,9 +57,6 @@ MKOSI_COMMANDS_NEED_BUILD = (Verb.build, Verb.shell, Verb.boot, Verb.qemu, Verb.
 MKOSI_COMMANDS_SUDO = (Verb.shell, Verb.boot)
 
 
-T = TypeVar("T")
-
-
 @contextlib.contextmanager
 def mount_image(state: MkosiState) -> Iterator[None]:
     with complete_step("Mounting image…", "Unmounting image…"), contextlib.ExitStack() as stack:
@@ -1213,16 +1210,16 @@ def yes_no_auto(f: ConfigFeature) -> str:
     return "auto" if f is ConfigFeature.auto else yes_no(f == ConfigFeature.enabled)
 
 
-def none_to_na(s: Optional[T]) -> Union[T, str]:
-    return "n/a" if s is None else s
+def none_to_na(s: Optional[object]) -> str:
+    return "n/a" if s is None else str(s)
 
 
-def none_to_none(s: Optional[T]) -> Union[T, str]:
-    return "none" if s is None else s
+def none_to_none(s: Optional[object]) -> str:
+    return "none" if s is None else str(s)
 
 
-def none_to_default(s: Optional[T]) -> Union[T, str]:
-    return "default" if s is None else s
+def none_to_default(s: Optional[object]) -> str:
+    return "default" if s is None else str(s)
 
 
 def path_or_none(