summaryrefslogtreecommitdiff
path: root/dealconvert/formats/__init__.py
blob: eea9fc6b54e2b3d3654454ba7b0fcbf234e69364 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from os.path import dirname, basename, isfile, join
import glob

class DealFormat(object):
    cards = 'AKQJT98765432'
    def parse(self, input_file):
        with open(input_file, 'rb') as content:
            return self.parse_content(content)

    def output(self, output_file, deal):
        with open(output_file, 'wb') as out_file:
            return self.output_content(out_file, deal)

    def match_file(self, filename):
        return filename.lower().endswith(self.suffix)

    @property
    def suffix(self):
        pass

    def parse_content(self, content):
        pass

    def output_content(self, out_file, deal):
        pass


modules = glob.glob(join(dirname(__file__), "*.py"))
__all__ = [
    basename(f)[:-3] for f in modules
    if isfile(f) and not f.endswith('__init__.py')
]