From 6b65a4e7ec6ad4443bb7cc6ed7d7f422ae2146ca Mon Sep 17 00:00:00 2001 From: "Kacper Kowalik (Xarthisius)" Date: Tue, 24 Feb 2026 13:45:55 -0600 Subject: [PATCH] Allow to pass attrs as strings --- pyproject.toml | 2 +- tests/test_tro_utils.py | 2 +- tro_utils/__init__.py | 2 +- tro_utils/tro_utils.py | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 89bd6ec..b41e6a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ maintainers = [ ] description = "Utilities for creating, editing and interacting with TROs" readme = "README.rst" -version = "0.2.0" +version = "0.2.1" dependencies = [ "Click>=7.0", "jinja2", diff --git a/tests/test_tro_utils.py b/tests/test_tro_utils.py index 0eac0ff..07edf7f 100644 --- a/tests/test_tro_utils.py +++ b/tests/test_tro_utils.py @@ -306,7 +306,7 @@ def test_add_performance(self, temp_workspace, tmp_path, gpg_setup, trs_profile) comment="Data processing workflow", accessed_arrangement="arrangement/0", modified_arrangement="arrangement/1", - attrs=[TRPAttribute.NET_ISOLATION, TRPAttribute.RECORD_NETWORK], + attrs=["trov:InternetIsolation", TRPAttribute.RECORD_NETWORK], ) # Verify performance was added diff --git a/tro_utils/__init__.py b/tro_utils/__init__.py index 78cef8f..62ca15b 100644 --- a/tro_utils/__init__.py +++ b/tro_utils/__init__.py @@ -4,7 +4,7 @@ __author__ = """Kacper Kowalik""" __email__ = "xarthisius.kk@gmail.com" -__version__ = "0.2.0" +__version__ = "0.2.1" class MetaEnum(EnumMeta): diff --git a/tro_utils/tro_utils.py b/tro_utils/tro_utils.py index 4da5b5f..41c304d 100644 --- a/tro_utils/tro_utils.py +++ b/tro_utils/tro_utils.py @@ -495,6 +495,8 @@ def add_performance( i = 0 for attr in attrs: + if isinstance(attr, str): + attr = TRPAttribute(attr) assert attr.value in TRPAttribute cap = TROVCapability.translate(attr) if cap.value not in trs_caps.keys():