Skip to contentSkip to conversation

kunit: tool: remove unnecessary "annotations" import

PATCH Superseded Daniel Latypov 3 participants 3 messages Jun 23, 2021 – Jun 28, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kunit: tool: remove unnecessary "annotations" import

The import was working around the fact "tuple[T]" was used instead of typing.Tuple[T].

Convert it to use type.Tuple to be consistent with how the rest of the code is anotated.

---
 tools/testing/kunit/kunit_kernel.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tools/testing/kunit/kunit_kernel.py +2 -4
index e1951fa60027..5987d5b1b874 100644
@@ -6,15 +6,13 @@
 # Author: Felix Guo <[email protected]>
 # Author: Brendan Higgins <[email protected]>
 
-from __future__ import annotations
 import importlib.util
 import logging
 import subprocess
 import os
 import shutil
 import signal
-from typing import Iterator
-from typing import Optional
+from typing import Iterator, Optional, Tuple
 
 from contextlib import ExitStack
 
@@ -208,7 +206,7 @@ def get_source_tree_ops(arch: str, cross_compile: Optional[str]) -> LinuxSourceT
 		raise ConfigError(arch + ' is not a valid arch')
 
 def get_source_tree_ops_from_qemu_config(config_path: str,
-					 cross_compile: Optional[str]) -> tuple[
+					 cross_compile: Optional[str]) -> Tuple[
 							 str, LinuxSourceTreeOperations]:
 	# The module name/path has very little to do with where the actual file
 	# exists (I learned this through experimentation and could not find it

base-commit: 87c9c16317882dd6dbbc07e349bc3223e14f3244

Signature · 1 line
2.32.0.93.g670b81a890-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Daniel Latypov

The import was working around the fact "tuple[T]" was used instead of typing.Tuple[T].

Convert it to use type.Tuple to be consistent with how the rest of the code is anotated.

---

This looks sensible and works for me.

Thanks,
-- David

Quoted 38 lines
 tools/testing/kunit/kunit_kernel.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tools/testing/kunit/kunit_kernel.py +2 -4
index e1951fa60027..5987d5b1b874 100644
@@ -6,15 +6,13 @@
 # Author: Felix Guo <[email protected]>
 # Author: Brendan Higgins <[email protected]>
 
-from __future__ import annotations
 import importlib.util
 import logging
 import subprocess
 import os
 import shutil
 import signal
-from typing import Iterator
-from typing import Optional
+from typing import Iterator, Optional, Tuple
 
 from contextlib import ExitStack
 
@@ -208,7 +206,7 @@ def get_source_tree_ops(arch: str, cross_compile: Optional[str]) -> LinuxSourceT
                raise ConfigError(arch + ' is not a valid arch')
 
 def get_source_tree_ops_from_qemu_config(config_path: str,
-                                        cross_compile: Optional[str]) -> tuple[
+                                        cross_compile: Optional[str]) -> Tuple[
                                                         str, LinuxSourceTreeOperations]:
        # The module name/path has very little to do with where the actual file
        # exists (I learned this through experimentation and could not find it

base-commit: 87c9c16317882dd6dbbc07e349bc3223e14f3244 --
2.32.0.93.g670b81a890-goog