Skip to content

feat: coerce python types#5

Merged
weiliddat merged 4 commits intomainfrom
feat/coerce-python-types
Aug 4, 2025
Merged

feat: coerce python types#5
weiliddat merged 4 commits intomainfrom
feat/coerce-python-types

Conversation

@weiliddat
Copy link
Owner

Co-authored-by: @gersmann stefan@gersmann.de

if isinstance(ov, re.Pattern) and isinstance(doc, str):
if ov.search(doc):
return True
return bool(ov.search(doc))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regarding this, if one is a pattern and the other side is not a string, but for instance an UUID - we could coerce to string, yes, could technically be helpful in the good old ObjectId as a/b bucket flag scenario, or some more advanced filter logic. But on the other hand I haven't thought through possible failure modes, so maybe best to just keep it as is for now.

original values so the caller can attempt a normal comparison.
"""

match (a, b):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, that's a good use case for that

Copy link
Collaborator

@gersmann gersmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for us, the tests we have (not exhaustive in all fairness) are green.

@weiliddat
Copy link
Owner Author

Works for us, the tests we have (not exhaustive in all fairness) are green.

I will merge and release. Thanks!

@weiliddat weiliddat merged commit f81c115 into main Aug 4, 2025
3 checks passed
@weiliddat weiliddat deleted the feat/coerce-python-types branch January 3, 2026 12:55
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.

2 participants