comparison cravat_convert/base_converter.py @ 18:cde9e74d9fdf draft

Uploaded
author in_silico
date Wed, 18 Jul 2018 09:41:20 -0400
parents 442aaa50e7b3
children
comparison
equal deleted inserted replaced
17:bea3b63f4b5d 18:cde9e74d9fdf
1 class BaseConverter(object):
2 def __init__(self):
3 self.format_name = None
4 def check_format(self,*args,**kwargs):
5 err_msg = 'Converter for %s format has no method check_format' %\
6 self.format_name
7 raise NotImplementedError(err_msg)
8 def setup(self,*args,**kwargs):
9 err_msg = 'Converter for %s format has no method setup' %\
10 self.format_name
11 raise NotImplementedError(err_msg)
12 def convert_line(self,*args,**kwargs):
13 err_msg = 'Converter for %s format has no method convert_line' %\
14 self.format_name
15 raise NotImplementedError(err_msg)
16
17
18 class BadFormatError(Exception):
19 def __init__(self, message, errors=None):
20 super(BadFormatError, self).__init__(message)
21 # Support for custom error codes, if added later
22 self.errors = errors