MCPcopy Create free account
hub / github.com/python/cpython / permute_right_option_groups

Function permute_right_option_groups

Tools/clinic/libclinic/function.py:286–300  ·  view source on GitHub ↗

Given [(1,), (2,), (3,)], should yield: () (1,) (1, 2) (1, 2, 3)

(
    l: Sequence[Iterable[Parameter]]
)

Source from the content-addressed store, hash-verified

284
285
286def permute_right_option_groups(
287 l: Sequence[Iterable[Parameter]]
288) -> Iterator[ParamTuple]:
289 """
290 Given [(1,), (2,), (3,)], should yield:
291 ()
292 (1,)
293 (1, 2)
294 (1, 2, 3)
295 """
296 yield tuple()
297 accumulator: list[Parameter] = []
298 for group in l:
299 accumulator.extend(group)
300 yield tuple(accumulator)
301
302
303def permute_optional_groups(

Callers 2

permute_optional_groupsFunction · 0.85

Calls 1

extendMethod · 0.45

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…