@@ -10,30 +10,48 @@ class CSVModel:
1010
1111 fields = {
1212 "Date" : {'req' : True , 'type' : FT .iso_date_string },
13- "Time" : {'req' : True , 'type' : FT .string_list ,
14- 'values' : ['8:00' , '12:00' , '16:00' , '20:00' ]},
13+ "Time" : {
14+ 'req' : True , 'type' : FT .string_list ,
15+ 'values' : ['8:00' , '12:00' , '16:00' , '20:00' ]
16+ },
1517 "Technician" : {'req' : True , 'type' : FT .string },
16- "Lab" : {'req' : True , 'type' : FT .short_string_list ,
17- 'values' : ['A' , 'B' , 'C' ]},
18- "Plot" : {'req' : True , 'type' : FT .string_list ,
19- 'values' : [str (x ) for x in range (1 , 21 )]},
18+ "Lab" : {
19+ 'req' : True , 'type' : FT .short_string_list ,
20+ 'values' : ['A' , 'B' , 'C' ]
21+ },
22+ "Plot" : {
23+ 'req' : True , 'type' : FT .string_list ,
24+ 'values' : [str (x ) for x in range (1 , 21 )]
25+ },
2026 "Seed Sample" : {'req' : True , 'type' : FT .string },
21- "Humidity" : {'req' : True , 'type' : FT .decimal ,
22- 'min' : 0.5 , 'max' : 52.0 , 'inc' : .01 },
23- "Light" : {'req' : True , 'type' : FT .decimal ,
24- 'min' : 0 , 'max' : 100.0 , 'inc' : .01 },
25- "Temperature" : {'req' : True , 'type' : FT .decimal ,
26- 'min' : 4 , 'max' : 40 , 'inc' : .01 },
27+ "Humidity" : {
28+ 'req' : True , 'type' : FT .decimal ,
29+ 'min' : 0.5 , 'max' : 52.0 , 'inc' : .01
30+ },
31+ "Light" : {
32+ 'req' : True , 'type' : FT .decimal ,
33+ 'min' : 0 , 'max' : 100.0 , 'inc' : .01
34+ },
35+ "Temperature" : {
36+ 'req' : True , 'type' : FT .decimal ,
37+ 'min' : 4 , 'max' : 40 , 'inc' : .01
38+ },
2739 "Equipment Fault" : {'req' : False , 'type' : FT .boolean },
2840 "Plants" : {'req' : True , 'type' : FT .integer , 'min' : 0 , 'max' : 20 },
2941 "Blossoms" : {'req' : True , 'type' : FT .integer , 'min' : 0 , 'max' : 1000 },
3042 "Fruit" : {'req' : True , 'type' : FT .integer , 'min' : 0 , 'max' : 1000 },
31- "Min Height" : {'req' : True , 'type' : FT .decimal ,
32- 'min' : 0 , 'max' : 1000 , 'inc' : .01 },
33- "Max Height" : {'req' : True , 'type' : FT .decimal ,
34- 'min' : 0 , 'max' : 1000 , 'inc' : .01 },
35- "Med Height" : {'req' : True , 'type' : FT .decimal ,
36- 'min' : 0 , 'max' : 1000 , 'inc' : .01 },
43+ "Min Height" : {
44+ 'req' : True , 'type' : FT .decimal ,
45+ 'min' : 0 , 'max' : 1000 , 'inc' : .01
46+ },
47+ "Max Height" : {
48+ 'req' : True , 'type' : FT .decimal ,
49+ 'min' : 0 , 'max' : 1000 , 'inc' : .01
50+ },
51+ "Med Height" : {
52+ 'req' : True , 'type' : FT .decimal ,
53+ 'min' : 0 , 'max' : 1000 , 'inc' : .01
54+ },
3755 "Notes" : {'req' : False , 'type' : FT .long_string }
3856 }
3957
@@ -60,7 +78,7 @@ def save_record(self, data):
6078 """Save a dict of data to the CSV file"""
6179 newfile = not self .file .exists ()
6280
63- with open (self .file , 'a' ) as fh :
81+ with open (self .file , 'a' , newline = '' ) as fh :
6482 csvwriter = csv .DictWriter (fh , fieldnames = self .fields .keys ())
6583 if newfile :
6684 csvwriter .writeheader ()
0 commit comments