Skip to content

Commit

Permalink
Remove some Python 2.6 compatibility stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
lowell80 committed Jun 15, 2023
1 parent 7fb9ac3 commit dedb2b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ksconf/util/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@


def _is_binary_file(filename, peek=2048):
# https://stackoverflow.com/a/7392391/315892; modified for Python 2.6 compatibility
textchars = bytearray(set([7, 8, 9, 10, 12, 13, 27]) | set(range(0x20, 0x100)) - set([0x7f]))
# https://stackoverflow.com/a/7392391/315892
textchars = bytearray({7, 8, 9, 10, 12, 13, 27} | set(range(0x20, 0x100)) - {0x7f})
with open(filename, "rb") as f:
b = f.read(peek)
return bool(b.translate(None, textchars))
Expand Down

0 comments on commit dedb2b6

Please sign in to comment.