-
-
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
Fix params #2173
Fix params #2173
Conversation
Reviewer's Guide by SourceryThe changes focus on improving code organization and readability through parameter validation refinement, function signature formatting, and alphabetical sorting of imports and exports. The main implementation changes include fixing parameter validation logic in transforms, updating pre-commit hooks, and reorganizing transformation lists. Class diagram for updated parameter validationclassDiagram
class ImageCompression {
+tuple[int, int] quality_range
+validate_ranges() Self
+apply(np.ndarray img, int quality, Literal[".jpg", ".webp"] image_type, **params: Any) np.ndarray
}
class RandomSnow {
+tuple[float, float] snow_point_range
+validate_ranges() Self
+apply(np.ndarray img, float snow_point, float brightness_coeff, np.ndarray snow_texture, np.ndarray sparkle_mask) np.ndarray
}
class Posterize {
+int | tuple[int, int] | list[tuple[int, int]] num_bits
+validate_num_bits(Any num_bits) tuple[int, int] | list[tuple[int, int]]
+apply(np.ndarray img, int num_bits, **params: Any) np.ndarray
}
Class diagram for updated noise parametersclassDiagram
class AdditiveNoise {
+Literal["uniform", "gaussian", "laplace", "beta"] noise_type
+Literal["constant", "per_pixel", "shared"] spatial_mode
+dict[str, Any] | None noise_params
+apply(np.ndarray img, np.ndarray noise_map, **params: Any) np.ndarray
}
class UniformParams {
+list[Sequence[float]] ranges
+validate_ranges(list[Sequence[float]] v) list[tuple[float, float]]
}
class GaussianParams {
+Sequence[float] mean_range
+Sequence[float] std_range
}
class LaplaceParams {
+Sequence[float] mean_range
+Sequence[float] scale_range
}
class BetaParams {
+Sequence[float] alpha_range
+Sequence[float] beta_range
+Sequence[float] scale_range
}
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:
- This PR contains breaking changes: 1) Removed Poisson noise option from noise transforms 2) Modified Posterize transform to no longer accept 0 bits. Please document these changes in the changelog.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 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.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2173 +/- ##
=========================================
+ Coverage 0 89.80% +89.80%
=========================================
Files 0 47 +47
Lines 0 8478 +8478
=========================================
+ Hits 0 7614 +7614
- Misses 0 864 +864 ☔ View full report in Codecov by Sentry. |
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 and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟡 Testing: 3 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
Refactor the codebase to improve readability and maintainability by reordering transformations, breaking down long lines, and updating import statements. Fix validation logic for normalization parameters. Enhance test coverage by adding new test cases for auto_contrast and updating existing tests. Update pre-commit configuration to use the latest tool versions.
Bug Fixes:
Enhancements:
Tests:
Chores: