Conversation
Replace fully-expanded _items (frozenset) and _order (tuple) with a compact list of Range objects. Memory reduction of 99.9%+ for typical ranges (100k frames: 7.8MB -> ~536 bytes). Bug fixes: - isConsecutive(): rewrite as O(n) range-based algorithm; fixes incorrect True for interleaved ranges and IndexError on empty FrameSet - hasSubFrames(): correctly returns True for decimal notation like 1.0-5.0 where normalizeFrame collapses values to integers before storage - Stagger modifier: deduplicate frames across stagger iterations - MAX_FRAME_SIZE check: calculate size mathematically for x and plain ranges instead of materializing all frames API compatibility: no breaking changes. .items and .order remain public with DeprecationWarning. All 181 existing tests pass.
Refactor FrameSet to use range-based storage (fixes #148)
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.
#147
Migrate to ANTLR4 grammar-based parsing (v3)
Summary
Replaces regex-based parsing with shared ANTLR4 grammar used by Go and C++ implementations. All 181 tests passing.
Breaking Changes
Removed API:
FileSequence.SPLIT_RE,FileSequence.DISK_REclass variablesconstants.SPLIT_PATTERN,constants.SPLIT_RE,constants.SPLIT_SUB_PATTERN,constants.SPLIT_SUB_RERemoved Files:
setup.py→ replaced withpyproject.tomlsrc/fileseq/__version__.py→ automatic versioning viasetuptools-scmBehavior:
foo.100.exr)foo.1@@@@.exrkeeps 4 chars)New Features
foo.1-5x0.25#.exrfoo.#.#.exr,foo.1-5#.10-20@@.exr.bar1000.exr→ basename=.bar, frame=1000, ext=.exr/and\\)Implementation
grammar/fileseq.g4(shared with Go/C++)hatch run generateorpython src/fileseq/grammar/generate.pypyproject.tomlPerformance
Zero regression vs v2.x regex parsing: