-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DAR-2246][External] Unify darwin-py naming convention (#868)
* Made downloading with folders the default behaviour * Added placeholder tests * Pull naming convention tests & data * Updated pull naming convention * Remove unused codepath * Aligned single-slotted multi-source file behaviour with multi-slotted multi-source file behaviour * Added tests for reading files locally * Allow get_annotations() to work with flat dataset exports * Pull with folders by default, remove unused argument & fix planned image path issue * Updated test data * Restored planned_image_path construction types * Remvoed testing assert * Long videos tests
- Loading branch information
Showing
6 changed files
with
280 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from pathlib import Path | ||
|
||
from darwin.utils.utils import get_image_path_from_stream | ||
|
||
|
||
class TestGetImagePathFromStream: | ||
def test_with_folders_true(self): | ||
darwin_json = {"item": {"name": "image.jpg", "path": "/folder"}} | ||
images_dir = Path("/images") | ||
annotation_filepath = Path("/annotations/annotation.json") | ||
expected = Path("/images/folder/image.jpg") | ||
result = get_image_path_from_stream( | ||
darwin_json, images_dir, annotation_filepath, True | ||
) | ||
assert result == expected | ||
|
||
def test_with_folders_false(self): | ||
darwin_json = {"item": {"name": "image.jpg", "path": "/folder"}} | ||
images_dir = Path("/images") | ||
annotation_filepath = Path("/annotations/annotation.json") | ||
expected = Path("/images/image.jpg") | ||
result = get_image_path_from_stream( | ||
darwin_json, images_dir, annotation_filepath, False | ||
) | ||
assert result == expected |
Binary file not shown.