From a45b649c175c12be9fb6f8b51854cf3076b5e1bc Mon Sep 17 00:00:00 2001 From: Martin Vilcans Date: Wed, 12 Feb 2020 23:00:44 +0100 Subject: Replace pep8 with pycodestyle, get rid of warnings pep8 recommended that change --- bin/test | 4 ++-- requirements.txt | 2 +- screenplain/main.py | 1 + screenplain/richstring.py | 1 + tests/files_test.py | 3 ++- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/bin/test b/bin/test index 025248e..4ffcb17 100755 --- a/bin/test +++ b/bin/test @@ -2,7 +2,7 @@ if [[ $(python -V 2>&1) =~ "Python 2" ]] then nosetests --nocapture --with-doctest --doctest-tests -I ^test.py $* && \ - pep8 --ignore=E402 screenplain tests + pycodestyle --ignore=E402,W504 screenplain tests else - python test.py && pep8 --ignore=E402 screenplain tests + python test.py && pycodestyle --ignore=E402,W504 screenplain tests fi diff --git a/requirements.txt b/requirements.txt index 50f908b..97231be 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ reportlab unittest2 nose -pep8 +pycodestyle six diff --git a/screenplain/main.py b/screenplain/main.py index 770427c..aaad69c 100644 --- a/screenplain/main.py +++ b/screenplain/main.py @@ -133,5 +133,6 @@ def main(args): if output_file: output.close() + if __name__ == '__main__': main(sys.argv[1:]) diff --git a/screenplain/richstring.py b/screenplain/richstring.py index ad667d1..806787e 100644 --- a/screenplain/richstring.py +++ b/screenplain/richstring.py @@ -225,6 +225,7 @@ class _CreateStyledString(object): def __add__(self, other): return _CreateStyledString(self.styles.union(other.styles)) + plain = _CreateStyledString(()) bold = _CreateStyledString((Bold,)) italic = _CreateStyledString((Italic,)) diff --git a/tests/files_test.py b/tests/files_test.py index b5a390c..4254f55 100644 --- a/tests/files_test.py +++ b/tests/files_test.py @@ -15,7 +15,7 @@ from screenplain.main import main source_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'files')) -line_break_re = re.compile('\s*\n\s*') +line_break_re = re.compile('\\s*\n\\s*') spaces_re = re.compile('[ \t]+') @@ -115,4 +115,5 @@ def _create_tests(): ): FileTests.add_file_case(source, expected) + _create_tests() -- cgit