]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ukify: Fix two typing issues
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 29 Jan 2025 13:43:06 +0000 (14:43 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 29 Jan 2025 13:43:06 +0000 (14:43 +0100)
src/ukify/ukify.py

index 5f821297c128516d2764d7d286a90a037668a1d8..091e5a45e19babbf929d75c7c2cae6159b55a995 100755 (executable)
@@ -1510,7 +1510,7 @@ def inspect_section(
     data = section.get_data(length=size)
     digest = sha256(data).hexdigest()
 
-    struct = {
+    struct: dict[str, Union[int, str]] = {
         'size': size,
         'sha256': digest,
     }
@@ -1529,7 +1529,7 @@ def inspect_section(
     if opts.json == 'off':
         print(f'{name}:\n  size: {size} bytes\n  sha256: {digest}')
         if ttype == 'text':
-            text = textwrap.indent(struct['text'].rstrip(), ' ' * 4)
+            text = textwrap.indent(cast(str, struct['text']).rstrip(), ' ' * 4)
             print(f'  text:\n{text}')
 
     return name, struct