summaryrefslogtreecommitdiff
path: root/dealconvert/formats/cds.py
diff options
context:
space:
mode:
Diffstat (limited to 'dealconvert/formats/cds.py')
-rw-r--r--dealconvert/formats/cds.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/dealconvert/formats/cds.py b/dealconvert/formats/cds.py
index 6137c4d..34ce46f 100644
--- a/dealconvert/formats/cds.py
+++ b/dealconvert/formats/cds.py
@@ -1,10 +1,10 @@
import warnings
-from . import DealFormat
+from . import BinaryFormat
from .rzd import RZDFormat
from .. import dto
-class CDSFormat(DealFormat):
+class CDSFormat(BinaryFormat):
@property
def suffix(self):
return '.cds'
@@ -21,15 +21,14 @@ class CDSFormat(DealFormat):
warnings.warn('.cds data truncated: %s' % (data))
break
deal = dto.Deal()
- deal.number = ord(data[0])
+ deal.number = self.parse_byte(data[0])
deal.dealer = deal.get_dealer(deal.number)
deal.vulnerable = deal.get_vulnerability(deal.number)
deal.hands = self.rzd_format.parse_deal(data[1:], offset=1)
dealset.append(deal)
return dealset
-
def output_content(self, out_file, dealset):
for deal in dealset:
- out_file.write(chr(deal.number))
- out_file.write(self.rzd_format.dump_deal(deal, offset=1))
+ out_file.write(bytearray([deal.number]))
+ out_file.write(bytearray(self.rzd_format.dump_deal(deal, offset=1)))