Skip to content

fix: replaces strenum with mixin#193

Merged
rileyok-ons merged 2 commits into
mainfrom
192-remove-loglevel-strenum
Jun 25, 2026
Merged

fix: replaces strenum with mixin#193
rileyok-ons merged 2 commits into
mainfrom
192-remove-loglevel-strenum

Conversation

@rileyok-ons

@rileyok-ons rileyok-ons commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

📌 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

  • Feature implementation (feat:) / bug fix (fix:) / refactoring (chore:) / documentation (docs:) / testing (test:)
  • Updates to tests and/or documentation
  • Terraform changes (if applicable)

✅ Checklist

Please confirm you've completed these checks before requesting a review.

  • Code passes linting with Ruff
  • Security checks pass using Bandit
  • API and Unit tests are written and pass using pytest
  • Terraform files (if applicable) follow best practices and have been validated (terraform fmt & terraform validate)
  • DocStrings follow Google-style and are added as per Pylint recommendations
  • Documentation has been updated if needed

🔍 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

@rileyok-ons rileyok-ons requested a review from a team as a code owner June 23, 2026 16:36
@rileyok-ons rileyok-ons linked an issue Jun 23, 2026 that may be closed by this pull request
@github-actions github-actions Bot added the bug Something isn't working label Jun 23, 2026
frayle-ons
frayle-ons previously approved these changes Jun 24, 2026

@frayle-ons frayle-ons left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@frayle-ons

Copy link
Copy Markdown
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"}

@rileyok-ons rileyok-ons merged commit fad6304 into main Jun 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove LogLevel strenum

2 participants