Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #135.
Now when
write
is called on a crate containing at least a file or dataset whose source is missing, anOSError
will be raised. Note that the use case mentioned in #73 is still covered: a crate with a missing data entity can still be loaded, but will not be immediately writable back to disk. To "fix" the crate, one can set the source of the offending data entity to:an existing file or directory
None
: in this case, when the crate is written:1.1 If the data entity is a
File
, the actual file will still be missing in the serialized crate, and a warning will be issued2.1 If the data entity is a
Dataset
, an empty directory will be created for itWhen creating a new RO-Crate, it's now possible to pass
None
as the source argument ofFile
andDataset
: the former allows to create a crate with a missing file, which will be treated as explained above; the latter allows to add an empty directory to a new crate.Example:
Se the unit tests diff for detailed checks on all use cases.
Finally, note that another option to create a data entity with missing source is to use a
file:
URI as the id.