Skip to content

Commit

Permalink
Slightly simplify some boolean expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
jdufresne authored and DimitriPapadopoulos committed Oct 24, 2022
1 parent a700083 commit 91afcbf
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions codespell_lib/_codespell.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 91afcbf

Please sign in to comment.