Skip to content

refactor: change filter engine#11

Merged
br-monteiro merged 5 commits into
mainfrom
refactor/change-filter-engine
Mar 23, 2026
Merged

refactor: change filter engine#11
br-monteiro merged 5 commits into
mainfrom
refactor/change-filter-engine

Conversation

@br-monteiro

Copy link
Copy Markdown
Member

This pull request refactors and extends the filtering logic for the senior-stock command, introducing a new, more flexible filtering engine and updating the CLI interface and documentation to support a broader set of filter operations. The change also updates the tests to match the new syntax and behavior.

Filtering system overhaul:

  • Introduced a new FilterEngine class in common/filter.py that supports multiple filter types (e.g., [eq], [re], [ne], [lt], [gt], [contains], etc.), allowing for much more expressive and powerful filtering on stock data. The filter logic is now centralized and easier to extend.
  • Replaced the old inline filter parsing and logic in commands/senior-stock/__init__.py with the new FilterEngine, removing the parse_filters function and updating the command to use the new engine for all filtering. [1] [2] [3]

CLI and documentation updates:

  • Updated CLI help texts for --filter, --columns, and --all-columns options to document the new filter syntax and available filter types, improving usability and discoverability.
  • Updated the README documentation to show the new filter syntax (e.g., ean[eq]12345 instead of ean:12345). [1] [2]

Testing updates:

  • Refactored and extended tests in tests/commands/senior-stock/test_command.py to cover the new filter syntax and additional filter types, ensuring correctness and backwards compatibility. [1] [2] [3] [4]

@br-monteiro br-monteiro self-assigned this Mar 23, 2026
@br-monteiro br-monteiro merged commit e8b65f5 into main Mar 23, 2026
1 check passed
@br-monteiro br-monteiro deleted the refactor/change-filter-engine branch March 23, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant