diff --git a/tests/rules/test_brew_unknown_command.py b/tests/rules/test_brew_unknown_command.py index 45e02f67..2185b867 100644 --- a/tests/rules/test_brew_unknown_command.py +++ b/tests/rules/test_brew_unknown_command.py @@ -21,8 +21,8 @@ def test_match(brew_unknown_cmd): def test_get_new_command(brew_unknown_cmd, brew_unknown_cmd2): - assert get_new_command(Command('brew inst', stderr=brew_unknown_cmd)) \ - == ['brew list', 'brew install', 'brew uninstall'] + assert (get_new_command(Command('brew inst', stderr=brew_unknown_cmd)) + == ['brew list', 'brew install', 'brew uninstall']) cmds = get_new_command(Command('brew instaa', stderr=brew_unknown_cmd2)) assert 'brew install' in cmds diff --git a/tests/rules/test_composer_not_command.py b/tests/rules/test_composer_not_command.py index c4e4a5a4..bb0a45dc 100644 --- a/tests/rules/test_composer_not_command.py +++ b/tests/rules/test_composer_not_command.py @@ -48,9 +48,9 @@ def test_match(composer_not_command, composer_not_command_one_of_this): def test_get_new_command(composer_not_command, composer_not_command_one_of_this): - assert get_new_command(Command('composer udpate', - stderr=composer_not_command)) \ - == 'composer update' + assert (get_new_command(Command('composer udpate', + stderr=composer_not_command)) + == 'composer update') assert get_new_command( Command('composer pdate', stderr=composer_not_command_one_of_this)) \ == 'composer selfupdate' diff --git a/tests/rules/test_dirty_untar.py b/tests/rules/test_dirty_untar.py index b33a8900..01ff6927 100644 --- a/tests/rules/test_dirty_untar.py +++ b/tests/rules/test_dirty_untar.py @@ -2,7 +2,7 @@ import os import pytest import tarfile from thefuck.rules.dirty_untar import match, get_new_command, side_effect, \ - tar_extensions + tar_extensions # noqa: E126 from tests.utils import Command diff --git a/tests/rules/test_django_south_merge.py b/tests/rules/test_django_south_merge.py index 13f7dbaf..581a1cf3 100644 --- a/tests/rules/test_django_south_merge.py +++ b/tests/rules/test_django_south_merge.py @@ -39,5 +39,5 @@ def test_match(stderr): def test_get_new_command(): - assert get_new_command(Command('./manage.py migrate auth')) \ - == './manage.py migrate auth --merge' + assert (get_new_command(Command('./manage.py migrate auth')) + == './manage.py migrate auth --merge') diff --git a/tests/rules/test_git_not_command.py b/tests/rules/test_git_not_command.py index 6257767e..a65e3a3d 100644 --- a/tests/rules/test_git_not_command.py +++ b/tests/rules/test_git_not_command.py @@ -49,8 +49,8 @@ def test_match(git_not_command, git_command, git_not_command_one_of_this): def test_get_new_command(git_not_command, git_not_command_one_of_this, git_not_command_closest): - assert get_new_command(Command('git brnch', stderr=git_not_command)) \ - == ['git branch'] + assert (get_new_command(Command('git brnch', stderr=git_not_command)) + == ['git branch']) assert get_new_command(Command('git st', stderr=git_not_command_one_of_this)) \ == ['git stats', 'git stash', 'git stage'] assert get_new_command(Command('git tags', stderr=git_not_command_closest)) \ diff --git a/tests/rules/test_git_pull.py b/tests/rules/test_git_pull.py index 11c50171..d24e400c 100644 --- a/tests/rules/test_git_pull.py +++ b/tests/rules/test_git_pull.py @@ -25,5 +25,5 @@ def test_match(stderr): def test_get_new_command(stderr): - assert get_new_command(Command('git pull', stderr=stderr)) \ - == "git branch --set-upstream-to=origin/master master && git pull" + assert (get_new_command(Command('git pull', stderr=stderr)) + == "git branch --set-upstream-to=origin/master master && git pull") diff --git a/tests/rules/test_git_pull_uncommitted_changes.py b/tests/rules/test_git_pull_uncommitted_changes.py index 480b31d8..e32a7370 100644 --- a/tests/rules/test_git_pull_uncommitted_changes.py +++ b/tests/rules/test_git_pull_uncommitted_changes.py @@ -15,5 +15,5 @@ def test_match(stderr): def test_get_new_command(stderr): - assert get_new_command(Command('git pull', stderr=stderr)) \ - == "git stash && git pull && git stash pop" + assert (get_new_command(Command('git pull', stderr=stderr)) + == "git stash && git pull && git stash pop") diff --git a/tests/rules/test_git_pull_unstaged_changes.py b/tests/rules/test_git_pull_unstaged_changes.py index a8cbb4c3..ef3d94ea 100644 --- a/tests/rules/test_git_pull_unstaged_changes.py +++ b/tests/rules/test_git_pull_unstaged_changes.py @@ -15,5 +15,5 @@ def test_match(stderr): def test_get_new_command(stderr): - assert get_new_command(Command('git pull', stderr=stderr)) \ - == "git stash && git pull && git stash pop" + assert (get_new_command(Command('git pull', stderr=stderr)) + == "git stash && git pull && git stash pop") diff --git a/tests/rules/test_git_stash.py b/tests/rules/test_git_stash.py index da9aded7..53cdce42 100644 --- a/tests/rules/test_git_stash.py +++ b/tests/rules/test_git_stash.py @@ -4,14 +4,14 @@ from tests.utils import Command cherry_pick_error = ( - 'error: Your local changes would be overwritten by cherry-pick.\n' - 'hint: Commit your changes or stash them to proceed.\n' - 'fatal: cherry-pick failed') + 'error: Your local changes would be overwritten by cherry-pick.\n' + 'hint: Commit your changes or stash them to proceed.\n' + 'fatal: cherry-pick failed') rebase_error = ( - 'Cannot rebase: Your index contains uncommitted changes.\n' - 'Please commit or stash them.') + 'Cannot rebase: Your index contains uncommitted changes.\n' + 'Please commit or stash them.') @pytest.mark.parametrize('command', [ diff --git a/tests/rules/test_lein_not_task.py b/tests/rules/test_lein_not_task.py index b4fc4498..8b3420c2 100644 --- a/tests/rules/test_lein_not_task.py +++ b/tests/rules/test_lein_not_task.py @@ -19,5 +19,5 @@ def test_match(is_not_task): def test_get_new_command(is_not_task): - assert get_new_command(Command(script='lein rpl --help', stderr=is_not_task)) \ - == ['lein repl --help', 'lein jar --help'] + assert (get_new_command(Command(script='lein rpl --help', stderr=is_not_task)) + == ['lein repl --help', 'lein jar --help']) diff --git a/tests/rules/test_python_command.py b/tests/rules/test_python_command.py index 053457da..234d2e54 100644 --- a/tests/rules/test_python_command.py +++ b/tests/rules/test_python_command.py @@ -8,5 +8,5 @@ def test_match(): def test_get_new_command(): - assert get_new_command(Command('./test_sudo.py'))\ - == 'python ./test_sudo.py' + assert (get_new_command(Command('./test_sudo.py')) + == 'python ./test_sudo.py') diff --git a/tests/rules/test_rm_root.py b/tests/rules/test_rm_root.py index 47c243f8..fe419904 100644 --- a/tests/rules/test_rm_root.py +++ b/tests/rules/test_rm_root.py @@ -17,5 +17,5 @@ def test_not_match(command): def test_get_new_command(): - assert get_new_command(Command(script='rm -rf /')) \ - == 'rm -rf / --no-preserve-root' + assert (get_new_command(Command(script='rm -rf /')) + == 'rm -rf / --no-preserve-root') diff --git a/tests/rules/test_sed_unterminated_s.py b/tests/rules/test_sed_unterminated_s.py index 0c890efd..7b2bf78d 100644 --- a/tests/rules/test_sed_unterminated_s.py +++ b/tests/rules/test_sed_unterminated_s.py @@ -18,11 +18,11 @@ def test_match(sed_unterminated_s): def test_get_new_command(sed_unterminated_s): - assert get_new_command(Command('sed -e s/foo/bar', stderr=sed_unterminated_s)) \ - == 'sed -e s/foo/bar/' - assert get_new_command(Command('sed -es/foo/bar', stderr=sed_unterminated_s)) \ - == 'sed -es/foo/bar/' - assert get_new_command(Command(r"sed -e 's/\/foo/bar'", stderr=sed_unterminated_s)) \ - == r"sed -e 's/\/foo/bar/'" - assert get_new_command(Command(r"sed -e s/foo/bar -es/baz/quz", stderr=sed_unterminated_s)) \ - == r"sed -e s/foo/bar/ -es/baz/quz/" + assert (get_new_command(Command('sed -e s/foo/bar', stderr=sed_unterminated_s)) + == 'sed -e s/foo/bar/') + assert (get_new_command(Command('sed -es/foo/bar', stderr=sed_unterminated_s)) + == 'sed -es/foo/bar/') + assert (get_new_command(Command(r"sed -e 's/\/foo/bar'", stderr=sed_unterminated_s)) + == r"sed -e 's/\/foo/bar/'") + assert (get_new_command(Command(r"sed -e s/foo/bar -es/baz/quz", stderr=sed_unterminated_s)) + == r"sed -e s/foo/bar/ -es/baz/quz/") diff --git a/tests/test_types.py b/tests/test_types.py index 9cb951ba..d23ed85c 100644 --- a/tests/test_types.py +++ b/tests/test_types.py @@ -13,10 +13,10 @@ from thefuck.system import Path class TestCorrectedCommand(object): def test_equality(self): - assert CorrectedCommand('ls', None, 100) == \ - CorrectedCommand('ls', None, 200) - assert CorrectedCommand('ls', None, 100) != \ - CorrectedCommand('ls', lambda *_: _, 100) + assert (CorrectedCommand('ls', None, 100) == + CorrectedCommand('ls', None, 200)) + assert (CorrectedCommand('ls', None, 100) != + CorrectedCommand('ls', lambda *_: _, 100)) def test_hashable(self): assert {CorrectedCommand('ls', None, 100), diff --git a/thefuck/main.py b/thefuck/main.py index 6896554e..5fa9e7c0 100644 --- a/thefuck/main.py +++ b/thefuck/main.py @@ -59,11 +59,10 @@ def how_to_configure_alias(): def main(): parser = ArgumentParser(prog='thefuck') version = get_installation_info().version - parser.add_argument( - '-v', '--version', - action='version', - version='The Fuck {} using Python {}'.format( - version, sys.version.split()[0])) + parser.add_argument('-v', '--version', + action='version', + version='The Fuck {} using Python {}'.format( + version, sys.version.split()[0])) parser.add_argument('-a', '--alias', action='store_true', help='[custom-alias-name] prints alias for current shell') diff --git a/thefuck/rules/brew_unknown_command.py b/thefuck/rules/brew_unknown_command.py index 35f6e937..1d8186e6 100644 --- a/thefuck/rules/brew_unknown_command.py +++ b/thefuck/rules/brew_unknown_command.py @@ -54,8 +54,8 @@ def _brew_commands(): brew_path_prefix = get_brew_path_prefix() if brew_path_prefix: try: - return _get_brew_commands(brew_path_prefix) \ - + _get_brew_tap_specific_commands(brew_path_prefix) + return (_get_brew_commands(brew_path_prefix) + + _get_brew_tap_specific_commands(brew_path_prefix)) except OSError: pass diff --git a/thefuck/rules/dirty_unzip.py b/thefuck/rules/dirty_unzip.py index 23878f5f..3f74ef14 100644 --- a/thefuck/rules/dirty_unzip.py +++ b/thefuck/rules/dirty_unzip.py @@ -39,7 +39,7 @@ def match(command): def get_new_command(command): return u'{} -d {}'.format( - command.script, shell.quote(_zip_file(command)[:-4])) + command.script, shell.quote(_zip_file(command)[:-4])) def side_effect(old_cmd, command): diff --git a/thefuck/rules/workon_doesnt_exists.py b/thefuck/rules/workon_doesnt_exists.py index 6c97ce49..41d17c07 100644 --- a/thefuck/rules/workon_doesnt_exists.py +++ b/thefuck/rules/workon_doesnt_exists.py @@ -26,7 +26,7 @@ def get_new_command(command): available = _get_all_environments() if available: - return replace_command(command, misspelled_env, available) \ - + [create_new] + return (replace_command(command, misspelled_env, available) + + [create_new]) else: return create_new diff --git a/thefuck/shells/tcsh.py b/thefuck/shells/tcsh.py index 6c355caa..3f5bc004 100644 --- a/thefuck/shells/tcsh.py +++ b/thefuck/shells/tcsh.py @@ -19,9 +19,9 @@ class Tcsh(Generic): def get_aliases(self): proc = Popen(['tcsh', '-ic', 'alias'], stdout=PIPE, stderr=DEVNULL) return dict( - self._parse_alias(alias) - for alias in proc.stdout.read().decode('utf-8').split('\n') - if alias and '\t' in alias) + self._parse_alias(alias) + for alias in proc.stdout.read().decode('utf-8').split('\n') + if alias and '\t' in alias) def _get_history_file_name(self): return os.environ.get("HISTFILE", diff --git a/thefuck/types.py b/thefuck/types.py index 64d8c718..a66f3df8 100644 --- a/thefuck/types.py +++ b/thefuck/types.py @@ -39,8 +39,8 @@ class Command(object): def __eq__(self, other): if isinstance(other, Command): - return (self.script, self.stdout, self.stderr) \ - == (other.script, other.stdout, other.stderr) + return ((self.script, self.stdout, self.stderr) + == (other.script, other.stdout, other.stderr)) else: return False @@ -158,12 +158,12 @@ class Rule(object): def __eq__(self, other): if isinstance(other, Rule): - return (self.name, self.match, self.get_new_command, - self.enabled_by_default, self.side_effect, - self.priority, self.requires_output) \ - == (other.name, other.match, other.get_new_command, - other.enabled_by_default, other.side_effect, - other.priority, other.requires_output) + return ((self.name, self.match, self.get_new_command, + self.enabled_by_default, self.side_effect, + self.priority, self.requires_output) + == (other.name, other.match, other.get_new_command, + other.enabled_by_default, other.side_effect, + other.priority, other.requires_output)) else: return False @@ -171,9 +171,9 @@ class Rule(object): return 'Rule(name={}, match={}, get_new_command={}, ' \ 'enabled_by_default={}, side_effect={}, ' \ 'priority={}, requires_output)'.format( - self.name, self.match, self.get_new_command, - self.enabled_by_default, self.side_effect, - self.priority, self.requires_output) + self.name, self.match, self.get_new_command, + self.enabled_by_default, self.side_effect, + self.priority, self.requires_output) @classmethod def from_path(cls, path):