Skip to content

Commit a908e17

Browse files
committed
Implement nicer fix
Implement nicer fix from #168 and switch to previous test framework for older Python versions.
1 parent a29a059 commit a908e17

1 file changed

Lines changed: 5 additions & 24 deletions

File tree

fprettify/__init__.py

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,8 +1416,6 @@ def replace_relational_single_fline(f_line, cstyle):
14161416
.ne. <--> /=
14171417
"""
14181418

1419-
# keep track of whether the line may be affected
1420-
line_affected = False
14211419
new_line = f_line
14221420

14231421
# only act on lines that do contain a relation
@@ -1461,25 +1459,8 @@ def replace_relational_single_fline(f_line, cstyle):
14611459
line_parts[pos] = part
14621460

14631461
new_line = "".join(line_parts)
1464-
line_affected = True
14651462

1466-
return new_line, line_affected
1467-
1468-
1469-
def replace_relational_lines(lines, cstyle):
1470-
"""
1471-
format a list of lines - replaces scalar relational
1472-
operators in logical expressions to either Fortran or C-style
1473-
by calling original function for single line.
1474-
"""
1475-
1476-
new_lines = []
1477-
1478-
for f_line in lines:
1479-
new_line, changed = replace_relational_single_fline(f_line, cstyle)
1480-
new_lines.append(new_line)
1481-
1482-
return new_lines
1463+
return new_line
14831464

14841465

14851466
def replace_keywords_single_fline(f_line, case_dict):
@@ -2260,14 +2241,14 @@ def reformat_ffile_combined(
22602241
f_line = f_line.strip(" ")
22612242

22622243
if impose_replacements:
2263-
f_line, relation_found = replace_relational_single_fline(f_line, cstyle)
2264-
if relation_found:
2265-
updated_lines = replace_relational_lines(lines, cstyle)
2266-
linebreak_pos = get_linebreak_pos(updated_lines, filter_fypp=not indent_fypp)
2244+
f_line = replace_relational_single_fline(f_line, cstyle)
2245+
lines = [replace_relational_single_fline(l, cstyle) for l in lines]
22672246

22682247
if impose_case:
22692248
f_line = replace_keywords_single_fline(f_line, case_dict)
22702249

2250+
linebreak_pos = get_linebreak_pos(lines, filter_fypp=not indent_fypp)
2251+
22712252
if impose_whitespace:
22722253
lines = format_single_fline(
22732254
f_line,

0 commit comments

Comments
 (0)