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

Function permute_left_option_groups

Tools/clinic/libclinic/function.py:269–283  ·  view source on GitHub ↗

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

(
    l: Sequence[Iterable[Parameter]]
)

Source from the content-addressed store, hash-verified

267
268
269def permute_left_option_groups(
270 l: Sequence[Iterable[Parameter]]
271) -> Iterator[ParamTuple]:
272 """
273 Given [(1,), (2,), (3,)], should yield:
274 ()
275 (3,)
276 (2, 3)
277 (1, 2, 3)
278 """
279 yield tuple()
280 accumulator: list[Parameter] = []
281 for group in reversed(l):
282 accumulator = list(group) + accumulator
283 yield tuple(accumulator)
284
285
286def permute_right_option_groups(

Callers 2

permute_optional_groupsFunction · 0.85

Calls 1

listClass · 0.85

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…