Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slightly simplify some boolean expressions #2556

Merged
merged 1 commit into from
Oct 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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