arkindex-base-worker 0.3.7rc6__py3-none-any.whl → 0.3.7rc8__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.
@@ -108,17 +108,17 @@ class MetaDataMixin:
108
108
  return metadata["id"]
109
109
 
110
110
  @unsupported_cache
111
- def create_metadatas(
111
+ def create_metadata_bulk(
112
112
  self,
113
113
  element: Element | CachedElement,
114
- metadatas: list[dict[str, MetaType | str | int | float | None]],
114
+ metadata_list: list[dict[str, MetaType | str | int | float | None]],
115
115
  ) -> list[dict[str, str]]:
116
116
  """
117
117
  Create multiple metadata on an existing element.
118
118
  This method does not support cache.
119
119
 
120
120
  :param element: The element to create multiple metadata on.
121
- :param metadatas: The list of dict whose keys are the following:
121
+ :param metadata_list: The list of dict whose keys are the following:
122
122
  - type: MetaType
123
123
  - name: str
124
124
  - value: str | int | float
@@ -128,13 +128,13 @@ class MetaDataMixin:
128
128
  element, Element | CachedElement
129
129
  ), "element shouldn't be null and should be of type Element or CachedElement"
130
130
 
131
- assert metadatas and isinstance(
132
- metadatas, list
133
- ), "type shouldn't be null and should be of type list of Dict"
131
+ assert metadata_list and isinstance(
132
+ metadata_list, list
133
+ ), "metadata_list shouldn't be null and should be of type list of dict"
134
134
 
135
135
  # Make a copy to avoid modifying the metadata_list argument
136
136
  metas = []
137
- for index, metadata in enumerate(metadatas):
137
+ for index, metadata in enumerate(metadata_list):
138
138
  assert isinstance(
139
139
  metadata, dict
140
140
  ), f"Element at index {index} in metadata_list: Should be of type dict"
@@ -0,0 +1,3 @@
1
+ # Normalize the slug to generate __package and __module private variables
2
+ {{cookiecutter.update({"__package": cookiecutter.slug.lower().replace("_", "-")})}} # noqa: F821
3
+ {{cookiecutter.update({"__module": cookiecutter.slug.lower().replace("-", "_")})}} # noqa: F821
tests/conftest.py CHANGED
@@ -22,7 +22,7 @@ from arkindex_worker.cache import (
22
22
  create_version_table,
23
23
  init_cache_db,
24
24
  )
25
- from arkindex_worker.models import Artifact, Dataset
25
+ from arkindex_worker.models import Artifact, Dataset, Set
26
26
  from arkindex_worker.worker import BaseWorker, DatasetWorker, ElementsWorker
27
27
  from arkindex_worker.worker.dataset import DatasetState
28
28
  from arkindex_worker.worker.transcription import TextOrientation
@@ -597,7 +597,7 @@ def mock_databases(tmp_path):
597
597
  @pytest.fixture()
598
598
  def default_dataset():
599
599
  return Dataset(
600
- **{
600
+ {
601
601
  "id": "dataset_id",
602
602
  "name": "My dataset",
603
603
  "description": "A super dataset built by me",
@@ -608,11 +608,15 @@ def default_dataset():
608
608
  "task_id": "11111111-1111-1111-1111-111111111111",
609
609
  "created": "2000-01-01T00:00:00Z",
610
610
  "updated": "2000-01-01T00:00:00Z",
611
- },
612
- selected_sets=["set_1", "set_2", "set_3"],
611
+ }
613
612
  )
614
613
 
615
614
 
615
+ @pytest.fixture()
616
+ def default_train_set(default_dataset):
617
+ return Set(name="train", dataset=default_dataset)
618
+
619
+
616
620
  @pytest.fixture()
617
621
  def mock_dataset_worker(monkeypatch, mocker, _mock_worker_run_api):
618
622
  monkeypatch.setenv("PONOS_TASK", "my_task")
@@ -635,9 +639,10 @@ def mock_dev_dataset_worker(mocker):
635
639
  [
636
640
  "worker",
637
641
  "--dev",
638
- "--dataset",
639
- "11111111-1111-1111-1111-111111111111",
640
- "22222222-2222-2222-2222-222222222222",
642
+ "--set",
643
+ "11111111-1111-1111-1111-111111111111:train",
644
+ "11111111-1111-1111-1111-111111111111:val",
645
+ "22222222-2222-2222-2222-222222222222:my_set",
641
646
  ],
642
647
  )
643
648