fix(lidar): accept .pkl when .pkl.gz absent#155
Open
Abhishek21g wants to merge 2 commits into
Open
Conversation
Some dataset exports ship uncompressed lidar pickles. Prefer .pkl.gz when present, fall back to .pkl for compatibility.
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.
Problem
#140 — devkit expects
*.pkl.gzlidar files but some dataset exports ship uncompressed*.pkl.Fix
Lidar._load_data_structureprefers.pkl.gz, falls back to.pkl.Verification
Closes #140
Greptile Summary
This PR fixes issue #140 by overriding
Lidar._load_data_structureso that the devkit accepts uncompressed.pklfiles when no.pkl.gzfiles are present, while still preferring.pkl.gzwhen both formats exist.sensors.py:Lidar._load_data_structurenow globs for.pkl.gzfirst; if none are found it falls back to.pkl; a trailingelse: super()._load_data_structure()is reached only when both globs return empty and is a no-op in practice.test_lidar_extensions.py: Two new tests cover the.pklfallback path and the.pkl.gzpriority rule, addressing the gap noted in the previous review thread.Confidence Score: 5/5
Safe to merge — the change is small, well-contained, and covered by two targeted tests.
The override is minimal and correct. The
_load_data_filemethod already usespd.read_picklewhich transparently handles both compressed and uncompressed pickles, so no deserialization change was needed. Both the fallback and priority rule are exercised by the new tests.No files require special attention.
Important Files Changed
_load_data_structureoverride inLidarthat prefers.pkl.gzand falls back to.pkl; theelsesuper() branch is redundant but harmless..pklfallback and the.pkl.gzpriority-over-.pklcase; both cases are well-structured and correct.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A["Lidar.__init__"] --> B["Sensor.__init__ -> _load_structure"] B --> C["_load_data_structure Override"] C --> D{"glob *.pkl.gz non-empty?"} D -- Yes --> E["_data_structure = gz list"] D -- No --> F{"glob *.pkl non-empty?"} F -- Yes --> G["_data_structure = plain list"] F -- No --> H["super call: _data_structure = []"] E --> I["lidar.load -> _load_data_file per entry"] G --> I H --> I%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% flowchart TD A["Lidar.__init__"] --> B["Sensor.__init__ -> _load_structure"] B --> C["_load_data_structure Override"] C --> D{"glob *.pkl.gz non-empty?"} D -- Yes --> E["_data_structure = gz list"] D -- No --> F{"glob *.pkl non-empty?"} F -- Yes --> G["_data_structure = plain list"] F -- No --> H["super call: _data_structure = []"] E --> I["lidar.load -> _load_data_file per entry"] G --> I H --> IReviews (2): Last reviewed commit: "test(lidar): assert .pkl.gz takes priori..." | Re-trigger Greptile