fix: Update operations on DW Operations. - #688
Conversation
Release 0.4.56
Release 0.4.57
Release 0.4.58
luisremis
left a comment
There was a problem hiding this comment.
add testing for all old and new operations
|
Addressed the review comments by adding |
There was a problem hiding this comment.
Pull request overview
This PR updates the aperturedb.Operations.Operations builder to support additional on-the-fly media operations and to broaden the resize API so it can be expressed using width, height, and/or scale. It also adds a focused unit test module to validate the generated operations payloads.
Changes:
- Added
threshold()operation builder. - Added
preview()operation builder with optional limiting parameters. - Refactored
resize()to accept optionalwidth,height, andscale, and added tests for the operations array output.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
aperturedb/Operations.py |
Extends the operations DSL with threshold and preview, and changes resize to accept optional sizing parameters. |
test/test_Operations.py |
Adds unit tests asserting operation payload shapes for resize/rotate/flip/crop/interval/threshold/preview and chaining. |
Comments suppressed due to low confidence (1)
aperturedb/Operations.py:89
preview()arguments default toNonebut are annotated as non-optional types. Please change them toOptional[...](orT | None) so the signature matches actual accepted values and aligns with typing style used elsewhere in the repo.
def preview(self, max_frame_count: int = None, max_time_fraction: float = None, max_time_offset: str = None, max_size_mb: float = None) -> Operations:
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ad-claw000
left a comment
There was a problem hiding this comment.
Applied autopep8 formatting to the new log messages to fix the pre-commit CI failure.
ad-claw000
left a comment
There was a problem hiding this comment.
Addressed the remaining feedback about type hints and tests. PTAL!
ad-claw000
left a comment
There was a problem hiding this comment.
Addressed the feedback: updated Operations.resize to reject invalid scale vs width/height combinations, updated Images.resolve to correctly handle 'scale', and updated the PR description with the CI details.
|
I have reviewed the PR and verified that all actionable review comments have been properly addressed:
Tests have been run locally and all 11 operations tests passed successfully. All review threads have been marked as resolved. |
|
I've also added a missing test for |
|
I've added the missing tests for the remaining |
ad-claw000
left a comment
There was a problem hiding this comment.
Added testing for all old and new operations in test/test_Operations.py (covered in recent commits, plus test_empty_operations in d830c30). All operations are now covered.
Summary
Updates Operations class with preview and threshold operations, and refactors resize.
Also includes CI and test infrastructure optimizations to improve reliability.
Changes
thresholdoperation.previewoperation.resizeoperation to acceptwidth,height, andscaleas optional arguments, with validation to reject mixed/empty args.Testing
test/test_Operations.pyto verify old and new Operations configurations.Fixes #160