Skip to content

Commit fc47105

Browse files
committed
Review fixes
1 parent d7b0378 commit fc47105

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/guidellm/utils/mixins.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
__all__ = ["InfoMixin"]
1313

1414

15+
PYTHON_PRIMITIVES = (str, int, float, bool, list, tuple, dict)
16+
"""Type alias for serialized object representations"""
17+
18+
1519
class InfoMixin:
1620
"""
1721
Mixin class providing standardized metadata extraction for introspection.
@@ -58,9 +62,7 @@ def extract_from_obj(cls, obj: Any) -> dict[str, Any]:
5862
"module": obj.__class__.__module__ if hasattr(obj, "__class__") else None,
5963
"attributes": (
6064
{
61-
key: val
62-
if isinstance(val, (str, int, float, bool, list, dict))
63-
else repr(val)
65+
key: val if isinstance(val, PYTHON_PRIMITIVES) else repr(val)
6466
for key, val in obj.__dict__.items()
6567
if not key.startswith("_")
6668
}

0 commit comments

Comments
 (0)