- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support individual partial enum values #1228
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Reviewed everything up to 15d0093 in 47 seconds
More details
- Looked at
135
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
6
drafted comments based on config settings.
1. instructor/dsl/partial.py:13
- Draft comment:
Any
is imported twice. Remove the duplicate import on line 18. - Reason this comment was not posted:
Confidence changes required:50%
The import statement forAny
is duplicated, which is unnecessary and can be removed for cleaner code.
2. instructor/dsl/partial.py:55
- Draft comment:
ReturningNone
for invalid literals might lead to unexpected behavior. Consider raising a validation error or handling this case explicitly. - Reason this comment was not posted:
Confidence changes required:50%
ThePartialLiteralValidator
class is designed to validate literal values, but it returnsNone
if the value is not in the literal type. This could lead to unexpected behavior if not handled properly. It might be better to raise a validation error or handle this case explicitly.
3. instructor/dsl/partial.py:104
- Draft comment:
Consider adding a comment to explain the logic for handlingPartial
in field metadata when dealing withLiteral
types. - Reason this comment was not posted:
Confidence changes required:33%
ThePartialLiteralValidator
is used to validate literal types, but the logic for handlingPartial
in field metadata is not clearly explained. A comment explaining this logic would improve code readability.
4. tests/dsl/test_partial.py:230
- Draft comment:
Typo in comment: 'partil' should be 'partial'. - Reason this comment was not posted:
Confidence changes required:10%
The test casetest_partial_enums
has a typo in the comment on line 230. It should be 'partial' instead of 'partil'.
5. tests/dsl/test_partial.py:57
- Draft comment:
Assertions should include error messages for clarity and debugging purposes. This applies to all assertions in this file. - Reason this comment was not posted:
Confidence changes required:80%
The assertion statements in the test file lack error messages, which are important for debugging when tests fail.
6. instructor/dsl/partial.py:60
- Draft comment:
Function names should follow a consistent naming pattern. Consider using snake_case for all function names to maintain consistency. - Reason this comment was not posted:
Confidence changes required:70%
The function names in the code are inconsistent. Some functions use snake_case while others use camelCase. Consistent naming conventions should be followed.
Workflow ID: wflow_NMW6RGhC1ZPqHg3J
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Support partial enums
Closing as part of repository maintenance for pull requests created before 2025. |
If you use literal values with partial it fails as the model is generating partial values.
PartialLiteralMixin
is one approach to fixing this but then means no other string values will stream as they're processed.This is another approach that doesn't change how we parse the JSON, but just means the partial model won't validate these enums until they're fully resolved.
Important
Adds support for handling partial enum values in JSON parsing using
PartialLiteralValidator
and updates tests accordingly.PartialLiteralValidator
inpartial.py
to handle partial enum values._make_field_optional()
to usePartialLiteralValidator
forLiteral
types withPartial
.test_partial_enums()
intest_partial.py
to validate partial enum handling.This description was created by
for 15d0093. It will automatically update as commits are pushed.