Fix amd-smi CLI calls returning TypeError
$ amd-smi version
TypeError: unsupported operand type(s) for |: 'type' and 'type'
---------------
Python3 --versions lower than 3.10
do not support str | None
Using typing Optional and Union, we can create equivalent logic for
str | none
and
str | list | none
Change-Id: I1f4a7ab67333914b33639dc62652881e1127411e
Signed-off-by: Charis Poag <Charis.Poag@amd.com>
[ROCm/amdsmi commit: 5c778cadf1]
This commit is contained in:
1 bovenliggende
e73ae3d79d
commit
b6a68dd877
1 file changed
+3
-1
@@ -27,6 +27,8 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import collections
|
import collections
|
||||||
|
from typing import Optional
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@@ -179,7 +181,7 @@ class AMDSMIParser(argparse.ArgumentParser):
|
|||||||
|
|
||||||
class AMDSMILimitArgs(argparse.Action):
|
class AMDSMILimitArgs(argparse.Action):
|
||||||
def __call__(self, parser: AMDSMIParser, namespace: argparse.Namespace,
|
def __call__(self, parser: AMDSMIParser, namespace: argparse.Namespace,
|
||||||
values: str | list | None, option_string: str | None = None) -> None:
|
values: Union[str, list, None], option_string: Optional[str] = None) -> None:
|
||||||
# valid values
|
# valid values
|
||||||
valid_clk_types = ('sclk', 'mclk')
|
valid_clk_types = ('sclk', 'mclk')
|
||||||
valid_lim_types = ('min', 'max')
|
valid_lim_types = ('min', 'max')
|
||||||
|
|||||||
Reference in new issue
Block a user