From: Zbigniew Jędrzejewski-Szmek Date: Sun, 24 Apr 2022 14:07:03 +0000 (+0200) Subject: Drop special __repr__ from Parseable mixin X-Git-Tag: v13~46^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F957%2Fhead;p=thirdparty%2Fmkosi.git Drop special __repr__ from Parseable mixin We want to override __str__, and we also did __repr__, but there doesn't seem to be any particular reason for this. --- diff --git a/mkosi/backend.py b/mkosi/backend.py index c7a6bac16..b63f3bd8d 100644 --- a/mkosi/backend.py +++ b/mkosi/backend.py @@ -90,13 +90,10 @@ ARG_DEBUG: Set[str] = set() class Parseable: "A mix-in to provide conversions for argparse" - def __repr__(self) -> str: + def __str__(self) -> str: """Return the member name without the class name""" return cast(str, getattr(self, "name")) - def __str__(self) -> str: - return self.__repr__() - @classmethod def from_string(cls: Any, name: str) -> Any: """A convenience method to be used with argparse""" @@ -256,8 +253,6 @@ class OutputFormat(Parseable, enum.Enum): def has_fs_compression(self) -> bool: return self.is_squashfs() or self.is_btrfs() - def __repr__(self) -> str: - return Parseable.__repr__(self) def __str__(self) -> str: return Parseable.__str__(self) @@ -265,8 +260,6 @@ class ManifestFormat(Parseable, enum.Enum): json = "json" # the standard manifest in json format changelog = "changelog" # human-readable text file with package changelogs - def __repr__(self) -> str: - return Parseable.__repr__(self) def __str__(self) -> str: return Parseable.__str__(self)