From e729a412428f5d95613d47812337749ae3a61776 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 10 Sep 2021 14:46:03 +0200 Subject: [PATCH] Use __future__.annotations everywhere --- mkosi/__init__.py | 6 +++--- mkosi/backend.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 7f644208f..f2407bf89 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -1205,10 +1205,10 @@ class LuksSetupOutput(NamedTuple): tmp: Optional[Path] @classmethod - def empty(cls) -> "LuksSetupOutput": + def empty(cls) -> LuksSetupOutput: return cls(None, None, None, None, None) - def without_generated_root(self, args: CommandLineArguments) -> "LuksSetupOutput": + def without_generated_root(self, args: CommandLineArguments) -> LuksSetupOutput: "A copy of self with .root optionally supressed" return LuksSetupOutput( None if is_generated_root(args) else self.root, @@ -6528,7 +6528,7 @@ class BuildOutput: return self.raw.name if self.raw is not None else None @classmethod - def empty(cls) -> "BuildOutput": + def empty(cls) -> BuildOutput: return cls(None, None, None, None, None, None, None) diff --git a/mkosi/backend.py b/mkosi/backend.py index f90cff318..6859ed40e 100644 --- a/mkosi/backend.py +++ b/mkosi/backend.py @@ -1,5 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1+ +from __future__ import annotations + import argparse import contextlib import dataclasses @@ -100,7 +102,7 @@ class Distribution(enum.Enum): photon = 9, PackageType.rpm openmandriva = 10, PackageType.rpm - def __new__(cls, number: int, package_type: PackageType) -> "Distribution": + def __new__(cls, number: int, package_type: PackageType) -> Distribution: # This turns the list above into enum entries with .package_type attributes. # See https://docs.python.org/3.9/library/enum.html#when-to-use-new-vs-init # for an explanation. -- 2.47.2