(filename, roomba_name='', startdate=None)
date format 2021-01-13 14:57:06
date format 2021-01-13 14:57:06
date format 2021 - 01 - 13 14 : 57 : 06
def lines_from_file(filename, roomba_name='', startdate=None):
    '''
    date format 2021-01-13 14:57:06
    '''
    log.info('reading file: {}'.format(filename))
    date = None
    with open(filename) as f:
        for line in f:
            if startdate:
                match = re.search(r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}', line)
                if match:
                    date = datetime.strptime(match.group(), '%Y-%m-%d %H:%M:%S')
            if startdate and date and date < startdate:
                continue
            #log.info('line: {}'.format(line))
            if roomba_name:
                if 'Roomba.{}'.format(roomba_name) in line:
                    yield line
            else:
                yield line
def lines_from_file ( filename , roomba_name = '' , startdate = None ) : log . info ( 'reading file: {}' . format ( filename ) ) date = None with open ( filename ) as f : for line in f : if startdate : match = re . search ( r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}' , line ) if match : date = datetime . strptime ( match . group ( ) , '%Y-%m-%d %H:%M:%S' ) if startdate and date and date < startdate : continue #log.info('line: {}'.format(line)) if roomba_name : if 'Roomba.{}' . format ( roomba_name ) in line : yield line else : yield line