Fix file type detection for Python 2.6. Fixes #1330

To find out the type of file selected using FileManager in query tool, we use bitwise OR( | ) on two sets which is not working on python-2.6.9 version.
Now we took list of elements instead of sets to fix the issue.
pull/3/head
Surinder Kumar 2016-06-13 16:35:11 +01:00 committed by Dave Page
parent 8b770ae479
commit 677008af10
1 changed files with 2 additions and 3 deletions

View File

@ -1129,9 +1129,8 @@ def load_file():
# check if file type is text or binary
textchars = bytearray(
{7, 8, 9, 10, 12, 13, 27} | set(
range(0x20, 0x100)
) - {0x7f})
[7, 8, 9, 10, 12, 13, 27]) + bytearray(
range(0x20, 0x7f)) + bytearray(range(0x80, 0x100))
is_binary_string = lambda bytes: bool(
bytes.translate(None, textchars)