2021-06-23 19:11:31

by Daniel Latypov

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Daniel Latypov <[email protected]>
---
tools/testing/kunit/kunit_kernel.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py
index e1951fa60027..5987d5b1b874 100644
--- a/tools/testing/kunit/kunit_kernel.py
+++ b/tools/testing/kunit/kunit_kernel.py
@@ -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


2021-06-25 04:18:59

by David Gow

[permalink] [raw]
Subject: Re: [PATCH] kunit: tool: remove unnecessary "annotations" import

On Thu, Jun 24, 2021 at 3:09 AM Daniel Latypov <[email protected]> wrote:
>
> 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.
>
> Signed-off-by: Daniel Latypov <[email protected]>
> ---

This looks sensible and works for me.

Reviewed-by: David Gow <[email protected]>

Thanks,
-- David

> tools/testing/kunit/kunit_kernel.py | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py
> index e1951fa60027..5987d5b1b874 100644
> --- a/tools/testing/kunit/kunit_kernel.py
> +++ b/tools/testing/kunit/kunit_kernel.py
> @@ -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
>


Attachments:
smime.p7s (3.91 kB)
S/MIME Cryptographic Signature

2021-06-29 00:24:38

by Brendan Higgins

[permalink] [raw]
Subject: Re: [PATCH] kunit: tool: remove unnecessary "annotations" import

On Wed, Jun 23, 2021 at 12:09 PM Daniel Latypov <[email protected]> wrote:
>
> 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.

nit: s/anotated/annotated

>
> Signed-off-by: Daniel Latypov <[email protected]>

Reviewed-by: Brendan Higgins <[email protected]>
Tested-by: Brendan Higgins <[email protected]>