FileReader #5

Merged
bacant150 merged 15 commits from lab1_huranets into lab1 2026-02-26 10:04:10 +02:00
Showing only changes of commit a25fbfc3ef - Show all commits

View File

@@ -14,7 +14,6 @@ import config
class FileDatasource:
def __init__(self, accelerometer_filename: str, gps_filename: str) -> None:
self.accelerometer_filename = accelerometer_filename
self.gps_filename = gps_filename
@@ -200,21 +199,14 @@ class FileDatasource:
# Otherwise treat it as header-ish (skip it)
hasslesstech commented 2026-02-24 20:17:50 +02:00 (Migrated from github.com)
Review

Removal of checks is not neccesary, but is plausible since the source file should only contain correct data

Removal of checks is not neccesary, but is plausible since the source file *should* only contain correct data
bacant150 commented 2026-02-24 20:50:52 +02:00 (Migrated from github.com)
Review

Resumed checks

Resumed checks
return True, None
@staticmethod
def _parse_int(s: str) -> int:
return int(s)
@staticmethod
hasslesstech commented 2026-02-24 15:25:56 +02:00 (Migrated from github.com)
Review

This value range check might break future integration with higher precision accelerometer data, hence should be removed

This value range check might break future integration with higher precision accelerometer data, hence should be removed
def _parse_acc(row: List[str]) -> Accelerometer:
if len(row) < 3:
raise ValueError(f"Accelerometer row must have 3 values (x,y,z). Got: {row}")
try:
x = int(row[0])
y = int(row[1])
z = int(row[2])
except ValueError as e:
raise ValueError(f"Invalid accelerometer values (expected integers): {row}") from e
x = int(row[0])
y = int(row[1])
z = int(row[2])
return Accelerometer(x=x, y=y, z=z)