Skip to content

Commit 6bc905c

Browse files
committed
step8
1 parent 413c7c9 commit 6bc905c

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

gendiff/formaters/plain.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,29 @@ def format_plain(diff, path=""):
77

88
if status == "added":
99
formatted_value = format_value(value["value"])
10-
lines.append(f"Property '{property_path}' was added with value: {formatted_value}")
10+
lines.append(
11+
f"Property '{property_path}' "
12+
f"was added with value: {formatted_value}"
13+
)
1114

1215
elif status == "removed":
1316
lines.append(f"Property '{property_path}' was removed")
14-
1517
elif status == "modified":
1618
old_value = format_value(value["old_value"])
1719
new_value = format_value(value["new_value"])
1820
lines.append(
19-
f"Property '{property_path}' was updated. From {old_value} to {new_value}"
21+
f"Property '{property_path}' was updated. "
22+
f"From {old_value} to {new_value}"
2023
)
21-
2224
elif status == "nested":
23-
lines.extend(format_plain(value["children"], property_path).split('\n'))
25+
lines.extend(
26+
format_plain(value["children"], property_path).split('\n')
27+
)
2428

2529
return "\n".join(lines)
2630

2731

2832
def format_value(value):
29-
"""Форматирует значение для plain-вывода."""
3033
if isinstance(value, dict):
3134
return "[complex value]"
3235
if isinstance(value, bool):
@@ -35,4 +38,4 @@ def format_value(value):
3538
return "null"
3639
if isinstance(value, str):
3740
return f"'{value}'"
38-
return str(value)
41+
return str(value)

0 commit comments

Comments
 (0)