Skip to content

Commit 357cae1

Browse files
committed
chore: regenerate snapshots
1 parent 0162cd0 commit 357cae1

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

workspaces/adventure-pack/src/app/__tests__/__snapshots__/equip-test.ts.snap

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2835,17 +2835,26 @@ exports[`App can equip single goody: Python 3 flatten 1`] = `
28352835
# Running at: https://example.com/
28362836

28372837
from typing import Generator, TypeVar
2838+
from math import inf
28382839

28392840
T = TypeVar("T")
28402841
NestedList = T | list["NestedList"]
28412842

28422843

2843-
def flatten(self: NestedList) -> Generator[T, None, None]:
2844-
for i in self:
2845-
if isinstance(i, list):
2846-
yield from flatten(i)
2844+
def flatten(
2845+
nested_list: NestedList, depth: int = inf
2846+
) -> Generator[T, None, None]:
2847+
"""Flatten a nested list up to the specified depth.
2848+
2849+
Args:
2850+
nested_list: The nested list to flatten
2851+
depth: The maximum depth to flatten. Default is infinity (flatten all levels).
2852+
"""
2853+
for item in nested_list if isinstance(nested_list, list) else [nested_list]:
2854+
if isinstance(item, list) and depth > 0:
2855+
yield from flatten(item, depth - 1)
28472856
else:
2848-
yield i
2857+
yield item
28492858

28502859
########################### END ADVENTURE PACK CODE ############################"
28512860
`;

workspaces/adventure-pack/src/app/__tests__/__snapshots__/render-test.ts.snap

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,17 +1579,26 @@ exports[`App can render goody: Python 3 UnionFind 1`] = `
15791579
15801580
exports[`App can render goody: Python 3 flatten 1`] = `
15811581
"from typing import Generator, TypeVar
1582+
from math import inf
15821583
15831584
T = TypeVar("T")
15841585
NestedList = T | list["NestedList"]
15851586
15861587
1587-
def flatten(self: NestedList) -> Generator[T, None, None]:
1588-
for i in self:
1589-
if isinstance(i, list):
1590-
yield from flatten(i)
1588+
def flatten(
1589+
nested_list: NestedList, depth: int = inf
1590+
) -> Generator[T, None, None]:
1591+
"""Flatten a nested list up to the specified depth.
1592+
1593+
Args:
1594+
nested_list: The nested list to flatten
1595+
depth: The maximum depth to flatten. Default is infinity (flatten all levels).
1596+
"""
1597+
for item in nested_list if isinstance(nested_list, list) else [nested_list]:
1598+
if isinstance(item, list) and depth > 0:
1599+
yield from flatten(item, depth - 1)
15911600
else:
1592-
yield i"
1601+
yield item"
15931602
`;
15941603
15951604
exports[`App can render goody: Python 3 int.digits 1`] = `

0 commit comments

Comments
 (0)