⚠️ Remove settings param from rules match, get_new_command and side_effect

This commit is contained in:
nvbn
2015-09-07 13:00:29 +03:00
parent 382eb8b86c
commit df4d2cc88d
154 changed files with 535 additions and 465 deletions
+3 -2
View File
@@ -3,6 +3,7 @@ from imp import load_source
from pathlib import Path
from .conf import settings, DEFAULT_PRIORITY
from .types import Rule, CorrectedCommand, SortedCorrectedCommandsSequence
from .utils import compatibility_call
from . import logs
@@ -49,14 +50,14 @@ def is_rule_match(command, rule):
try:
with logs.debug_time(u'Trying rule: {};'.format(rule.name)):
if rule.match(command, settings):
if compatibility_call(rule.match, command):
return True
except Exception:
logs.rule_failed(rule, sys.exc_info())
def make_corrected_commands(command, rule):
new_commands = rule.get_new_command(command, settings)
new_commands = compatibility_call(rule.get_new_command, command)
if not isinstance(new_commands, list):
new_commands = (new_commands,)
for n, new_command in enumerate(new_commands):