-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Added srict to Compose #2327
Added srict to Compose #2327
Conversation
Reviewer's Guide by SourceryThis pull request introduces a strict mode to the Compose class, which validates input keys and transform parameters. It also adds new rain and mud spatter effects with corresponding tests and refactors the spatter implementation. Sequence diagram for strict mode validation flowsequenceDiagram
participant C as Compose
participant BT as BasicTransform
participant V as Validator
C->>C: set strict=True
activate C
C->>C: _validate_strict()
loop For each transform
C->>BT: check_transform()
alt has invalid args
BT-->>C: raise ValueError
end
end
deactivate C
C->>C: preprocess(data)
activate C
alt strict mode enabled
C->>V: validate data
V-->>C: validation result
alt validation fails
C-->>C: raise ValueError
end
end
deactivate C
Class diagram for Compose and BasicTransform changesclassDiagram
class Compose {
-bool _strict
+bool strict
+__init__(transforms, strict=False)
+_validate_strict()
+preprocess(data)
}
class BasicTransform {
-bool _strict
+bool strict
+list[str] invalid_args
+__init__(p=0.5, **kwargs)
}
note for Compose "Added strict mode validation"
note for BasicTransform "Added strict mode and invalid args tracking"
State diagram for transform validationstateDiagram-v2
[*] --> Init: Create transform
Init --> Configured: Set parameters
Configured --> ValidatingArgs: Enable strict mode
ValidatingArgs --> Invalid: Has invalid args
ValidatingArgs --> Valid: No invalid args
Invalid --> Error: Raise ValueError
Valid --> Ready: Continue execution
Ready --> [*]
Error --> [*]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @ternaus - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding documentation examples showing how the new strict validation mode helps catch common configuration errors
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 2 issues found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Summary by Sourcery
Add rain and mud effects to the Spatter transform.
New Features:
get_rain_params
function to generate rain effect parameters.get_mud_params
function to generate mud effect parameters.Spatter
transform.Tests:
get_rain_params
andget_mud_params
functions.Spatter
transform with rain and mud modes.