From: Daan De Meyer Date: Thu, 1 Jun 2023 11:08:21 +0000 (+0200) Subject: Get rid of unnecessary usage of TypeVar X-Git-Tag: v15~128^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1606%2Fhead;p=thirdparty%2Fmkosi.git Get rid of unnecessary usage of TypeVar --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 11848da5e..c8bd9b09e 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -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(