Files
pgames-manager/frontend/tests/fixtures/dunders.py
T
mrleo1nidandClaude Sonnet 5.5 e48521bdfb
CI / frontend (push) Failing after 16s
CI / backend (push) Failing after 39s
feat: player runtime for goodluke and SaintlyCorruption
Text fields (`input`) with InputValue classes games can extend, continue/break in screen loops, Confirm,
CaptureFocus/ClearFocus/InvertSelected, generator functions and iter/next, starred tuple items,
renpy.file and json over data files loaded before the game starts, renpy.Container and
register_sl_displayable, DiamondBox layout, ConditionSwitch/DynamicImage/Animation, renpy.show(what=...),
callable transforms (`store.move_in(0.3)`), call_in_new_context as a call, im.matrix/im.Image/
MatrixColor, colorsys, fnmatch, FontGroup, persistent._clear and small renpy helpers.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 17:28:14 +03:00

52 lines
1.0 KiB
Python

class Perk:
def __init__(self, key):
self.key = key
def __hash__(self):
return hash(self.key)
def __eq__(self, other):
return self.key == other.key
class Bag:
def __init__(self, items):
self.items = items
def __iter__(self):
return iter(self.items)
def __getitem__(self, i):
return self.items[i]
def __contains__(self, x):
return x in self.items
table = {}
table[Perk("a")] = 1
table[Perk("a")] = 2
result_size = len(table)
result_value = table[Perk("a")]
bag = Bag([3, 4, 5])
result_loop = [x * 2 for x in bag]
result_item = bag[1]
result_in = 4 in bag
result_out = 9 in bag
def walk(values, kind):
seen = []
for value in values:
if isinstance(value, kind):
yield value
elif isinstance(value, list):
yield from walk(value, kind)
result_found = list(walk([1, "a", [2, "b", [3]], 4], int))
result_iter = iter([7, 8])
result_first = next(result_iter)
result_second = next(result_iter)
result_default = next(result_iter, "done")