Skip to content

Commit 39b6e6c

Browse files
committed
code cleanup
Signed-off-by: Thien Trung Vuong <[email protected]>
1 parent 5597b87 commit 39b6e6c

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

lisa/operating_system.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,8 @@ def _get_version_info_from_named_regex_match(
589589
build_match = named_matches.group("build")
590590
log_message = (
591591
f"Found {package_name} version "
592-
f"major:{major_match} minor:{minor_match} " # noqa: E231
593-
f"patch:{patch_match} build:{build_match}" # noqa: E231
592+
f"major:{major_match} minor:{minor_match} "
593+
f"patch:{patch_match} build:{build_match}"
594594
)
595595
self._node.log.debug(log_message)
596596
return VersionInfo(major, minor, patch, build=build_match)
@@ -705,7 +705,7 @@ def __resolve_package_name(self, package: Union[str, Tool, Type[Tool]]) -> str:
705705
elif isinstance(package, Tool):
706706
package_name = package.package_name
707707
else:
708-
assert isinstance(package, type), f"actual:{type(package)}" # noqa: E231
708+
assert isinstance(package, type), f"actual:{type(package)}"
709709
# Create a temp object, it doesn't query.
710710
# So they can be queried together.
711711
tool = package.create(self._node)
@@ -922,9 +922,7 @@ def add_azure_core_repo(
922922
code_name = self.information.codename
923923
repo_name = AzureCoreRepo.AzureCoreDebian
924924

925-
repo_url = (
926-
f"http://packages.microsoft.com/repos/{repo_name.value}/" # noqa: E231
927-
)
925+
repo_url = f"http://packages.microsoft.com/repos/{repo_name.value}/"
928926
self.add_repository(
929927
repo=(f"deb [arch={arch_name}] {repo_url} {code_name} main"),
930928
keys_location=keys,
@@ -1146,7 +1144,7 @@ def _package_exists(self, package: str) -> bool:
11461144
# vim deinstall
11471145
# vim-common install
11481146
# auoms hold
1149-
package_pattern = re.compile(f"{package}([ \t]+)(install|hold)") # noqa: E201
1147+
package_pattern = re.compile(f"{package}([ \t]+)(install|hold)")
11501148
if len(list(filter(package_pattern.match, result.stdout.splitlines()))) == 1:
11511149
return True
11521150
return False
@@ -1695,7 +1693,7 @@ def install_epel(self) -> None:
16951693
).is_greater_than_or_equal_to(7)
16961694
epel_release_rpm_name = f"epel-release-latest-{major}.noarch.rpm"
16971695
self.install_packages(
1698-
f"https://dl.fedoraproject.org/pub/epel/{epel_release_rpm_name}" # noqa: E231
1696+
f"https://dl.fedoraproject.org/pub/epel/{epel_release_rpm_name}"
16991697
)
17001698

17011699
# replace $releasever to 8 for 8.x

lisa/tools/tpm2.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT license.
33

4-
from typing import Dict, List, Sequence
4+
from typing import Dict, List, Optional, Sequence, Union
55

66
from lisa.executable import Tool
77
from lisa.operating_system import CBLMariner
@@ -27,16 +27,14 @@ def _install(self) -> bool:
2727
return self._check_exists()
2828

2929
def pcrread(
30-
self,
31-
alg: str = "sha256",
32-
pcrs: int | Sequence[int] | None = None,
30+
self, alg: str = "sha256", pcrs: Optional[Union[int, Sequence[int]]] = None
3331
) -> Dict[int, str]:
3432
pcrs = self._get_pcr_list(pcrs)
3533
if len(pcrs) == 0:
3634
pcrs_arg = "all"
3735
else:
3836
pcrs_arg = ",".join(map(str, pcrs))
39-
cmd = f"pcrread {alg}:{pcrs_arg}" # noqa: E231
37+
cmd = f"pcrread {alg}:{pcrs_arg}"
4038
cmd_result = self.run(
4139
cmd,
4240
expected_exit_code=0,
@@ -61,7 +59,7 @@ def pcrread(
6159
result[pcr_index] = hash_value
6260
return result
6361

64-
def _get_pcr_list(self, pcrs: int | Sequence[int] | None) -> List[int]:
62+
def _get_pcr_list(self, pcrs: Optional[Union[int, Sequence[int]]]) -> List[int]:
6563
if pcrs is None:
6664
return []
6765
if isinstance(pcrs, int):

0 commit comments

Comments
 (0)