Address TODOs, refactor repeated lines#29
Merged
mattcieslak merged 7 commits intomainfrom Feb 25, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #29 +/- ##
==========================================
+ Coverage 85.25% 86.86% +1.61%
==========================================
Files 13 14 +1
Lines 6076 5809 -267
Branches 946 881 -65
==========================================
- Hits 5180 5046 -134
+ Misses 896 763 -133
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There were a couple TODOs that suggested refactoring and a few lines of code that were repeated many times throughout the codebase. This PR adds some functions that reduce the repetition. Specifically:
detail::remap()helper. InsideTrxFile<DT>, the template parameter is already known at compile time. The runtime dispatch was unnecessary.std::runtime_error/std::invalid_argumentthrows with library-specific exceptions (TrxIOError,TrxFormatError,TrxDTypeError,TrxArgumentError), all inheriting fromTrxError : std::runtime_error. Existingcatch(std::runtime_error)blocks continue to work.data(),offsets(),lengths()onArraySequenceandmatrix()onMMappedMatrix.load_from_zip/load_from_directorypublic onTrxFile.#define private publichack from tests.libzip: detail::ZipArchiveanddetail::ZipFileeliminate manualzip_close/zip_fclosecleanup in error paths across all zip-handling code.deepcopy(): Replace the write-to-disk-then-reload round-trip with direct_initialize_empty_trx+ Eigen block copies.TrxStreamAPI cleanup:set_dimensions,set_voxel_to_rasmm,set_metadata_mode,set_metadata_buffer_max_bytesnow returnTrxStream&for chaining..compare()with==across ~23 string comparisons.