mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-22 12:58:33 +00:00
Reorganize imports
This commit is contained in:
parent
fc35ee657e
commit
b0195a8748
@ -1,8 +1,7 @@
|
|||||||
from . import conf, types, logs
|
import sys
|
||||||
from imp import load_source
|
from imp import load_source
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from thefuck.types import CorrectedCommand, Rule
|
from . import conf, types, logs
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def load_rule(rule, settings):
|
def load_rule(rule, settings):
|
||||||
@ -11,7 +10,7 @@ def load_rule(rule, settings):
|
|||||||
with logs.debug_time(u'Importing rule: {};'.format(name), settings):
|
with logs.debug_time(u'Importing rule: {};'.format(name), settings):
|
||||||
rule_module = load_source(name, str(rule))
|
rule_module = load_source(name, str(rule))
|
||||||
priority = getattr(rule_module, 'priority', conf.DEFAULT_PRIORITY)
|
priority = getattr(rule_module, 'priority', conf.DEFAULT_PRIORITY)
|
||||||
return Rule(name, rule_module.match,
|
return types.Rule(name, rule_module.match,
|
||||||
rule_module.get_new_command,
|
rule_module.get_new_command,
|
||||||
getattr(rule_module, 'enabled_by_default', True),
|
getattr(rule_module, 'enabled_by_default', True),
|
||||||
getattr(rule_module, 'side_effect', None),
|
getattr(rule_module, 'side_effect', None),
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
""" This file provide some utility functions for Arch Linux specific rules."""
|
""" This file provide some utility functions for Arch Linux specific rules."""
|
||||||
import thefuck.utils
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from .. import utils
|
||||||
|
|
||||||
|
|
||||||
@thefuck.utils.memoize
|
@utils.memoize
|
||||||
def get_pkgfile(command):
|
def get_pkgfile(command):
|
||||||
""" Gets the packages that provide the given command using `pkgfile`.
|
""" Gets the packages that provide the given command using `pkgfile`.
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ def get_pkgfile(command):
|
|||||||
|
|
||||||
packages = subprocess.check_output(
|
packages = subprocess.check_output(
|
||||||
['pkgfile', '-b', '-v', command],
|
['pkgfile', '-b', '-v', command],
|
||||||
universal_newlines=True, stderr=thefuck.utils.DEVNULL
|
universal_newlines=True, stderr=utils.DEVNULL
|
||||||
).splitlines()
|
).splitlines()
|
||||||
|
|
||||||
return [package.split()[0] for package in packages]
|
return [package.split()[0] for package in packages]
|
||||||
@ -29,13 +29,13 @@ def get_pkgfile(command):
|
|||||||
|
|
||||||
|
|
||||||
def archlinux_env():
|
def archlinux_env():
|
||||||
if thefuck.utils.which('yaourt'):
|
if utils.which('yaourt'):
|
||||||
pacman = 'yaourt'
|
pacman = 'yaourt'
|
||||||
elif thefuck.utils.which('pacman'):
|
elif utils.which('pacman'):
|
||||||
pacman = 'sudo pacman'
|
pacman = 'sudo pacman'
|
||||||
else:
|
else:
|
||||||
return False, None
|
return False, None
|
||||||
|
|
||||||
enabled_by_default = thefuck.utils.which('pkgfile')
|
enabled_by_default = utils.which('pkgfile')
|
||||||
|
|
||||||
return enabled_by_default, pacman
|
return enabled_by_default, pacman
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import subprocess
|
import subprocess
|
||||||
from thefuck.utils import memoize, which
|
from ..utils import memoize, which
|
||||||
|
|
||||||
|
|
||||||
enabled_by_default = bool(which('brew'))
|
enabled_by_default = bool(which('brew'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user