From e085f3cc545b8ecd2b2eee5ad1e6bee6bc093a29 Mon Sep 17 00:00:00 2001 From: cfallows-amd Date: Wed, 2 Jul 2025 10:36:37 -0400 Subject: [PATCH] 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 [ROCm/rocprofiler-compute commit: a59b1ea6e6eac7688479baeb5a3a0a3d46927f5c] --- projects/rocprofiler-compute/src/utils/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/rocprofiler-compute/src/utils/utils.py b/projects/rocprofiler-compute/src/utils/utils.py index 4c2b01658a..739995b9c9 100644 --- a/projects/rocprofiler-compute/src/utils/utils.py +++ b/projects/rocprofiler-compute/src/utils/utils.py @@ -39,6 +39,7 @@ import time from collections import OrderedDict from itertools import product from pathlib import Path as path +from typing import Optional import pandas as pd import yaml @@ -139,7 +140,7 @@ def add_counter_extra_config_input_yaml( def extract_counter_info_extra_config_input_yaml( data: dict, counter_name: str -) -> dict | None: +) -> Optional[dict]: """ 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. 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", []) for counter in counters: