Skip to content

Commit 3011c84

Browse files
committed
Switch to dictionary comprehension per lint output.
1 parent a1abb6b commit 3011c84

File tree

1 file changed

+2
-9
lines changed
  • instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai

1 file changed

+2
-9
lines changed

instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/tool_call_wrapper.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ def _to_otel_value(python_value):
5050
if isinstance(python_value, list):
5151
return [_to_otel_value(x) for x in python_value]
5252
if isinstance(python_value, dict):
53-
return dict(
54-
[(key, _to_otel_value(val)) for (key, val) in python_value.items()]
55-
)
53+
return {key:_to_otel_value(val) for (key, val) in python_value.items()}
5654
if hasattr(python_value, "model_dump"):
5755
return python_value.model_dump()
5856
if hasattr(python_value, "__dict__"):
@@ -237,12 +235,7 @@ def wrapped(
237235
wrapped(item, otel_wrapper, **kwargs) for item in tool_or_tools
238236
]
239237
if isinstance(tool_or_tools, dict):
240-
return dict(
241-
[
242-
(key, wrapped(value, otel_wrapper, **kwargs))
243-
for (key, value) in tool_or_tools.items()
244-
]
245-
)
238+
return {key: wrapped(value, otel_wrapper, **kwargs) for (key, value) in tool_or_tools.items()}
246239
if callable(tool_or_tools):
247240
return _wrap_tool_function(tool_or_tools, otel_wrapper, **kwargs)
248241
return tool_or_tools

0 commit comments

Comments
 (0)