Skip to content

Commit 912870e

Browse files
committed
Merge branch 'master' of https://github.com/superannotateai/superannotate-python-sdk into public_links_dev
2 parents 9a0b7ed + d8430a4 commit 912870e

File tree

5 files changed

+60
-27
lines changed

5 files changed

+60
-27
lines changed

Makefile

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
MAKEFLAGS += -j1
44

55
PYTHON=python3
6+
PIP=pip3
67
PYLINT=pylint
78
PYTESTS=pytest
89
COVERAGE=coverage
@@ -25,7 +26,7 @@ test_coverage: check_formatting
2526
@echo "\033[95m\n\nCoverage successful! View the output at file://htmlcov/index.html.\n\033[0m"
2627

2728
install:
28-
pip install -e .
29+
$(PIP) install -e .
2930

3031
lint: check_formatting
3132
-$(PYLINT) --output-format=json superannotate/ | pylint-json2html -o pylint.html
@@ -44,3 +45,22 @@ dist:
4445

4546
check_formatting:
4647
yapf -p -r --diff superannotate
48+
49+
docker_run_dev_env: docker_pull_dev_env
50+
docker run -it -p 8888:8888 \
51+
-v ${HOME}/.superannotate:/root/.superannotate \
52+
-v $(pwd):/root/superannotate-python-sdk \
53+
superannotate/pythonsdk-dev-env
54+
55+
docker_run_dev_env_local_copy: docker_build_dev_env_from_local_copy
56+
docker run -it -p 8888:8888 \
57+
-v ${HOME}/.superannotate:/root/.superannotate \
58+
-v $(pwd):/root/superannotate-python-sdk \
59+
superannotate/pythonsdk-dev-env \
60+
bash -c "pip install -e superannotate-python-sdk && jupyter lab --allow-root --NotebookApp.token='' --NotebookApp.password='' --no-browser --ip 0.0.0.0"
61+
62+
docker_build_dev_env_from_local_copy:
63+
docker build -t superannotate/pythonsdk-dev-env:latest -f Dockerfile_dev_env .
64+
65+
docker_pull_dev_env:
66+
docker pull superannotate/pythonsdk-dev-env:latest

run_dev_env_in_container.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

superannotate/db/project_images.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,12 @@ def _copy_images(
185185
)
186186
if annotations["annotation_json"] is not None:
187187
if "annotation_mask" in annotations:
188-
upload_image_annotations(
189-
(destination_project, destination_project_folder),
190-
image_name, annotations["annotation_json"],
191-
annotations["annotation_mask"]
192-
)
188+
if annotations["annotation_mask"] is not None:
189+
upload_image_annotations(
190+
(destination_project, destination_project_folder),
191+
image_name, annotations["annotation_json"],
192+
annotations["annotation_mask"]
193+
)
193194
else:
194195
upload_image_annotations(
195196
(destination_project, destination_project_folder),
@@ -409,11 +410,12 @@ def copy_image(
409410
)
410411
if annotations["annotation_json"] is not None:
411412
if "annotation_mask" in annotations:
412-
upload_image_annotations(
413-
(destination_project, destination_project_folder), new_name,
414-
annotations["annotation_json"],
415-
annotations["annotation_mask"]
416-
)
413+
if annotations["annotation_mask"] is not None:
414+
upload_image_annotations(
415+
(destination_project, destination_project_folder),
416+
new_name, annotations["annotation_json"],
417+
annotations["annotation_mask"]
418+
)
417419
else:
418420
upload_image_annotations(
419421
(destination_project, destination_project_folder), new_name,

superannotate/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "4.1.0b15"
1+
__version__ = "4.1.0b18"

tests/test_folders.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,32 @@ def test_copy_images3(tmpdir):
274274
assert num_images == 4
275275

276276

277+
def test_copy_images4(tmpdir):
278+
PROJECT_NAME = "test copy4 folder images"
279+
tmpdir = Path(tmpdir)
280+
281+
projects_found = sa.search_projects(PROJECT_NAME, return_metadata=True)
282+
for pr in projects_found:
283+
sa.delete_project(pr)
284+
285+
project = sa.create_project(PROJECT_NAME, 'test', 'Pixel')
286+
sa.upload_images_from_folder_to_project(
287+
project, FROM_FOLDER, annotation_status="InProgress"
288+
)
289+
sa.create_folder(project, "folder1")
290+
project = PROJECT_NAME + "/folder1"
291+
292+
sa.copy_images(
293+
PROJECT_NAME, ["example_image_2.jpg", "example_image_3.jpg"], project
294+
)
295+
296+
num_images = sa.get_project_image_count(project)
297+
assert num_images == 2
298+
299+
num_images = sa.get_project_image_count(PROJECT_NAME)
300+
assert num_images == 4
301+
302+
277303
def test_copy_images(tmpdir):
278304
PROJECT_NAME = "test copy folder images"
279305
tmpdir = Path(tmpdir)

0 commit comments

Comments
 (0)