How to use the choochoo.fit.profile.ErrorDict function in choochoo

To help you get started, we’ve selected a few choochoo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github andrewcooke / choochoo / choochoo / fit / profile.py View on Github external
def __init__(self, log, row, rows, types):
        super().__init__(log, row, types)
        self.__dynamic_tmp_data = []
        self.__dynamic_lookup = ErrorDict(log, 'No dynamic field for %r')
        self.references = set()
        try:
            peek = rows.peek()
            while peek[2] and peek[1] is None:
                row = next(rows)
                for name, value in zip(row[11].split(','), row[12].split(',')):
                    self.__save_dynamic(name.strip(), value.strip(), row)
                peek = rows.peek()
        except StopIteration:
            return
github andrewcooke / choochoo / choochoo / fit / profile.py View on Github external
def __init__(self, log, sheet, types):
        self.__log = log
        self.__profile_to_message = ErrorDict(log, 'No message for profile %r')
        self.__number_to_message = ErrorDict(log, 'No message for number %r')
        rows = peekable([cell.value for cell in row] for row in sheet.iter_rows())
        for row in rows:
            if row[0] and row[0][0].isupper():
                self.__log.debug('Skipping %s' % row)
            elif row[0]:
                # self.__log.info('Parsing message %s' % row[0])
                self.__add_message(RowMessage(self.__log, row, rows, types))
        self.__add_message(Header(self.__log, types))
github andrewcooke / choochoo / choochoo / fit / profile.py View on Github external
def __init__(self, log, name, number=None):
        super().__init__(log, name)
        self.number = number
        self._profile_to_field = ErrorDict(log, 'No field for profile %r')
        self._number_to_field = ErrorDict(log, 'No field for number %r')
github andrewcooke / choochoo / choochoo / fit / profile.py View on Github external
def __init__(self, log, sheet, to_datetime=True):
        self.__log = log
        self.__profile_to_type = ErrorDict(log, 'No type for profile %r')
        # these are not 'base types' in the same sense as types having base types.
        # rather, they are the 'base (integer) types' described in the docs
        self.base_types = ErrorList(log, 'No base type for number %r')
        self.__add_known_types(to_datetime)
        rows = peekable([cell.value for cell in row] for row in sheet.iter_rows())
        for row in rows:
            if row[0] and row[0][0].isupper():
                self.__log.debug('Skipping %s' % row)
            elif row[0]:
                # self.__log.info('Parsing type %s' % row[0])
                self.__add_type(Mapping(self.__log, row, rows, self))
github andrewcooke / choochoo / choochoo / fit / profile.py View on Github external
def __init__(self, log, sheet, types):
        self.__log = log
        self.__profile_to_message = ErrorDict(log, 'No message for profile %r')
        self.__number_to_message = ErrorDict(log, 'No message for number %r')
        rows = peekable([cell.value for cell in row] for row in sheet.iter_rows())
        for row in rows:
            if row[0] and row[0][0].isupper():
                self.__log.debug('Skipping %s' % row)
            elif row[0]:
                # self.__log.info('Parsing message %s' % row[0])
                self.__add_message(RowMessage(self.__log, row, rows, types))
        self.__add_message(Header(self.__log, types))
github andrewcooke / choochoo / choochoo / fit / profile.py View on Github external
def __init__(self, log, name, number=None):
        super().__init__(log, name)
        self.number = number
        self._profile_to_field = ErrorDict(log, 'No field for profile %r')
        self._number_to_field = ErrorDict(log, 'No field for number %r')
github andrewcooke / choochoo / choochoo / fit / profile.py View on Github external
def __init__(self, log, row, rows, types):
        name = row[0]
        base_type_name = row[1]
        base_type = types.profile_to_type(base_type_name, auto_create=True)
        super().__init__(log, name, base_type.size, base_type=base_type)
        self._profile_to_internal = ErrorDict(log, 'No internal value for profile %r')
        self._internal_to_profile = ErrorDict(log, 'No profile value for internal %r')
        for row in rows:
            if row[0] or row[2] is None or row[3] is None:
                rows.prepend(row)
                break
            self.__add_mapping(row)
        # log.debug('Parsed %d values' % len(self._profile_to_internal))
github andrewcooke / choochoo / choochoo / fit / profile.py View on Github external
def __init__(self, log, row, rows, types):
        name = row[0]
        base_type_name = row[1]
        base_type = types.profile_to_type(base_type_name, auto_create=True)
        super().__init__(log, name, base_type.size, base_type=base_type)
        self._profile_to_internal = ErrorDict(log, 'No internal value for profile %r')
        self._internal_to_profile = ErrorDict(log, 'No profile value for internal %r')
        for row in rows:
            if row[0] or row[2] is None or row[3] is None:
                rows.prepend(row)
                break
            self.__add_mapping(row)
        # log.debug('Parsed %d values' % len(self._profile_to_internal))