summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriabdalkader <i.abdalkader@gmail.com>2021-04-27 01:15:43 +0200
committerDamien George <damien@micropython.org>2021-04-27 23:41:21 +1000
commit0f78c36c5aa458a954eed39a46942209107a553e (patch)
treeae470fa680d45121fba8a59bf5629f72df6a7933
parent65b90cd0f9cb3ee8b5954820cd6d68b782121cd1 (diff)
tools/gen-cpydiff.py: Fix formatting of doc strings for new Black.
Since version 21.4b0, Black now processes one-line docstrings by stripping leading and trailing spaces, and adding a padding space when needed to break up """"; see https://github.com/psf/black/pull/1740 This commit makes the Python code in this repository conform to this rule.
-rw-r--r--tools/gen-cpydiff.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/gen-cpydiff.py b/tools/gen-cpydiff.py
index c45bad105..c9f58ec50 100644
--- a/tools/gen-cpydiff.py
+++ b/tools/gen-cpydiff.py
@@ -74,7 +74,7 @@ Output = namedtuple(
def readfiles():
- """ Reads test files """
+ """Reads test files"""
tests = list(filter(lambda x: x.endswith(".py"), os.listdir(TESTPATH)))
tests.sort()
files = []
@@ -95,7 +95,7 @@ def readfiles():
def uimports(code):
- """ converts CPython module names into MicroPython equivalents """
+ """converts CPython module names into MicroPython equivalents"""
for uimport in UIMPORTLIST:
uimport = bytes(uimport, "utf8")
code = code.replace(uimport, b"u" + uimport)
@@ -103,7 +103,7 @@ def uimports(code):
def run_tests(tests):
- """ executes all tests """
+ """executes all tests"""
results = []
for test in tests:
with open(TESTPATH + test.name, "rb") as f:
@@ -152,7 +152,7 @@ def run_tests(tests):
def indent(block, spaces):
- """ indents paragraphs of text for rst formatting """
+ """indents paragraphs of text for rst formatting"""
new_block = ""
for line in block.split("\n"):
new_block += spaces + line + "\n"
@@ -160,7 +160,7 @@ def indent(block, spaces):
def gen_table(contents):
- """ creates a table given any set of columns """
+ """creates a table given any set of columns"""
xlengths = []
ylengths = []
for column in contents:
@@ -194,7 +194,7 @@ def gen_table(contents):
def gen_rst(results):
- """ creates restructured text documents to display tests """
+ """creates restructured text documents to display tests"""
# make sure the destination directory exists
try:
@@ -254,7 +254,7 @@ def gen_rst(results):
def main():
- """ Main function """
+ """Main function"""
# set search path so that test scripts find the test modules (and no other ones)
os.environ["PYTHONPATH"] = TESTPATH