From 91bf90862bc2537bc3f2c5c674d56d689358c23c Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 25 Jan 2020 00:46:52 -0800 Subject: [PATCH] Dedent this code by reversing condition and continue. --- search.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/search.py b/search.py index 05a9844..e1bddd4 100644 --- a/search.py +++ b/search.py @@ -166,18 +166,20 @@ def search( if line_numbers: result_text = '%4d | %s' % (index+1, result_text) - if all_terms_match(search_text, terms, term_matches): - if not content_args: - yield result_text - else: - filepath = pathclass.Path(search_object) - if not filepath.is_file: - continue + if not all_terms_match(search_text, terms, term_matches): + continue - if filepath.extension.lower() == 'lnk' and winshell: - yield from search_contents_windows_lnk(filepath, content_args) - else: - yield from search_contents_generic(filepath, content_args) + if not content_args: + yield result_text + else: + filepath = pathclass.Path(search_object) + if not filepath.is_file: + continue + + if filepath.extension.lower() == 'lnk' and winshell: + yield from search_contents_windows_lnk(filepath, content_args) + else: + yield from search_contents_generic(filepath, content_args) def argparse_to_dict(args): text = args.text