Skip to content

Commit 91afcbf

Browse files
jdufresneDimitriPapadopoulos
authored andcommitted
Slightly simplify some boolean expressions
1 parent a700083 commit 91afcbf

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

codespell_lib/_codespell.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,7 @@ def match(self, filename):
103103
if self.pattern_list is None:
104104
return False
105105

106-
for p in self.pattern_list:
107-
if fnmatch.fnmatch(filename, p):
108-
return True
109-
110-
return False
106+
return any(fnmatch.fnmatch(filename, p) for p in self.pattern_list)
111107

112108

113109
class Misspelling:
@@ -507,9 +503,7 @@ def is_hidden(filename, check_hidden):
507503
def is_text_file(filename):
508504
with open(filename, mode='rb') as f:
509505
s = f.read(1024)
510-
if b'\x00' in s:
511-
return False
512-
return True
506+
return b'\x00' not in s
513507

514508

515509
def fix_case(word, fixword):

0 commit comments

Comments
 (0)