Skip to content

Commit 88e1699

Browse files
etc: fix strip_whitespace_from_doc.py
1 parent 854e8fc commit 88e1699

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

etc/strip_whitespace_from_doc.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
Note that this requires a working version of rstfmt
44
"""
55

6-
import sys, os, re, subprocess
6+
import sys
7+
import os
8+
import re
9+
import subprocess
710

811
temp_rst_file = "temp_doc_string_rst.rst"
912
files = sys.argv[1:]
@@ -59,8 +62,10 @@
5962
stderr=subprocess.DEVNULL,
6063
check=True,
6164
)
62-
except subprocess.CalledProcessError as e:
63-
print(f"Formatting failed for:\n{"".join(content[start:end])}\n in {file}")
65+
except subprocess.CalledProcessError:
66+
print(
67+
rf"Formatting failed for:\n{''.join(content[start:end])}\n in {file}"
68+
)
6469

6570
with open(temp_rst_file, "r") as f:
6671
formatted_content = f.readlines()
@@ -75,9 +80,6 @@
7580
with open(file, "w") as f:
7681
f.writelines(content)
7782

78-
if len(blocks) == 0:
79-
print("No changes made")
80-
8183
try:
8284
os.remove(temp_rst_file)
8385
except OSError:

0 commit comments

Comments
 (0)