From e6be00a63b589eeb8c89244be4701dbdba3a3705 Mon Sep 17 00:00:00 2001 From: Pablo Aguiar Date: Tue, 30 Oct 2018 20:56:55 +0100 Subject: [PATCH] Comply to new flake8 3.6 (#853) * #N/A: Ignore W504 line break after binary operator W504 is now part of flake8 current version 3.6 * #N/A: Fix invalid escape sequences * #N/A: Remove conflicting path before installing gcc with brew --- .travis.yml | 1 + tests/rules/test_ag_literal.py | 4 ++-- thefuck/rules/aws_cli.py | 2 +- thefuck/rules/az_cli.py | 2 +- thefuck/rules/heroku_multiple_apps.py | 2 +- thefuck/shells/generic.py | 2 +- tox.ini | 2 +- 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 19f345e3..96a4609e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,6 +44,7 @@ addons: - python-commandnotfound - python3-commandnotfound before_install: + - if [[ $TRAVIS_OS_NAME == "osx" ]]; then rm /usr/local/include/c++ ; fi - if [[ $TRAVIS_OS_NAME == "osx" ]]; then brew update ; fi - if [[ $TRAVIS_OS_NAME == "osx" ]]; then brew upgrade python; fi - if [[ $TRAVIS_OS_NAME == "osx" ]]; then pip3 install virtualenv; fi diff --git a/tests/rules/test_ag_literal.py b/tests/rules/test_ag_literal.py index df5f6b10..4727699a 100644 --- a/tests/rules/test_ag_literal.py +++ b/tests/rules/test_ag_literal.py @@ -9,7 +9,7 @@ def output(): 'If you meant to search for a literal string, run ag with -Q\n') -@pytest.mark.parametrize('script', ['ag \(']) +@pytest.mark.parametrize('script', ['ag \\(']) def test_match(script, output): assert match(Command(script, output)) @@ -20,6 +20,6 @@ def test_not_match(script): @pytest.mark.parametrize('script, new_cmd', [ - ('ag \(', 'ag -Q \(')]) + ('ag \\(', 'ag -Q \\(')]) def test_get_new_command(script, new_cmd, output): assert get_new_command((Command(script, output))) == new_cmd diff --git a/thefuck/rules/aws_cli.py b/thefuck/rules/aws_cli.py index 1c665827..8b22e459 100644 --- a/thefuck/rules/aws_cli.py +++ b/thefuck/rules/aws_cli.py @@ -3,7 +3,7 @@ import re from thefuck.utils import for_app, replace_argument INVALID_CHOICE = "(?<=Invalid choice: ')(.*)(?=', maybe you meant:)" -OPTIONS = "^\s*\*\s(.*)" +OPTIONS = "^\\s*\\*\\s(.*)" @for_app('aws') diff --git a/thefuck/rules/az_cli.py b/thefuck/rules/az_cli.py index ae538340..3583228d 100644 --- a/thefuck/rules/az_cli.py +++ b/thefuck/rules/az_cli.py @@ -3,7 +3,7 @@ import re from thefuck.utils import for_app, replace_argument INVALID_CHOICE = "(?=az)(?:.*): '(.*)' is not in the '.*' command group." -OPTIONS = "^The most similar choice to '.*' is:\n\s*(.*)$" +OPTIONS = "^The most similar choice to '.*' is:\n\\s*(.*)$" @for_app('az') diff --git a/thefuck/rules/heroku_multiple_apps.py b/thefuck/rules/heroku_multiple_apps.py index 268968bb..dddc2a83 100644 --- a/thefuck/rules/heroku_multiple_apps.py +++ b/thefuck/rules/heroku_multiple_apps.py @@ -8,5 +8,5 @@ def match(command): def get_new_command(command): - apps = re.findall('([^ ]*) \([^)]*\)', command.output) + apps = re.findall('([^ ]*) \\([^)]*\\)', command.output) return [command.script + ' --app ' + app for app in apps] diff --git a/thefuck/shells/generic.py b/thefuck/shells/generic.py index 6d1eb962..ddd868ae 100644 --- a/thefuck/shells/generic.py +++ b/thefuck/shells/generic.py @@ -82,7 +82,7 @@ class Generic(object): encoded = self.encode_utf8(command) try: - splitted = [s.replace("??", "\ ") for s in shlex.split(encoded.replace('\ ', '??'))] + splitted = [s.replace("??", "\\ ") for s in shlex.split(encoded.replace('\\ ', '??'))] except ValueError: splitted = encoded.split(' ') diff --git a/tox.ini b/tox.ini index 31200cbe..63391c64 100644 --- a/tox.ini +++ b/tox.ini @@ -6,5 +6,5 @@ deps = -rrequirements.txt commands = py.test -v --capture=sys [flake8] -ignore = E501,W503 +ignore = E501,W503,W504 exclude = venv,build,.tox,setup.py,fastentrypoints.py