MCPcopy
hub / github.com/pytest-dev/pytest / _recursive_sequence_map

Function _recursive_sequence_map

src/_pytest/python_api.py:119–127  ·  view source on GitHub ↗

Recursively map a function over a sequence of arbitrary depth

(f, x)

Source from the content-addressed store, hash-verified

117
118
119def _recursive_sequence_map(f, x):
120 """Recursively map a function over a sequence of arbitrary depth"""
121 if isinstance(x, list | tuple):
122 seq_type = type(x)
123 return seq_type(_recursive_sequence_map(f, xi) for xi in x)
124 elif _is_sequence_like(x):
125 return [_recursive_sequence_map(f, xi) for xi in x]
126 else:
127 return f(x)
128
129
130class ApproxNumpy(ApproxBase):

Callers 10

test_map_over_scalarMethod · 0.90
test_map_over_listMethod · 0.90
test_map_over_tupleMethod · 0.90
__repr__Method · 0.85
_repr_compareMethod · 0.85
_repr_compareMethod · 0.85

Calls 2

_is_sequence_likeFunction · 0.85
fFunction · 0.50

Tested by 7

test_map_over_scalarMethod · 0.72
test_map_over_listMethod · 0.72
test_map_over_tupleMethod · 0.72