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 f58596ebf7 - Show all commits

View File

@@ -104,7 +104,7 @@ class FileDatasource:
self._acc_f.seek(0) self._acc_f.seek(0)
VladiusVostokus commented 2026-02-25 16:06:38 +02:00 (Migrated from github.com)
Review

Why leave _ here if it's not used?

Why leave _ here if it's not used?
bacant150 commented 2026-02-25 21:13:00 +02:00 (Migrated from github.com)
Review

Good catch. The _detect_header_and_buffer helper wasn’t used and didn’t modify class state, so I removed it.

Good catch. The _detect_header_and_buffer helper wasn’t used and didn’t modify class state, so I removed it.
self._acc_reader = csv.reader(self._acc_f, skipinitialspace=True) self._acc_reader = csv.reader(self._acc_f, skipinitialspace=True)
next(self._acc_reader) # Skip header row next(self._acc_reader) # Skip header row
self._acc_has_header, _ = self._detect_header_and_buffer( _ = self._detect_header_and_buffer(
self._acc_reader, expected_cols=3, header_tokens=("x", "y", "z") self._acc_reader, expected_cols=3, header_tokens=("x", "y", "z")
) )
@@ -114,7 +114,7 @@ class FileDatasource:
self._gps_f.seek(0) self._gps_f.seek(0)
VladiusVostokus commented 2026-02-25 15:52:46 +02:00 (Migrated from github.com)
Review

Why leave _ here if it's not used?
Maybe dont return anything from this method?

Why leave _ here if it's not used? Maybe dont return anything from this method?
VladiusVostokus commented 2026-02-25 16:00:51 +02:00 (Migrated from github.com)
Review

As I see this method doesn't modify any class fiels, so maybe just remove this method?

As I see this method doesn't modify any class fiels, so maybe just remove this method?
bacant150 commented 2026-02-25 20:57:57 +02:00 (Migrated from github.com)
Review

The _detect_header_and_buffer method was not modifying any class state and its return value was unused.
I removed the method and simplified the logic.

The _detect_header_and_buffer method was not modifying any class state and its return value was unused. I removed the method and simplified the logic.
self._gps_reader = csv.reader(self._gps_f, skipinitialspace=True) self._gps_reader = csv.reader(self._gps_f, skipinitialspace=True)
next(self._gps_reader) # Skip header row next(self._gps_reader) # Skip header row
self._gps_has_header, _ = self._detect_header_and_buffer( _ = self._detect_header_and_buffer(
self._gps_reader, expected_cols=2, header_tokens=("longitude", "latitude") self._gps_reader, expected_cols=2, header_tokens=("longitude", "latitude")
) )