-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdata_feed.py
42 lines (28 loc) · 1.06 KB
/
data_feed.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- coding: utf-8 -*-
#import serial
#import sys
import time
class Data_feed( object ):
"""
probably for testing
seems to be imbedded in db_test.py
for feeding a bit at a time -- this may or may not be too simple to implement
will fail on 0 len file.
"""
def __init__(self, file_name ):
with open( file_name ) as f:
self.lines = f.readlines()
#print self.lines
self.ix_max = len( self.lines )
self.ix = 0
# timetest = TimeTest()
print( "Data_feed: warning in test mode time is not really time.time " ) # might do better here
def next_feed( self, ):
"""
make this circular
"""
retval = self.lines[ self.ix ]
self.ix += 1
if self.ix >= self.ix_max:
self.ix = 0
return retval