1memory = {}
2def memnick(*functions):
3 if len(functions) == 0:
4 def decorator(func):
5 def decorated(*args, **kwargs):
6 # functions that return string
7 text = func(*args, **kwargs)
8 person_name = text.split(", ")[0]
9 name = func.__name__.replace("_", " ").title()
10 if person_name not in memory:
11 memory[person_name] = []
12 if (name, text) not in memory[person_name]:
13 memory[person_name].append((name, text))
14 return text
15 # function name is not the original name
16 decorated.__name__ = func.__name__
17 return decorated
18 return decorator
19
20 texts = []
21 for function in functions:
22 current_name = function.__name__.replace("_", " ").title()
23 if current_name in memory:
24 for name, text in memory[current_name]:
25 texts.append(f"С гласа на {name}: {text}")
26 return texts
.....
----------------------------------------------------------------------
Ran 5 tests in 0.001s
OK
15.03.2026 14:06