From: Zbigniew Jędrzejewski-Szmek Date: Fri, 10 Sep 2021 12:46:03 +0000 (+0200) Subject: Use __future__.annotations everywhere X-Git-Tag: v11~45^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F791%2Fhead;p=thirdparty%2Fmkosi.git Use __future__.annotations everywhere --- 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.