1from collections import defaultdict
2
3memory = defaultdict(set)
4
5
6def memnick(*args):
7 if not args:
8
9 def decorator(func):
10 def nested(*args, **kwargs): # не измислих др име :(
11 func_name = func.__name__
12 result = func(*args, **kwargs)
13 memory[func_name].add(result)
14 return result
15
16 nested.__name__ = func.__name__
17 return nested
18
19 return decorator
20
21 result = []
22 for arg in args:
23 currentName = arg.__name__.replace("_", " ").title()
24 for key in memory.keys():
25 for current_string in memory[key]:
26 if currentName in current_string:
27 result.append(
28 f"С гласа на {key.replace("_", " ").title()}: {current_string}"
29 )
30 return result
.....
----------------------------------------------------------------------
Ran 5 tests in 0.001s
OK
15.03.2026 14:23
15.03.2026 14:26