arkindex-base-worker 0.3.7rc8__py3-none-any.whl → 0.3.7rc10__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: arkindex-base-worker
3
- Version: 0.3.7rc8
3
+ Version: 0.3.7rc10
4
4
  Summary: Base Worker to easily build Arkindex ML workflows
5
5
  Author-email: Teklia <contact@teklia.com>
6
6
  Maintainer-email: Teklia <contact@teklia.com>
@@ -46,7 +46,7 @@ Requires-Dist: Pillow ==10.2.0
46
46
  Requires-Dist: pymdown-extensions ==10.7
47
47
  Requires-Dist: python-gnupg ==0.5.2
48
48
  Requires-Dist: shapely ==2.0.3
49
- Requires-Dist: teklia-toolbox ==0.1.4rc3
49
+ Requires-Dist: teklia-toolbox ==0.1.4
50
50
  Requires-Dist: zstandard ==0.22.0
51
51
  Provides-Extra: docs
52
52
  Requires-Dist: black ==24.2.0 ; extra == 'docs'
@@ -56,6 +56,10 @@ Requires-Dist: mkdocs-material ==9.5.10 ; extra == 'docs'
56
56
  Requires-Dist: mkdocstrings ==0.24.0 ; extra == 'docs'
57
57
  Requires-Dist: mkdocstrings-python ==1.8.0 ; extra == 'docs'
58
58
  Requires-Dist: recommonmark ==0.7.1 ; extra == 'docs'
59
+ Provides-Extra: tests
60
+ Requires-Dist: pytest ==8.0.1 ; extra == 'tests'
61
+ Requires-Dist: pytest-mock ==3.12.0 ; extra == 'tests'
62
+ Requires-Dist: pytest-responses ==0.5.1 ; extra == 'tests'
59
63
 
60
64
  # Arkindex base Worker
61
65
 
@@ -2,7 +2,7 @@ arkindex_worker/__init__.py,sha256=OlgCtTC9MaWeejviY0a3iQpALcRQGMVArFVVYwTF6I8,1
2
2
  arkindex_worker/cache.py,sha256=FTlB0coXofn5zTNRTcVIvh709mcw4a1bPGqkwWjKs3w,11248
3
3
  arkindex_worker/image.py,sha256=5ymIGaTm2D7Sp2YYQkbuheuGnx5VJo0_AzYAEIvNGhs,14267
4
4
  arkindex_worker/models.py,sha256=xSvOadkNg3rgccic1xLgonzP28ugzmcGw0IUqXn51Cc,9844
5
- arkindex_worker/utils.py,sha256=VSO8c21nsSaUCkyJaFX8wOwDQ0tztLOBFtiGvqlT0zU,6900
5
+ arkindex_worker/utils.py,sha256=0Mu7Fa8DVcHn19pg-FIXqMDpfgzQkb7QR9IAlAi-x_k,7243
6
6
  arkindex_worker/worker/__init__.py,sha256=U-_zOrQ09xmpBF9SmrTVj_UwnsCjFueV5G2hJAFEwv0,18806
7
7
  arkindex_worker/worker/base.py,sha256=qtkCGfpGn7SWsQZRJ5cpW0gQ4tV_cyR_AHbuHZr53z4,19585
8
8
  arkindex_worker/worker/classification.py,sha256=JVz-6YEeuavOy7zGfQi4nE_wpj9hwMUZDXTem-hXQY8,10328
@@ -23,7 +23,7 @@ tests/test_dataset_worker.py,sha256=1joFRFmkL6XfPL9y1NYB_5QO-5FF56rwigAHrqtJMMA,
23
23
  tests/test_element.py,sha256=2G9M15TLxQRmvrWM9Kw2ucnElh4kSv_oF_5FYwwAxTY,13181
24
24
  tests/test_image.py,sha256=FZv8njLxh45sVgmY71UFHt0lv1cHr0cK4rrtPhQleX8,16262
25
25
  tests/test_merge.py,sha256=Q4zCbtZbe0wBfqE56gvAD06c6pDuhqnjKaioFqIgAQw,8331
26
- tests/test_utils.py,sha256=pFXegcBvIuy1tJDDSgQtCbC_tRaoLjd2055R5lu3hS0,1236
26
+ tests/test_utils.py,sha256=vpeHMeL7bJQonv5ZEbJmlJikqVKn5VWlVEbvmYFzDYA,1650
27
27
  tests/test_elements_worker/__init__.py,sha256=Fh4nkbbyJSMv_VtjQxnWrOqTnxXaaWI8S9WU0VrzCHs,179
28
28
  tests/test_elements_worker/test_classifications.py,sha256=vU6al1THtDSmERyVscMXaqiRPwTllcpRUHyeyBQ8M9U,26417
29
29
  tests/test_elements_worker/test_cli.py,sha256=BsFTswLti63WAZ2pf6ipiZKWJJyCQuSfuKnSlESuK8g,2878
@@ -35,12 +35,13 @@ tests/test_elements_worker/test_task.py,sha256=FCpxE9UpouKXgjGvWgNHEai_Hiy2d1Ymq
35
35
  tests/test_elements_worker/test_training.py,sha256=WeG-cDuJ-YhPgfKH47TtXBxyargtLuk7c8tsik2WnL8,8414
36
36
  tests/test_elements_worker/test_transcriptions.py,sha256=WVJG26sZyY66fu-Eka9A1_WWIeNI2scogjypzURnp8A,73468
37
37
  tests/test_elements_worker/test_worker.py,sha256=7-jGJVT3yMGpIyN96Uafz5eIUrO4ieNLgw0k1D8BhGc,17163
38
+ worker-demo/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
39
  worker-demo/tests/conftest.py,sha256=XzNMNeg6pmABUAH8jN6eZTlZSFGLYjS3-DTXjiRN6Yc,1002
39
40
  worker-demo/tests/test_worker.py,sha256=3DLd4NRK4bfyatG5P_PK4k9P9tJHx9XQq5_ryFEEFVg,304
40
41
  worker-demo/worker_demo/__init__.py,sha256=2BPomV8ZMNf3YXJgloatKeHQCE6QOkwmsHGkO6MkQuM,125
41
42
  worker-demo/worker_demo/worker.py,sha256=Rt-DjWa5iBP08k58NDZMfeyPuFbtNcbX6nc5jFX7GNo,440
42
- arkindex_base_worker-0.3.7rc8.dist-info/LICENSE,sha256=NVshRi1efwVezMfW7xXYLrdDr2Li1AfwfGOd5WuH1kQ,1063
43
- arkindex_base_worker-0.3.7rc8.dist-info/METADATA,sha256=Tmk22ge5yxKO8tk8NaUDv5Xrx2_IuONRKhO1vack8ZM,3380
44
- arkindex_base_worker-0.3.7rc8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
45
- arkindex_base_worker-0.3.7rc8.dist-info/top_level.txt,sha256=58NuslgxQC2vT4DiqZEgO4JqJRrYa2yeNI9QvkbfGQU,40
46
- arkindex_base_worker-0.3.7rc8.dist-info/RECORD,,
43
+ arkindex_base_worker-0.3.7rc10.dist-info/LICENSE,sha256=NVshRi1efwVezMfW7xXYLrdDr2Li1AfwfGOd5WuH1kQ,1063
44
+ arkindex_base_worker-0.3.7rc10.dist-info/METADATA,sha256=2o2yKl7p5h3ZPrMDZTnkXabR5WNGsmBCDwA7v8uAHyo,3563
45
+ arkindex_base_worker-0.3.7rc10.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
46
+ arkindex_base_worker-0.3.7rc10.dist-info/top_level.txt,sha256=58NuslgxQC2vT4DiqZEgO4JqJRrYa2yeNI9QvkbfGQU,40
47
+ arkindex_base_worker-0.3.7rc10.dist-info/RECORD,,
arkindex_worker/utils.py CHANGED
@@ -10,6 +10,19 @@ import zstandard as zstd
10
10
 
11
11
  logger = logging.getLogger(__name__)
12
12
 
13
+ MANUAL_SOURCE = "manual"
14
+
15
+
16
+ def parse_source_id(value: str) -> bool | str | None:
17
+ """
18
+ Parse a UUID argument (Worker Version, Worker Run, ...) to use it directly in the API.
19
+ Arkindex API filters generally expect `False` to filter manual sources.
20
+ """
21
+ if value == MANUAL_SOURCE:
22
+ return False
23
+ return value or None
24
+
25
+
13
26
  CHUNK_SIZE = 1024
14
27
  """Chunk Size used for ZSTD compression"""
15
28
 
tests/test_utils.py CHANGED
@@ -1,11 +1,33 @@
1
1
  from pathlib import Path
2
2
 
3
- from arkindex_worker.utils import close_delete_file, extract_tar_zst_archive
3
+ import pytest
4
+
5
+ from arkindex_worker.utils import (
6
+ close_delete_file,
7
+ extract_tar_zst_archive,
8
+ parse_source_id,
9
+ )
4
10
 
5
11
  FIXTURES = Path(__file__).absolute().parent / "data"
6
12
  ARCHIVE = FIXTURES / "archive.tar.zst"
7
13
 
8
14
 
15
+ @pytest.mark.parametrize(
16
+ ("source_id", "expected"),
17
+ [
18
+ (None, None),
19
+ ("", None),
20
+ (
21
+ "cafecafe-cafe-cafe-cafe-cafecafecafe",
22
+ "cafecafe-cafe-cafe-cafe-cafecafecafe",
23
+ ),
24
+ ("manual", False),
25
+ ],
26
+ )
27
+ def test_parse_source_id(source_id, expected):
28
+ assert parse_source_id(source_id) == expected
29
+
30
+
9
31
  def test_extract_tar_zst_archive(tmp_path):
10
32
  destination = tmp_path / "destination"
11
33
  _, archive_path = extract_tar_zst_archive(ARCHIVE, destination)
File without changes