summaryrefslogtreecommitdiff
path: root/dealconvert/formats/dlm.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2020-10-20 15:23:10 +0200
committeremkael <emkael@tlen.pl>2020-10-20 15:23:10 +0200
commit5da79691092041d7291fc8534d4729938981aa4a (patch)
treea6cac7642024db971240a4ab2e2cc1cc332e557a /dealconvert/formats/dlm.py
parentd833d89ade81fd72efb76fb796cd5073e4e7c221 (diff)
Python3 compatibility
Fixes #1
Diffstat (limited to 'dealconvert/formats/dlm.py')
-rw-r--r--dealconvert/formats/dlm.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/dealconvert/formats/dlm.py b/dealconvert/formats/dlm.py
index 56f6e5d..f1e27c8 100644
--- a/dealconvert/formats/dlm.py
+++ b/dealconvert/formats/dlm.py
@@ -20,7 +20,7 @@ class DLMFormat(DealFormat):
except IndexError:
warnings.warn('unable to parse .dlm line: %s' % (line))
try:
- boards = range(int(fields['From board']), int(fields['To board'])+1)
+ boards = list(range(int(fields['From board']), int(fields['To board'])+1))
except (ValueError, IndexError):
raise RuntimeError('unable to parse .dlm board number data')
checksum = len(boards)
@@ -42,9 +42,9 @@ class DLMFormat(DealFormat):
str_checksum = int(board_str[26:])
values = []
for char in board_str[0:26]:
- checksum ^= ord(char)
- value = ord(char) - 97
- values.append(value / 4)
+ checksum ^= self.parse_byte(char)
+ value = self.parse_byte(char) - 97
+ values.append(value // 4)
values.append(value % 4)
if checksum != str_checksum:
warnings.warn(
@@ -84,7 +84,7 @@ class DLMFormat(DealFormat):
header.append('Crypto key=0')
header.append('Checksum=%d' % (board_count^1))
lines = ['', ''] * 99
- for i in range(1, first_board) + range(first_board+board_count, 100):
+ for i in list(range(1, first_board)) + list(range(first_board+board_count, 100)):
lines[(i-1)*2] = 'Duplicates %02d=0' % (i)
lines[(i-1)*2+1] = 'Board %02d=aaaaaabffffffkkkkkklpppppp%03d' % (
i, i^14)