diff --git a/thefuck/corrector.py b/thefuck/corrector.py index 6fcaf42a..1126817e 100644 --- a/thefuck/corrector.py +++ b/thefuck/corrector.py @@ -1,8 +1,7 @@ -from . import conf, types, logs +import sys from imp import load_source from pathlib import Path -from thefuck.types import CorrectedCommand, Rule -import sys +from . import conf, types, logs def load_rule(rule, settings): @@ -11,12 +10,12 @@ def load_rule(rule, settings): with logs.debug_time(u'Importing rule: {};'.format(name), settings): rule_module = load_source(name, str(rule)) priority = getattr(rule_module, 'priority', conf.DEFAULT_PRIORITY) - return Rule(name, rule_module.match, - rule_module.get_new_command, - getattr(rule_module, 'enabled_by_default', True), - getattr(rule_module, 'side_effect', None), - settings.priority.get(name, priority), - getattr(rule_module, 'requires_output', True)) + return types.Rule(name, rule_module.match, + rule_module.get_new_command, + getattr(rule_module, 'enabled_by_default', True), + getattr(rule_module, 'side_effect', None), + settings.priority.get(name, priority), + getattr(rule_module, 'requires_output', True)) def get_loaded_rules(rules, settings): diff --git a/thefuck/specific/archlinux.py b/thefuck/specific/archlinux.py index 04b97149..5816c50f 100644 --- a/thefuck/specific/archlinux.py +++ b/thefuck/specific/archlinux.py @@ -1,9 +1,9 @@ """ This file provide some utility functions for Arch Linux specific rules.""" -import thefuck.utils import subprocess +from .. import utils -@thefuck.utils.memoize +@utils.memoize def get_pkgfile(command): """ Gets the packages that provide the given command using `pkgfile`. @@ -20,7 +20,7 @@ def get_pkgfile(command): packages = subprocess.check_output( ['pkgfile', '-b', '-v', command], - universal_newlines=True, stderr=thefuck.utils.DEVNULL + universal_newlines=True, stderr=utils.DEVNULL ).splitlines() return [package.split()[0] for package in packages] @@ -29,13 +29,13 @@ def get_pkgfile(command): def archlinux_env(): - if thefuck.utils.which('yaourt'): + if utils.which('yaourt'): pacman = 'yaourt' - elif thefuck.utils.which('pacman'): + elif utils.which('pacman'): pacman = 'sudo pacman' else: return False, None - enabled_by_default = thefuck.utils.which('pkgfile') + enabled_by_default = utils.which('pkgfile') return enabled_by_default, pacman diff --git a/thefuck/specific/brew.py b/thefuck/specific/brew.py index 66d01597..346d2d54 100644 --- a/thefuck/specific/brew.py +++ b/thefuck/specific/brew.py @@ -1,5 +1,5 @@ import subprocess -from thefuck.utils import memoize, which +from ..utils import memoize, which enabled_by_default = bool(which('brew'))