From 91afcbf63764db98f5973f4f929603d0e1c473e2 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sun, 23 Oct 2022 18:08:11 -0700 Subject: [PATCH] Slightly simplify some boolean expressions --- codespell_lib/_codespell.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/codespell_lib/_codespell.py b/codespell_lib/_codespell.py index df55894980..25c8e828a3 100644 --- a/codespell_lib/_codespell.py +++ b/codespell_lib/_codespell.py @@ -103,11 +103,7 @@ def match(self, filename): if self.pattern_list is None: return False - for p in self.pattern_list: - if fnmatch.fnmatch(filename, p): - return True - - return False + return any(fnmatch.fnmatch(filename, p) for p in self.pattern_list) class Misspelling: @@ -507,9 +503,7 @@ def is_hidden(filename, check_hidden): def is_text_file(filename): with open(filename, mode='rb') as f: s = f.read(1024) - if b'\x00' in s: - return False - return True + return b'\x00' not in s def fix_case(word, fixword):