Fix method return for python version compatibility (#784)

Support for python3.8 and above means union defined in one of the methods was throwing errors for anything less than python3.10. Swapping out | operand for Optional[] resolves errors on systems using <3.10. No functional changes.

Signed-off-by: Carrie Fallows <Carrie.Fallows@amd.com>

[ROCm/rocprofiler-compute commit: a59b1ea6e6]
This commit is contained in:
cfallows-amd
2025-07-02 10:36:37 -04:00
committed by GitHub
parent 740fe492c2
commit e085f3cc54
@@ -39,6 +39,7 @@ import time
from collections import OrderedDict from collections import OrderedDict
from itertools import product from itertools import product
from pathlib import Path as path from pathlib import Path as path
from typing import Optional
import pandas as pd import pandas as pd
import yaml import yaml
@@ -139,7 +140,7 @@ def add_counter_extra_config_input_yaml(
def extract_counter_info_extra_config_input_yaml( def extract_counter_info_extra_config_input_yaml(
data: dict, counter_name: str data: dict, counter_name: str
) -> dict | None: ) -> Optional[dict]:
""" """
Extract the full counter dictionary from 'data' for the given counter_name. Extract the full counter dictionary from 'data' for the given counter_name.
@@ -148,7 +149,7 @@ def extract_counter_info_extra_config_input_yaml(
counter_name (str): The counter to find. counter_name (str): The counter to find.
Returns: Returns:
dict | None: The full counter dict if found, else None. Optional[dict]: The full counter dict if found, else None.
""" """
counters = data.get("rocprofiler-sdk", {}).get("counters", []) counters = data.get("rocprofiler-sdk", {}).get("counters", [])
for counter in counters: for counter in counters: