[elbe-devel] [PATCH 1/6] elbevalidate: avoid typing.Self usage

Thomas Weißschuh thomas.weissschuh at linutronix.de
Mon Jul 15 15:15:13 CEST 2024


typing.Self was only introduced in Python 3.11.
Using it breaks usage on Debian bullseye.

Replace the usage with the stringified type name.
While the semantics differ in the face of subtypes,
'Image' is not meant to be subtyped.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbevalidate/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/elbevalidate/__init__.py b/elbevalidate/__init__.py
index 32993b202d3d..dd0317297fe2 100644
--- a/elbevalidate/__init__.py
+++ b/elbevalidate/__init__.py
@@ -159,7 +159,7 @@ class Image(BlockDevice):
 
     @classmethod
     @contextlib.contextmanager
-    def from_file(cls, image) -> collections.abc.Generator[typing.Self, None, None]:
+    def from_file(cls, image) -> collections.abc.Generator['Image', None, None]:
         """ Construct an :py:class:`Image` from a local file. """
         gfs = guestfs.GuestFS(python_return_dict=True)
         instance = cls(gfs)

-- 
2.45.2



More information about the elbe-devel mailing list