summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dealconvert/__init__.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/dealconvert/__init__.py b/dealconvert/__init__.py
index 1779976..2f9b5aa 100644
--- a/dealconvert/__init__.py
+++ b/dealconvert/__init__.py
@@ -1,17 +1,18 @@
from .formats import *
class DealConverter(object):
- def __init__(self, input_file):
+ def __init__(self, input_file=None):
self.input = input_file
self.formats = {}
- self.parser = self._detect_format(self.input)
+ if input_file is not None:
+ self.parser = self._detect_format(self.input)
def output(self, output_files):
deal_set = sorted(self.parser.parse(self.input), key=lambda d:d.number)
for output in output_files:
self._detect_format(output).output(output, deal_set)
- def _detect_format(self, filename):
+ def detect_format(self, filename):
for deal_format in globals()['formats'].__all__:
if deal_format not in self.formats:
self.formats[deal_format] = getattr(