Skip to content

Commit

Permalink
tools/gen-cpydiff.py: Fix formatting of doc strings for new Black.
Browse files Browse the repository at this point in the history
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 psf/black#1740

This commit makes the Python code in this repository conform to this rule.
  • Loading branch information
iabdalkader authored and pfalcon committed Jun 5, 2021
1 parent 532b90c commit c36e30b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tools/gen-cpydiff.py
Expand Up @@ -74,7 +74,7 @@


def readfiles():
""" Reads test files """
"""Reads test files"""
tests = list(filter(lambda x: x.endswith(".py"), os.listdir(TESTPATH)))
tests.sort()
files = []
Expand All @@ -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(b"import " + uimport, b"import u" + uimport + b" as " + uimport)
Expand All @@ -108,7 +108,7 @@ def clean_output(output):


def run_tests(tests):
""" executes all tests """
"""executes all tests"""
results = []
for test in tests:
with open(TESTPATH + test.name, "rb") as f:
Expand Down Expand Up @@ -157,15 +157,15 @@ 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"
return new_block


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:
Expand Down Expand Up @@ -199,7 +199,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:
Expand Down Expand Up @@ -258,7 +258,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
Expand Down

0 comments on commit c36e30b

Please sign in to comment.