Skip to content

AI-generated support for collations - #5

Merged
tobixen merged 5 commits into
mainfrom
collations
Nov 24, 2025
Merged

AI-generated support for collations#5
tobixen merged 5 commits into
mainfrom
collations

Conversation

@tobixen

@tobixen tobixen commented Nov 24, 2025

Copy link
Copy Markdown
Member

Actually, the use-case was just to be able to do case-insensitive filtering. Then I came to think that we should have good collation-support too. I considered that part to be done faster and better by the AI than what I could do myself - but all the changes have been reviewed and curated by me (the human).

tobixen and others added 5 commits November 24, 2025 12:23
…arches

This commit implements comprehensive collation support for text searches
and sorting in the icalendar-searcher library.

Key features:
- Simple API: case_sensitive parameter for add_property_filter() and add_sort_key()
- Power user API: Collation enum with BINARY, CASE_INSENSITIVE, UNICODE, and LOCALE
- Optional PyICU integration for advanced Unicode/locale-aware collation
- Collation support for all text properties and CATEGORIES
- Graceful fallback when PyICU is not installed

Breaking change:
- Default text search behavior is now case-sensitive (was case-insensitive)
- Use case_sensitive=False to restore previous behavior

All 141 tests pass, including 18 new tests for collation features.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add PyICU as development dependency for testing
- Replace runtime PyICU checks with proper mocked tests
- Add tests that skip when PyICU is installed (using pytest.skipif)
- Add tests that mock HAS_PYICU=False to test error handling
- Simplify ICU substring matching (remove unused collator variable)
- Add proper assertions for CollationError messages
- Fix ruff issues (unused variables, import ordering)

All 142 tests pass (2 skipped when PyICU not installed).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This allows using the modern | syntax for type hints while maintaining
compatibility with Python 3.9 (which requires-python >= 3.9).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Convert Union[X, Y] to X | Y syntax and remove string quotes from
type annotations. These changes are Python 3.9 compatible thanks to
'from __future__ import annotations'.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@tobixen

tobixen commented Nov 24, 2025

Copy link
Copy Markdown
Member Author

I ran ruff --check --fix and Claude is already wanting to take the credits for that :p

@tobixen
tobixen merged commit 681b6cc into main Nov 24, 2025
12 checks passed
@tobixen
tobixen deleted the collations branch November 24, 2025 12:01
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