diff options
author | Gábor Bernát <gaborjbernat@gmail.com> | 2018-05-13 17:42:53 -0400 |
---|---|---|
committer | Oliver Bestwalter <oliver@bestwalter.de> | 2018-05-13 23:42:53 +0200 |
commit | 7a589ea6df04ae7bb9d3b43844a21a041ac01bcb (patch) | |
tree | 224616357f6ff9567e56b77b2d170d35ea38a494 /tasks | |
parent | 236cfa672af083d607a83d2b1010b76b06f75d17 (diff) | |
download | tox-git-7a589ea6df04ae7bb9d3b43844a21a041ac01bcb.tar.gz |
add automatic code format enforcer - black (#813)
* add automatic code format enforcer - black
* convert % to format
* fix double quotes in one line
* some more % to format changes
* use stable release of black
* allow unicode in description
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/pre-process-changelog.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tasks/pre-process-changelog.py b/tasks/pre-process-changelog.py index 81bcd61a..f77ac170 100644 --- a/tasks/pre-process-changelog.py +++ b/tasks/pre-process-changelog.py @@ -17,28 +17,28 @@ def include_draft_newsfragments(): current_path = os.getcwd() try: os.chdir(project_root) - cmd = ['towncrier', '--draft', '--dir', project_root] - out = subprocess.check_output(cmd).decode('utf-8').strip() - docs_build_dir = project_root / '.tox' / 'docs' / 'fragments.rst' + cmd = ["towncrier", "--draft", "--dir", project_root] + out = subprocess.check_output(cmd).decode("utf-8").strip() + docs_build_dir = project_root / ".tox" / "docs" / "fragments.rst" docs_build_dir.write(out) finally: os.chdir(current_path) def manipulate_the_news(): - home = 'https://github.com' - issue = '%s/issue' % home - fragmentsPath = Path(__file__).parents[1] / 'tox' / 'changelog' + home = "https://github.com" + issue = "{}/issue".format(home) + fragmentsPath = Path(__file__).parents[1] / "tox" / "changelog" for pattern, replacement in ( - (r'[^`]@([^,\s]+)', r'`@\1 <%s/\1>`_' % home), - (r'[^`]#([\d]+)', r'`#pr\1 <%s/\1>`_' % issue), + (r"[^`]@([^,\s]+)", r"`@\1 <{}/\1>`_".format(home)), + (r"[^`]#([\d]+)", r"`#pr\1 <{}/\1>`_".format(issue)), ): - for path in fragmentsPath.glob('*.rst'): + for path in fragmentsPath.glob("*.rst"): path.write_text(re.sub(pattern, replacement, path.read_text())) main = manipulate_the_news -if __name__ == '__main__': +if __name__ == "__main__": sys.exit(main()) |