From cdf44a5deaf772108d941db49ae0d2998e45235c Mon Sep 17 00:00:00 2001 From: DashBing Date: Sun, 20 Aug 2023 17:27:34 +0800 Subject: [PATCH] fix corrector.py --- thefuck/corrector.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/thefuck/corrector.py b/thefuck/corrector.py index fdd4698..7f8b1eb 100644 --- a/thefuck/corrector.py +++ b/thefuck/corrector.py @@ -43,10 +43,16 @@ def get_rules(): :rtype: [Rule] """ - paths = [rule_path for path in get_rules_import_paths() - for rule_path in sorted(path.glob('*.py'))] - return sorted(get_loaded_rules(paths), - key=lambda rule: rule.priority) + paths = [ + rule_path for path in get_rules_import_paths() + for rule_path in sorted(path.glob('*.py')) + ] + return ( + sorted( + get_loaded_rules(paths), + key=lambda rule: rule.priority + ) + ) def organize_commands(corrected_commands): @@ -88,5 +94,6 @@ def get_corrected_commands(command): corrected_commands = ( corrected for rule in get_rules() if rule.is_match(command) - for corrected in rule.get_corrected_commands(command)) + for corrected in rule.get_corrected_commands(command) + ) return organize_commands(corrected_commands)