From e009f0a05b1b98793b63ea6333b278168341478f Mon Sep 17 00:00:00 2001 From: Joseph Frazier <1212jtraceur@gmail.com> Date: Wed, 8 Mar 2017 19:53:54 -0500 Subject: [PATCH] Fix flake8 errors: E305 expected 2 blank lines after class or function definition --- tests/rules/test_dirty_untar.py | 1 + thefuck/rules/dry.py | 1 + thefuck/rules/fix_file.py | 2 ++ thefuck/rules/git_fix_stash.py | 1 + thefuck/rules/man_no_space.py | 1 + thefuck/rules/pacman.py | 1 + thefuck/system/unix.py | 2 ++ thefuck/system/win32.py | 2 ++ thefuck/utils.py | 4 ++++ 9 files changed, 15 insertions(+) diff --git a/tests/rules/test_dirty_untar.py b/tests/rules/test_dirty_untar.py index 01ff6927..5308a4e5 100644 --- a/tests/rules/test_dirty_untar.py +++ b/tests/rules/test_dirty_untar.py @@ -33,6 +33,7 @@ def tar_error(tmpdir): return fixture + parametrize_extensions = pytest.mark.parametrize('ext', tar_extensions) # (filename as typed by the user, unquoted filename, quoted filename as per shells.quote) diff --git a/thefuck/rules/dry.py b/thefuck/rules/dry.py index cfc91da8..dce9b3d7 100644 --- a/thefuck/rules/dry.py +++ b/thefuck/rules/dry.py @@ -9,6 +9,7 @@ def match(command): def get_new_command(command): return ' '.join(command.script_parts[1:]) + # it should be rare enough to actually have to type twice the same word, so # this rule can have a higher priority to come before things like "cd cd foo" priority = 900 diff --git a/thefuck/rules/fix_file.py b/thefuck/rules/fix_file.py index a83034d4..b10cf047 100644 --- a/thefuck/rules/fix_file.py +++ b/thefuck/rules/fix_file.py @@ -40,6 +40,8 @@ def _make_pattern(pattern): .replace('{line}', '(?P[0-9]+)') \ .replace('{col}', '(?P[0-9]+)') return re.compile(pattern, re.MULTILINE) + + patterns = [_make_pattern(p).search for p in patterns] diff --git a/thefuck/rules/git_fix_stash.py b/thefuck/rules/git_fix_stash.py index 19cef4c3..0ff01b92 100644 --- a/thefuck/rules/git_fix_stash.py +++ b/thefuck/rules/git_fix_stash.py @@ -11,6 +11,7 @@ def match(command): else: return False + # git's output here is too complicated to be parsed (see the test file) stash_commands = ( 'apply', diff --git a/thefuck/rules/man_no_space.py b/thefuck/rules/man_no_space.py index c5869345..2d5d74e6 100644 --- a/thefuck/rules/man_no_space.py +++ b/thefuck/rules/man_no_space.py @@ -6,4 +6,5 @@ def match(command): def get_new_command(command): return u'man {}'.format(command.script[3:]) + priority = 2000 diff --git a/thefuck/rules/pacman.py b/thefuck/rules/pacman.py index 13a08d65..779ed20f 100644 --- a/thefuck/rules/pacman.py +++ b/thefuck/rules/pacman.py @@ -13,4 +13,5 @@ def get_new_command(command): return [formatme.format(pacman, package, command.script) for package in packages] + enabled_by_default, pacman = archlinux_env() diff --git a/thefuck/system/unix.py b/thefuck/system/unix.py index ca878033..0d4565bf 100644 --- a/thefuck/system/unix.py +++ b/thefuck/system/unix.py @@ -35,6 +35,7 @@ def get_key(): return ch + try: from pathlib import Path except ImportError: @@ -44,5 +45,6 @@ except ImportError: def _expanduser(self): return self.__class__(os.path.expanduser(str(self))) + if not hasattr(Path, 'expanduser'): Path.expanduser = _expanduser diff --git a/thefuck/system/win32.py b/thefuck/system/win32.py index 5e49ff6e..2bf3e2e7 100644 --- a/thefuck/system/win32.py +++ b/thefuck/system/win32.py @@ -26,6 +26,7 @@ def get_key(): encoding = sys.stdout.encoding or os.environ.get('PYTHONIOENCODING', 'utf-8') return ch.decode(encoding) + try: from pathlib import Path except ImportError: @@ -35,5 +36,6 @@ except ImportError: def _expanduser(self): return self.__class__(os.path.expanduser(str(self))) + # pathlib's expanduser fails on windows, see http://bugs.python.org/issue19776 Path.expanduser = _expanduser diff --git a/thefuck/utils.py b/thefuck/utils.py index 2bb20a22..29ea2486 100644 --- a/thefuck/utils.py +++ b/thefuck/utils.py @@ -40,6 +40,8 @@ def memoize(fn): return value return wrapper + + memoize.disabled = False @@ -238,6 +240,8 @@ def cache(*depends_on): return value return _cache + + cache.disabled = False