This commit is contained in:
2024-02-21 19:14:58 +03:00
parent 88cd6e1060
commit 214af0cf51
33 changed files with 750 additions and 773 deletions

View File

@@ -29,19 +29,19 @@ def apply_diff(original, diff):
The modified string.
"""
result = []
pattern = re.compile(r"^(\+|-) ")
pattern = re.compile(r'^(\+|-) ')
for line in diff:
match = pattern.match(line)
if match:
op = match.group(1)
content = line[2:]
if op == "+":
if op == '+':
result.append(content)
elif op == "-":
elif op == '-':
# Ignore deleted lines
pass
else:
result.append(line)
return " ".join(result)
return ' '.join(result)