fix: replaces strenum with mixin#193
Merged
Merged
Conversation
Closed
frayle-ons
previously approved these changes
Jun 24, 2026
frayle-ons
left a comment
Contributor
There was a problem hiding this comment.
Seems to work well to me!
the actual output when I pass in an unsupported string looks a little odd:
classifai.exceptions.DataValidationError: Invalid log level 'trivial'. Must be one of: [<LogLevel.DEBUG: 'debug'>, <LogLevel.INFO: 'info'>, <LogLevel.WARNING: 'warning'>, <LogLevel.ERROR: 'error'>, <LogLevel.CRITICAL: 'critical'>] (code=validation_error) | context={"log_level": "trivial"}would we want it to not include all the "<LogLeve.INFO" type stuff and instead just present the list of available strings in a list like ['info', 'warning', 'error', 'etc'].
But its that's a hassle or if the current way is how its programmatically presented correctly then I think its fine too
Contributor
|
LGTM classifai.exceptions.DataValidationError: Invalid log level 'trivial'. Must be one of: ['debug', 'info', 'warning', 'error', 'critical'] (code=validation_error) | context={"log_level": "trivial"} |
frayle-ons
approved these changes
Jun 24, 2026
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.
📌 Replace StrEnum with enum
As strenum isn't supported in python 3.10, we are going to replace with a str and enum mixin, type checkers like this better too
✨ Summary
Replaces strenum with enum
📜 Changes Introduced
✅ Checklist
terraform fmt&terraform validate)🔍 How to Test
To test input valid strings into
run_server()in the demo, also try seeing errors with non-valid strings, it should return an error message with allowed strings and your own, if it does work logs should only return on the given level