"""Parser.py
General class for parsing text files
"""
from __future__ import print_function, division, unicode_literals
from re import match


class ItemNotFoundInFileException(Exception):
    pass


class Parser(object):
    def __init__(self, filepath):
        self.filepath = filepath
        self._get_data()

    def _lines(self):
        with open(self.filepath) as f:
            for line in f:
                yield line

    def _get_data(self):
        """Update constants with file information
        """
        raise NotImplementedError()

    def _get_data_line_fn(self, line_regex, match_fn, data_name):
        for line in self._lines():
            if match(line_regex, line):
                match_fn(line)
                break
        else:
            raise ItemNotFoundInFileException(
                'Did not find {} in {}'.format(data_name, self.filepath))

    def _get_data_lines_fn(self, line_regex, match_fn, data_name):
        matched = False
        for line in self._lines():
            if match(line_regex, line):
                match_fn(line)
                matched = True
        if not matched:
            raise ItemNotFoundInFileException(
                'Did not find {} in {}'.format(data_name, self.filepath))

@@ -134,16 +134,36 @@
 t match%0A
+from os import path%0A
 %0A%0Aclass 
@@ -324,24 +324,152 @@
 get_data()%0A%0A
+    def __repr__(self):%0A        return (super(Parser, self).__repr__() + ' at ' +%0A                path.relpath(self.filepath))%0A%0A
     def _lin

Improve debug output of Parser objects