-
Notifications
You must be signed in to change notification settings - Fork 253
feat: expose image attribute as expression #4848
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4848 +/- ##
==========================================
- Coverage 79.59% 79.18% -0.41%
==========================================
Files 917 919 +2
Lines 127014 127139 +125
==========================================
- Hits 101094 100674 -420
- Misses 25920 26465 +545
🚀 New features to boost your workflow:
|
daft/expressions/expressions.py
Outdated
@@ -5154,6 +5154,18 @@ def to_mode(self, mode: str | ImageMode) -> Expression: | |||
f = native.get_function_from_registry("to_mode") | |||
return Expression._from_pyexpr(f(self._expr, mode=image_mode)) | |||
|
|||
def attribute(self, name: str) -> Expression: |
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.
since we know what attributes are available, use a Literal['width', 'height', 'channel', 'mode']
for better typings
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.
sounds good
src/daft-image/src/ops.rs
Outdated
@@ -194,6 +195,31 @@ impl ImageOps for ImageArray { | |||
.collect(); | |||
image_array_from_img_buffers(self.name(), &buffers, Some(mode)) | |||
} | |||
|
|||
fn attribute(&self, attr: &str) -> DaftResult<DataArray<UInt32Type>> { |
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.
Can we use an Enum to model the attributes instead of the &str
@Jay-ju what's the status on this PR? I think once those two small changes are implemented, we could merge this one in! |
a72a431
to
367bfd9
Compare
@universalmind303 so sorry, I've been busy with other matters these few weeks. Some updates have been made here. Please take a look when you have time. |
367bfd9
to
07ea9c5
Compare
@Jay-ju how are you running pre-commit locally? |
![]() @srilman If simply executing |
Changes Made
Related Issues
Checklist
docs/mkdocs.yml
navigation