Conversation
smaye81
commented
Jun 18, 2025
| """An implementation of string.format() in CEL.""" | ||
|
|
||
| def __init__(self, locale: str): | ||
| self.locale = locale |
Contributor
Author
There was a problem hiding this comment.
locale was not used anywhere. We can add it back when/if it's needed.
stefanvanburen
approved these changes
Jun 18, 2025
protovalidate/internal/extra_func.py
Outdated
| def make_extra_funcs(locale: str) -> dict[str, celpy.CELFunction]: | ||
| # For now, ignoring the type. | ||
| string_fmt = string_format.StringFormat(locale) # type: ignore | ||
| def get_matches_func(matcher: typing.Optional[typing.Callable[[str, str], bool]]): |
Member
There was a problem hiding this comment.
honestly haven't kept up with type hints in Python but should we be using collections.abc.Callable instead, since typing.Callable seems to be a deprecated alias as of 3.9?
Contributor
Author
There was a problem hiding this comment.
Oh nice. Thanks. Wonder why the linter didn't catch that. 🤷 . Fixed.
protovalidate/internal/matches.py
Outdated
| function via the Config. | ||
|
|
||
| Raises: | ||
| celpy.CELEvalError: If pattern contains invalid re2 syntax. |
Member
There was a problem hiding this comment.
We're also raising this on re.error on the second re.search, do we want to document when that will go wrong?
Alfus
approved these changes
Jun 18, 2025
stefanvanburen
approved these changes
Jun 18, 2025
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.
This adds the ability to the
Configobject for specifying an optional custom matcher. If provided, it will be invoked instead of protovalidate-python'smatchesimplementation.