diff cravat_convert/base_converter.py @ 12:2774c8433c4f draft

Uploaded
author in_silico
date Tue, 12 Jun 2018 12:07:09 -0400
parents 442aaa50e7b3
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cravat_convert/base_converter.py	Tue Jun 12 12:07:09 2018 -0400
@@ -0,0 +1,22 @@
+class BaseConverter(object):
+    def __init__(self):
+        self.format_name = None
+    def check_format(self,*args,**kwargs):
+        err_msg = 'Converter for %s format has no method check_format' %\
+            self.format_name
+        raise NotImplementedError(err_msg)
+    def setup(self,*args,**kwargs):
+        err_msg = 'Converter for %s format has no method setup' %\
+            self.format_name
+        raise NotImplementedError(err_msg)
+    def convert_line(self,*args,**kwargs):
+        err_msg = 'Converter for %s format has no method convert_line' %\
+            self.format_name
+        raise NotImplementedError(err_msg)
+
+
+class BadFormatError(Exception):
+    def __init__(self, message, errors=None):
+        super(BadFormatError, self).__init__(message)
+        # Support for custom error codes, if added later
+        self.errors = errors
\ No newline at end of file