SCRUM-98 file reader #13
Reference in New Issue
Block a user
Delete Branch "lab5/kovalenko-SCRUM-98-FileReader"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add class to read file data.csv that looks like file datasource from agent
Add domain directory to save dataclases(accelerometer dataclass userd in file reader)
File tested via print locally, row can be readed and reading starting again, if got to the end of file
Reader return dataclass of accelerometer as result of reading
Instead of reformatting and uploading multiple hundreds of updated lines of .csv files it may be a better idea just to work around the file at hand without modifying it
@@ -0,0 +23,4 @@self.y_idx = file_header.index('Y')self.z_idx = file_header.index('Z')def getNextValue(self):This function is prone to crashing on unexpected file lines. Instead of trying to adapt to a specific file format, it might be better to use try/catch and deciding what to do based on that. The code may look like so:
This way, in case the file is structured differently, has gaps or other mistakes, the function will silently skip over them and return the next valid group of values.
As an improvement, it may be way better to create a custom reader rather than relying on the csv.reader to make the script resilient against any possible .csv file failures
@@ -0,0 +23,4 @@self.y_idx = file_header.index('Y')self.z_idx = file_header.index('Z')def getNextValue(self):Ok, I'll try it