1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-01-18 20:11:17 +00:00

Fix flake8 errors: E126 continuation line over-indented for hanging indent

This commit is contained in:
Joseph Frazier 2016-10-06 14:51:22 -04:00
parent 1b30c00546
commit e0cab4fa1b
20 changed files with 62 additions and 63 deletions

View File

@ -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

View File

@ -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'

View File

@ -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

View File

@ -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')

View File

@ -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)) \

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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', [

View File

@ -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'])

View File

@ -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')

View File

@ -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')

View File

@ -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/")

View File

@ -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),

View File

@ -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')

View File

@ -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

View File

@ -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):

View File

@ -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

View File

@ -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",

View File

@ -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):