-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add add_image
method to Dataset
entity
#389
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #389 +/- ##
==========================================
- Coverage 75.69% 75.65% -0.05%
==========================================
Files 103 103
Lines 6753 6761 +8
==========================================
+ Hits 5112 5115 +3
- Misses 1641 1646 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
How would it work in the case of multiple images? Just by stacking multiple lazy actions together like: resource.image = [forge.attach_image(path, content_type, about) for path in paths] ? |
I think this capability should go to Resource or one of its descendants just like Dataset currently holds specific data models for distributions and provenance. It is okay to add more data models for specific properties we want to offer as default on Resource or on one of its descendants. forge.attach already supports uploading a dir (you'll get a list of distributions DataDownload) |
@MFSY my issue with adding it to |
In fact, the path can be a directory, and that would take all the files inside, and make the list automatically |
I am okay with having the method accept a forge object. Now Resource can also be extended with an Entity class that will have this method which can accept forge. In that case, client will need to create an Entity from a resource before using the method. |
What if we have files from different directories? Would the piece of code provided by elefterios work? |
I think it should, yes |
Hi @crisely09! |
Any update on this merge? |
Hi guys, |
With the current changes, to add an image, one has to start from a dataset:
This should work in the same way as explained before for paths and for a list of files. |
attach_image
method to forgeadd_image
method to Dataset
entity
To tackle #388
This is the simplest implementation to "attach" and image, and then use it to add it to any resource, similar to
attach
for distributions.Example of how it is used can be found inside the 03 - Storing notebook.
The way to add the image would be :