Skip to content

Commit 4f8d78a

Browse files
committed
rename flatten fn
1 parent 1f348cc commit 4f8d78a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ddtrace/llmobs/_integrations/langchain.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def _extract_bound(instance):
7171
return instance
7272

7373

74-
def _flatmap_chain_steps(steps: List[Any], nested: bool = True) -> List[Any]:
74+
def _flattened_chain_steps(steps: List[Any], nested: bool = True) -> List[Any]:
7575
"""
7676
Flattens the contents of a chain into non-RunnableBindings and non-RunnableParallel steps.
7777
RunnableParrallel steps are extracted and can either be nested into sublists or flattened.
@@ -111,7 +111,7 @@ def record_steps(self, instance, span):
111111
return
112112

113113
steps = getattr(instance, "steps", [])
114-
for step in _flatmap_chain_steps(steps, nested=False):
114+
for step in _flattened_chain_steps(steps, nested=False):
115115
self._chain_steps.add(id(step))
116116

117117
self.record_instance(instance, span)
@@ -237,7 +237,7 @@ def _set_input_links(self, instance: Any, span: Span, parent_span: Union[Span, N
237237

238238
chain_instance = _extract_bound(self._instances.get(invoker_spans[0]))
239239
steps = getattr(chain_instance, "steps", [])
240-
flatmap_chain_steps = _flatmap_chain_steps(steps)
240+
flatmap_chain_steps = _flattened_chain_steps(steps)
241241
for i, step in enumerate(flatmap_chain_steps):
242242
if id(step) == id(instance) or (
243243
isinstance(step, list) and any(id(sub_step) == id(instance) for sub_step in step)
@@ -322,7 +322,7 @@ def _get_popped_span_link_indecies(self, parent_span: Span, parent_links: List[D
322322
return pop_indecies
323323

324324
steps = getattr(parent_instance, "steps", [])
325-
flatmap_chain_steps = _flatmap_chain_steps(steps)
325+
flatmap_chain_steps = _flattened_chain_steps(steps)
326326
for i in range(step_idx - 1, -1, -1):
327327
step = flatmap_chain_steps[i]
328328
if id(step) in self._spans:

0 commit comments

Comments
 (0)