current-data-py 0.1.10__tar.gz → 0.1.11__tar.gz
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.
- {current_data_py-0.1.10 → current_data_py-0.1.11}/MANIFEST.in +1 -0
- {current_data_py-0.1.10/current_data_py.egg-info → current_data_py-0.1.11}/PKG-INFO +43 -1
- {current_data_py-0.1.10 → current_data_py-0.1.11}/README.md +42 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11/current_data_py.egg-info}/PKG-INFO +43 -1
- {current_data_py-0.1.10 → current_data_py-0.1.11}/current_data_py.egg-info/SOURCES.txt +3 -0
- current_data_py-0.1.11/labeling.py +102 -0
- current_data_py-0.1.11/proto_gen/python/labeling/service/service_pb2.py +82 -0
- current_data_py-0.1.11/proto_gen/python/labeling/service/service_pb2_grpc.py +433 -0
- current_data_py-0.1.11/proto_gen/python/labeling/task/task_pb2.py +50 -0
- current_data_py-0.1.11/proto_gen/python/labeling/template/template_pb2.py +40 -0
- current_data_py-0.1.11/proto_gen/python/management/selection/selection_pb2.py +27 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/pyproject.toml +1 -1
- {current_data_py-0.1.10 → current_data_py-0.1.11}/setup.py +1 -1
- current_data_py-0.1.11/tests/check_labeling.py +111 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/__init__.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/current_data_py.egg-info/dependency_links.txt +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/current_data_py.egg-info/requires.txt +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/current_data_py.egg-info/top_level.txt +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/decoding.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/examples/__init__.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/examples/list_schemas.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/examples/read_remote_td.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/examples/read_td.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/examples/write_td.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/management.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/oss.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/management/metadata/metadata_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/management/service/service_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/management/service/service_pb2_grpc.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/builtin_interfaces/duration_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/builtin_interfaces/time_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/custom_msgs/joint_current_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/custom_msgs/pose_rpy_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/custom_msgs/slam_quality_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/custom_msgs/sonic_frame_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/custom_msgs/target_quality_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/foxglove/compressed_audio_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/foxglove/compressed_video_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/geometry_msgs/point32_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/geometry_msgs/point_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/geometry_msgs/pose_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/geometry_msgs/pose_stamped_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/geometry_msgs/pose_with_covariance_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/geometry_msgs/pose_with_covariance_stamped_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/geometry_msgs/quaternion_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/geometry_msgs/transform_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/geometry_msgs/transform_stamped_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/geometry_msgs/twist_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/geometry_msgs/twist_stamped_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/geometry_msgs/twist_with_covariance_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/geometry_msgs/twist_with_covariance_stamped_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/geometry_msgs/vector3_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/geometry_msgs/wrench_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/geometry_msgs/wrench_stamped_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/nav_msgs/map_meta_data_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/nav_msgs/occupancy_grid_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/nav_msgs/odometry_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/nav_msgs/path_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/sensor_msgs/battery_state_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/sensor_msgs/camera_info_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/sensor_msgs/compressed_image_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/sensor_msgs/image_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/sensor_msgs/imu_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/sensor_msgs/joint_state_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/sensor_msgs/laser_scan_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/sensor_msgs/nav_sat_fix_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/sensor_msgs/nav_sat_status_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/sensor_msgs/point_cloud2_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/sensor_msgs/point_field_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/sensor_msgs/range_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/sensor_msgs/region_of_interest_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/std_msgs/bool_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/std_msgs/color_rgba_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/std_msgs/float32_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/std_msgs/float64_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/std_msgs/header_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/std_msgs/int32_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/std_msgs/string_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/std_msgs/uint32_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/proto_gen/python/msg/tf2_msgs/tf_message_pb2.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/remote/__init__.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/remote/client.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/remote/source.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/schema/__init__.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/schema/message_metadata.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/setup.cfg +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/tests/check_environment.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/tests/check_management.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/tests/check_oss.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/tests/check_package.py +0 -0
- {current_data_py-0.1.10 → current_data_py-0.1.11}/tests/check_remote.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: current-data-py
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.11
|
|
4
4
|
Summary: Current Data protobuf messages and schema metadata
|
|
5
5
|
Requires-Python: >=3.9
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -336,6 +336,47 @@ with ManagementClient(address=os.environ["MANAGEMENT_ADDRESS"]) as management:
|
|
|
336
336
|
Deploy the V2 credential APIs and configure bucket regions before using reads
|
|
337
337
|
or the upload `data_kind` option.
|
|
338
338
|
|
|
339
|
+
## Pre-annotation
|
|
340
|
+
|
|
341
|
+
`current_data_py.labeling.LabelingClient` wraps the pre-annotation RPCs
|
|
342
|
+
`CreateTask`, `ListTasks`, `ListItems`, `WriteResult`, and `UpdatePreAnnotation` with
|
|
343
|
+
ManagementClient's TLS, package default address, caller-owned channel, per-call
|
|
344
|
+
`timeout` (30 seconds by default, `None` disables it), and `metadata` conventions.
|
|
345
|
+
Errors propagate without retries. Protobuf types are available through
|
|
346
|
+
`service_pb2`, `task_pb2`, and `DataSelection` in the same module.
|
|
347
|
+
|
|
348
|
+
```python
|
|
349
|
+
from current_data_py.labeling import LabelingClient, service_pb2, task_pb2
|
|
350
|
+
|
|
351
|
+
with LabelingClient() as labeling:
|
|
352
|
+
task = labeling.create_task(
|
|
353
|
+
"template-id", name="Pre-annotation",
|
|
354
|
+
input_sources=[task_pb2.InputSource(td_file=task_pb2.TdFileSource(data_id="data-id"))],
|
|
355
|
+
start_pre_annotation=True,
|
|
356
|
+
)
|
|
357
|
+
for item in labeling.list_items(task.task_id):
|
|
358
|
+
# Match question keys and option keys to the existing built-in template.
|
|
359
|
+
labeling.write_result(item.item_id, task_pb2.Result(question_results=[
|
|
360
|
+
task_pb2.QuestionResult(
|
|
361
|
+
question_key="quality",
|
|
362
|
+
choice=task_pb2.ChoiceResult(selected_option_keys=["ok"]),
|
|
363
|
+
),
|
|
364
|
+
]))
|
|
365
|
+
# On inference failure instead: write_result(item.item_id, pre_annotation_error="reason")
|
|
366
|
+
labeling.update_pre_annotation(
|
|
367
|
+
task.task_id, service_pb2.UpdatePreAnnotationRequest.ACTION_OPEN_HUMAN_REVIEW,
|
|
368
|
+
)
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
Alternatively, pass `data_selection=DataSelection(...)` when creating a task.
|
|
372
|
+
Use `ACTION_ACCEPT_ALL_AND_COMPLETE` to accept all pre-annotations as final labels.
|
|
373
|
+
Use an existing built-in template; custom templates do not support pre-annotation.
|
|
374
|
+
The server validates inputs and task transitions.
|
|
375
|
+
|
|
376
|
+
`list_tasks` and `list_items` return repeated protobuf collections.
|
|
377
|
+
`create_task` and `update_pre_annotation` return full protobuf responses
|
|
378
|
+
(including item count and task ID, or status). `write_result` returns `None`.
|
|
379
|
+
|
|
339
380
|
## 打包
|
|
340
381
|
|
|
341
382
|
```bash
|
|
@@ -355,6 +396,7 @@ python -m pip install --force-reinstall dist/*.whl
|
|
|
355
396
|
python -I tests/check_package.py
|
|
356
397
|
python -I tests/check_environment.py
|
|
357
398
|
python -I tests/check_management.py
|
|
399
|
+
python -I tests/check_labeling.py
|
|
358
400
|
python -I tests/check_remote.py
|
|
359
401
|
python -I tests/check_oss.py
|
|
360
402
|
```
|
|
@@ -322,6 +322,47 @@ with ManagementClient(address=os.environ["MANAGEMENT_ADDRESS"]) as management:
|
|
|
322
322
|
Deploy the V2 credential APIs and configure bucket regions before using reads
|
|
323
323
|
or the upload `data_kind` option.
|
|
324
324
|
|
|
325
|
+
## Pre-annotation
|
|
326
|
+
|
|
327
|
+
`current_data_py.labeling.LabelingClient` wraps the pre-annotation RPCs
|
|
328
|
+
`CreateTask`, `ListTasks`, `ListItems`, `WriteResult`, and `UpdatePreAnnotation` with
|
|
329
|
+
ManagementClient's TLS, package default address, caller-owned channel, per-call
|
|
330
|
+
`timeout` (30 seconds by default, `None` disables it), and `metadata` conventions.
|
|
331
|
+
Errors propagate without retries. Protobuf types are available through
|
|
332
|
+
`service_pb2`, `task_pb2`, and `DataSelection` in the same module.
|
|
333
|
+
|
|
334
|
+
```python
|
|
335
|
+
from current_data_py.labeling import LabelingClient, service_pb2, task_pb2
|
|
336
|
+
|
|
337
|
+
with LabelingClient() as labeling:
|
|
338
|
+
task = labeling.create_task(
|
|
339
|
+
"template-id", name="Pre-annotation",
|
|
340
|
+
input_sources=[task_pb2.InputSource(td_file=task_pb2.TdFileSource(data_id="data-id"))],
|
|
341
|
+
start_pre_annotation=True,
|
|
342
|
+
)
|
|
343
|
+
for item in labeling.list_items(task.task_id):
|
|
344
|
+
# Match question keys and option keys to the existing built-in template.
|
|
345
|
+
labeling.write_result(item.item_id, task_pb2.Result(question_results=[
|
|
346
|
+
task_pb2.QuestionResult(
|
|
347
|
+
question_key="quality",
|
|
348
|
+
choice=task_pb2.ChoiceResult(selected_option_keys=["ok"]),
|
|
349
|
+
),
|
|
350
|
+
]))
|
|
351
|
+
# On inference failure instead: write_result(item.item_id, pre_annotation_error="reason")
|
|
352
|
+
labeling.update_pre_annotation(
|
|
353
|
+
task.task_id, service_pb2.UpdatePreAnnotationRequest.ACTION_OPEN_HUMAN_REVIEW,
|
|
354
|
+
)
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Alternatively, pass `data_selection=DataSelection(...)` when creating a task.
|
|
358
|
+
Use `ACTION_ACCEPT_ALL_AND_COMPLETE` to accept all pre-annotations as final labels.
|
|
359
|
+
Use an existing built-in template; custom templates do not support pre-annotation.
|
|
360
|
+
The server validates inputs and task transitions.
|
|
361
|
+
|
|
362
|
+
`list_tasks` and `list_items` return repeated protobuf collections.
|
|
363
|
+
`create_task` and `update_pre_annotation` return full protobuf responses
|
|
364
|
+
(including item count and task ID, or status). `write_result` returns `None`.
|
|
365
|
+
|
|
325
366
|
## 打包
|
|
326
367
|
|
|
327
368
|
```bash
|
|
@@ -341,6 +382,7 @@ python -m pip install --force-reinstall dist/*.whl
|
|
|
341
382
|
python -I tests/check_package.py
|
|
342
383
|
python -I tests/check_environment.py
|
|
343
384
|
python -I tests/check_management.py
|
|
385
|
+
python -I tests/check_labeling.py
|
|
344
386
|
python -I tests/check_remote.py
|
|
345
387
|
python -I tests/check_oss.py
|
|
346
388
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: current-data-py
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.11
|
|
4
4
|
Summary: Current Data protobuf messages and schema metadata
|
|
5
5
|
Requires-Python: >=3.9
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -336,6 +336,47 @@ with ManagementClient(address=os.environ["MANAGEMENT_ADDRESS"]) as management:
|
|
|
336
336
|
Deploy the V2 credential APIs and configure bucket regions before using reads
|
|
337
337
|
or the upload `data_kind` option.
|
|
338
338
|
|
|
339
|
+
## Pre-annotation
|
|
340
|
+
|
|
341
|
+
`current_data_py.labeling.LabelingClient` wraps the pre-annotation RPCs
|
|
342
|
+
`CreateTask`, `ListTasks`, `ListItems`, `WriteResult`, and `UpdatePreAnnotation` with
|
|
343
|
+
ManagementClient's TLS, package default address, caller-owned channel, per-call
|
|
344
|
+
`timeout` (30 seconds by default, `None` disables it), and `metadata` conventions.
|
|
345
|
+
Errors propagate without retries. Protobuf types are available through
|
|
346
|
+
`service_pb2`, `task_pb2`, and `DataSelection` in the same module.
|
|
347
|
+
|
|
348
|
+
```python
|
|
349
|
+
from current_data_py.labeling import LabelingClient, service_pb2, task_pb2
|
|
350
|
+
|
|
351
|
+
with LabelingClient() as labeling:
|
|
352
|
+
task = labeling.create_task(
|
|
353
|
+
"template-id", name="Pre-annotation",
|
|
354
|
+
input_sources=[task_pb2.InputSource(td_file=task_pb2.TdFileSource(data_id="data-id"))],
|
|
355
|
+
start_pre_annotation=True,
|
|
356
|
+
)
|
|
357
|
+
for item in labeling.list_items(task.task_id):
|
|
358
|
+
# Match question keys and option keys to the existing built-in template.
|
|
359
|
+
labeling.write_result(item.item_id, task_pb2.Result(question_results=[
|
|
360
|
+
task_pb2.QuestionResult(
|
|
361
|
+
question_key="quality",
|
|
362
|
+
choice=task_pb2.ChoiceResult(selected_option_keys=["ok"]),
|
|
363
|
+
),
|
|
364
|
+
]))
|
|
365
|
+
# On inference failure instead: write_result(item.item_id, pre_annotation_error="reason")
|
|
366
|
+
labeling.update_pre_annotation(
|
|
367
|
+
task.task_id, service_pb2.UpdatePreAnnotationRequest.ACTION_OPEN_HUMAN_REVIEW,
|
|
368
|
+
)
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
Alternatively, pass `data_selection=DataSelection(...)` when creating a task.
|
|
372
|
+
Use `ACTION_ACCEPT_ALL_AND_COMPLETE` to accept all pre-annotations as final labels.
|
|
373
|
+
Use an existing built-in template; custom templates do not support pre-annotation.
|
|
374
|
+
The server validates inputs and task transitions.
|
|
375
|
+
|
|
376
|
+
`list_tasks` and `list_items` return repeated protobuf collections.
|
|
377
|
+
`create_task` and `update_pre_annotation` return full protobuf responses
|
|
378
|
+
(including item count and task ID, or status). `write_result` returns `None`.
|
|
379
|
+
|
|
339
380
|
## 打包
|
|
340
381
|
|
|
341
382
|
```bash
|
|
@@ -355,6 +396,7 @@ python -m pip install --force-reinstall dist/*.whl
|
|
|
355
396
|
python -I tests/check_package.py
|
|
356
397
|
python -I tests/check_environment.py
|
|
357
398
|
python -I tests/check_management.py
|
|
399
|
+
python -I tests/check_labeling.py
|
|
358
400
|
python -I tests/check_remote.py
|
|
359
401
|
python -I tests/check_oss.py
|
|
360
402
|
```
|
|
@@ -2,12 +2,14 @@ MANIFEST.in
|
|
|
2
2
|
README.md
|
|
3
3
|
__init__.py
|
|
4
4
|
decoding.py
|
|
5
|
+
labeling.py
|
|
5
6
|
management.py
|
|
6
7
|
oss.py
|
|
7
8
|
pyproject.toml
|
|
8
9
|
setup.py
|
|
9
10
|
./__init__.py
|
|
10
11
|
./decoding.py
|
|
12
|
+
./labeling.py
|
|
11
13
|
./management.py
|
|
12
14
|
./oss.py
|
|
13
15
|
./examples/__init__.py
|
|
@@ -36,6 +38,7 @@ remote/source.py
|
|
|
36
38
|
schema/__init__.py
|
|
37
39
|
schema/message_metadata.py
|
|
38
40
|
tests/check_environment.py
|
|
41
|
+
tests/check_labeling.py
|
|
39
42
|
tests/check_management.py
|
|
40
43
|
tests/check_oss.py
|
|
41
44
|
tests/check_package.py
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"""Synchronous client for LabelingService pre-annotation RPCs."""
|
|
2
|
+
|
|
3
|
+
from typing import Optional, Sequence, Tuple, Union
|
|
4
|
+
|
|
5
|
+
import grpc
|
|
6
|
+
|
|
7
|
+
import current_data_py as _package
|
|
8
|
+
from . import DEFAULT_ADDRESS
|
|
9
|
+
from ._proto.labeling.service import service_pb2, service_pb2_grpc
|
|
10
|
+
from ._proto.labeling.task import task_pb2
|
|
11
|
+
from ._proto.management.selection.selection_pb2 import DataSelection
|
|
12
|
+
|
|
13
|
+
_CallMetadata = Optional[Sequence[Tuple[str, Union[str, bytes]]]]
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"DEFAULT_ADDRESS", "LabelingClient", "DataSelection",
|
|
17
|
+
"service_pb2", "task_pb2",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class LabelingClient:
|
|
22
|
+
"""Use TLS and current_data_py.DEFAULT_ADDRESS, or a caller-owned channel.
|
|
23
|
+
|
|
24
|
+
RPC errors propagate unchanged without retries. Call metadata carries headers
|
|
25
|
+
such as authorization; timeouts are in seconds. Server-side validation governs
|
|
26
|
+
pre-annotation results and task transitions.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
def __init__(self, channel: Optional[grpc.Channel] = None, *, address: Optional[str] = None):
|
|
30
|
+
self._owns_channel = channel is None
|
|
31
|
+
self._channel = (
|
|
32
|
+
grpc.secure_channel(
|
|
33
|
+
_package.DEFAULT_ADDRESS if address is None else address, grpc.ssl_channel_credentials(),
|
|
34
|
+
)
|
|
35
|
+
if channel is None else channel
|
|
36
|
+
)
|
|
37
|
+
self.stub = service_pb2_grpc.LabelingServiceStub(self._channel)
|
|
38
|
+
|
|
39
|
+
def close(self) -> None:
|
|
40
|
+
"""Close the channel only when this client created it."""
|
|
41
|
+
if self._owns_channel:
|
|
42
|
+
self._channel.close()
|
|
43
|
+
|
|
44
|
+
def __enter__(self) -> "LabelingClient":
|
|
45
|
+
return self
|
|
46
|
+
|
|
47
|
+
def __exit__(self, *args) -> None:
|
|
48
|
+
self.close()
|
|
49
|
+
|
|
50
|
+
def create_task(
|
|
51
|
+
self, template_id: str, *, input_sources: Optional[Sequence[task_pb2.InputSource]] = None,
|
|
52
|
+
data_selection: Optional[DataSelection] = None, name: str = "",
|
|
53
|
+
start_pre_annotation: bool = False,
|
|
54
|
+
timeout: Optional[float] = 30, metadata: _CallMetadata = None,
|
|
55
|
+
) -> service_pb2.CreateTaskResponse:
|
|
56
|
+
return self.stub.CreateTask(
|
|
57
|
+
service_pb2.CreateTaskRequest(
|
|
58
|
+
template_id=template_id, input_sources=input_sources,
|
|
59
|
+
data_selection=data_selection, name=name, start_pre_annotation=start_pre_annotation,
|
|
60
|
+
),
|
|
61
|
+
timeout=timeout, metadata=metadata,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
def list_tasks(
|
|
65
|
+
self, *,
|
|
66
|
+
timeout: Optional[float] = 30, metadata: _CallMetadata = None,
|
|
67
|
+
) -> Sequence[task_pb2.TaskSummary]:
|
|
68
|
+
return self.stub.ListTasks(
|
|
69
|
+
service_pb2.ListTasksRequest(),
|
|
70
|
+
timeout=timeout, metadata=metadata,
|
|
71
|
+
).tasks
|
|
72
|
+
|
|
73
|
+
def list_items(
|
|
74
|
+
self, task_id: str, *,
|
|
75
|
+
timeout: Optional[float] = 30, metadata: _CallMetadata = None,
|
|
76
|
+
) -> Sequence[task_pb2.Item]:
|
|
77
|
+
return self.stub.ListItems(
|
|
78
|
+
service_pb2.ListItemsRequest(task_id=task_id),
|
|
79
|
+
timeout=timeout, metadata=metadata,
|
|
80
|
+
).items
|
|
81
|
+
|
|
82
|
+
def write_result(
|
|
83
|
+
self, item_id: str, result: Optional[task_pb2.Result] = None, *,
|
|
84
|
+
pre_annotation_error: str = "",
|
|
85
|
+
timeout: Optional[float] = 30, metadata: _CallMetadata = None,
|
|
86
|
+
) -> None:
|
|
87
|
+
self.stub.WriteResult(
|
|
88
|
+
service_pb2.WriteResultRequest(
|
|
89
|
+
item_id=item_id, result=result,
|
|
90
|
+
pre_annotation_error=pre_annotation_error,
|
|
91
|
+
),
|
|
92
|
+
timeout=timeout, metadata=metadata,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
def update_pre_annotation(
|
|
96
|
+
self, task_id: str, action: int, *,
|
|
97
|
+
timeout: Optional[float] = 30, metadata: _CallMetadata = None,
|
|
98
|
+
) -> service_pb2.UpdatePreAnnotationResponse:
|
|
99
|
+
return self.stub.UpdatePreAnnotation(
|
|
100
|
+
service_pb2.UpdatePreAnnotationRequest(task_id=task_id, action=action),
|
|
101
|
+
timeout=timeout, metadata=metadata,
|
|
102
|
+
)
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: labeling/service/service.proto
|
|
4
|
+
"""Generated protocol buffer code."""
|
|
5
|
+
from google.protobuf.internal import builder as _builder
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
+
# @@protoc_insertion_point(imports)
|
|
10
|
+
|
|
11
|
+
_sym_db = _symbol_database.Default()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
|
|
15
|
+
from labeling.template import template_pb2 as labeling_dot_template_dot_template__pb2
|
|
16
|
+
from labeling.task import task_pb2 as labeling_dot_task_dot_task__pb2
|
|
17
|
+
from management.selection import selection_pb2 as management_dot_selection_dot_selection__pb2
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1elabeling/service/service.proto\x12\x13labeling.service.v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a labeling/template/template.proto\x1a\x18labeling/task/task.proto\x1a$management/selection/selection.proto\"U\n\x15\x43reateTemplateRequest\x12<\n\ndefinition\x18\x01 \x01(\x0b\x32(.labeling.template.v1.TemplateDefinition\"J\n\x16\x43reateTemplateResponse\x12\x30\n\x08template\x18\x01 \x01(\x0b\x32\x1e.labeling.template.v1.Template\"\x16\n\x14ListTemplatesRequest\"J\n\x15ListTemplatesResponse\x12\x31\n\ttemplates\x18\x01 \x03(\x0b\x32\x1e.labeling.template.v1.Template\"\xca\x01\n\x11\x43reateTaskRequest\x12\x13\n\x0btemplate_id\x18\x01 \x01(\t\x12\x34\n\rinput_sources\x18\x02 \x03(\x0b\x32\x1d.labeling.task.v1.InputSource\x12>\n\x0e\x64\x61ta_selection\x18\x03 \x01(\x0b\x32&.management.selection.v1.DataSelection\x12\x0c\n\x04name\x18\x04 \x01(\t\x12\x1c\n\x14start_pre_annotation\x18\x05 \x01(\x08\"9\n\x12\x43reateTaskResponse\x12\x12\n\nitem_count\x18\x01 \x01(\x05\x12\x0f\n\x07task_id\x18\x02 \x01(\t\"\x12\n\x10ListTasksRequest\"A\n\x11ListTasksResponse\x12,\n\x05tasks\x18\x01 \x03(\x0b\x32\x1d.labeling.task.v1.TaskSummary\"8\n\x10ListItemsRequest\x12\x0f\n\x07task_id\x18\x01 \x01(\t\x12\x13\n\x0b\x63laim_token\x18\x02 \x01(\t\":\n\x11ListItemsResponse\x12%\n\x05items\x18\x01 \x03(\x0b\x32\x16.labeling.task.v1.Item\"%\n\x12ListResultsRequest\x12\x0f\n\x07\x64\x61ta_id\x18\x01 \x01(\t\"a\n\x13LabelingResultEntry\x12$\n\x04task\x18\x01 \x01(\x0b\x32\x16.labeling.task.v1.Task\x12$\n\x04item\x18\x02 \x01(\x0b\x32\x16.labeling.task.v1.Item\"P\n\x13ListResultsResponse\x12\x39\n\x07results\x18\x01 \x03(\x0b\x32(.labeling.service.v1.LabelingResultEntry\"\x82\x01\n\x12WriteResultRequest\x12\x0f\n\x07item_id\x18\x01 \x01(\t\x12(\n\x06result\x18\x02 \x01(\x0b\x32\x18.labeling.task.v1.Result\x12\x13\n\x0b\x63laim_token\x18\x03 \x01(\t\x12\x1c\n\x14pre_annotation_error\x18\x04 \x01(\t\"\x15\n\x13WriteResultResponse\"&\n\x13\x43ompleteTaskRequest\x12\x0f\n\x07task_id\x18\x01 \x01(\t\"4\n\x14\x43ompleteTaskResponse\x12\x1c\n\x14\x63ompleted_item_count\x18\x01 \x01(\x05\"8\n\x10\x43laimItemRequest\x12\x0f\n\x07item_id\x18\x01 \x01(\t\x12\x13\n\x0b\x63laim_token\x18\x02 \x01(\t\"9\n\x11\x43laimItemResponse\x12$\n\x04item\x18\x01 \x01(\x0b\x32\x16.labeling.task.v1.Item\"9\n\x11RenewClaimRequest\x12\x0f\n\x07item_id\x18\x01 \x01(\t\x12\x13\n\x0b\x63laim_token\x18\x02 \x01(\t\"J\n\x12RenewClaimResponse\x12\x34\n\x10\x63laim_expires_at\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\";\n\x13ReleaseClaimRequest\x12\x0f\n\x07item_id\x18\x01 \x01(\t\x12\x13\n\x0b\x63laim_token\x18\x02 \x01(\t\"\x16\n\x14ReleaseClaimResponse\"\xd9\x01\n\x1aUpdatePreAnnotationRequest\x12\x0f\n\x07task_id\x18\x01 \x01(\t\x12\x46\n\x06\x61\x63tion\x18\x02 \x01(\x0e\x32\x36.labeling.service.v1.UpdatePreAnnotationRequest.Action\"b\n\x06\x41\x63tion\x12\x16\n\x12\x41\x43TION_UNSPECIFIED\x10\x00\x12\x1c\n\x18\x41\x43TION_OPEN_HUMAN_REVIEW\x10\x01\x12\"\n\x1e\x41\x43TION_ACCEPT_ALL_AND_COMPLETE\x10\x02\"K\n\x1bUpdatePreAnnotationResponse\x12,\n\x06status\x18\x01 \x01(\x0e\x32\x1c.labeling.task.v1.TaskStatus2\xbe\t\n\x0fLabelingService\x12i\n\x0e\x43reateTemplate\x12*.labeling.service.v1.CreateTemplateRequest\x1a+.labeling.service.v1.CreateTemplateResponse\x12\x66\n\rListTemplates\x12).labeling.service.v1.ListTemplatesRequest\x1a*.labeling.service.v1.ListTemplatesResponse\x12]\n\nCreateTask\x12&.labeling.service.v1.CreateTaskRequest\x1a\'.labeling.service.v1.CreateTaskResponse\x12Z\n\tListTasks\x12%.labeling.service.v1.ListTasksRequest\x1a&.labeling.service.v1.ListTasksResponse\x12Z\n\tListItems\x12%.labeling.service.v1.ListItemsRequest\x1a&.labeling.service.v1.ListItemsResponse\x12`\n\x0bListResults\x12\'.labeling.service.v1.ListResultsRequest\x1a(.labeling.service.v1.ListResultsResponse\x12`\n\x0bWriteResult\x12\'.labeling.service.v1.WriteResultRequest\x1a(.labeling.service.v1.WriteResultResponse\x12\x63\n\x0c\x43ompleteTask\x12(.labeling.service.v1.CompleteTaskRequest\x1a).labeling.service.v1.CompleteTaskResponse\x12Z\n\tClaimItem\x12%.labeling.service.v1.ClaimItemRequest\x1a&.labeling.service.v1.ClaimItemResponse\x12]\n\nRenewClaim\x12&.labeling.service.v1.RenewClaimRequest\x1a\'.labeling.service.v1.RenewClaimResponse\x12\x63\n\x0cReleaseClaim\x12(.labeling.service.v1.ReleaseClaimRequest\x1a).labeling.service.v1.ReleaseClaimResponse\x12x\n\x13UpdatePreAnnotation\x12/.labeling.service.v1.UpdatePreAnnotationRequest\x1a\x30.labeling.service.v1.UpdatePreAnnotationResponseB&Z$proto_gen/labeling/service;servicepbb\x06proto3')
|
|
21
|
+
|
|
22
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
|
|
23
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'labeling.service.service_pb2', globals())
|
|
24
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
25
|
+
|
|
26
|
+
DESCRIPTOR._options = None
|
|
27
|
+
DESCRIPTOR._serialized_options = b'Z$proto_gen/labeling/service;servicepb'
|
|
28
|
+
_CREATETEMPLATEREQUEST._serialized_start=186
|
|
29
|
+
_CREATETEMPLATEREQUEST._serialized_end=271
|
|
30
|
+
_CREATETEMPLATERESPONSE._serialized_start=273
|
|
31
|
+
_CREATETEMPLATERESPONSE._serialized_end=347
|
|
32
|
+
_LISTTEMPLATESREQUEST._serialized_start=349
|
|
33
|
+
_LISTTEMPLATESREQUEST._serialized_end=371
|
|
34
|
+
_LISTTEMPLATESRESPONSE._serialized_start=373
|
|
35
|
+
_LISTTEMPLATESRESPONSE._serialized_end=447
|
|
36
|
+
_CREATETASKREQUEST._serialized_start=450
|
|
37
|
+
_CREATETASKREQUEST._serialized_end=652
|
|
38
|
+
_CREATETASKRESPONSE._serialized_start=654
|
|
39
|
+
_CREATETASKRESPONSE._serialized_end=711
|
|
40
|
+
_LISTTASKSREQUEST._serialized_start=713
|
|
41
|
+
_LISTTASKSREQUEST._serialized_end=731
|
|
42
|
+
_LISTTASKSRESPONSE._serialized_start=733
|
|
43
|
+
_LISTTASKSRESPONSE._serialized_end=798
|
|
44
|
+
_LISTITEMSREQUEST._serialized_start=800
|
|
45
|
+
_LISTITEMSREQUEST._serialized_end=856
|
|
46
|
+
_LISTITEMSRESPONSE._serialized_start=858
|
|
47
|
+
_LISTITEMSRESPONSE._serialized_end=916
|
|
48
|
+
_LISTRESULTSREQUEST._serialized_start=918
|
|
49
|
+
_LISTRESULTSREQUEST._serialized_end=955
|
|
50
|
+
_LABELINGRESULTENTRY._serialized_start=957
|
|
51
|
+
_LABELINGRESULTENTRY._serialized_end=1054
|
|
52
|
+
_LISTRESULTSRESPONSE._serialized_start=1056
|
|
53
|
+
_LISTRESULTSRESPONSE._serialized_end=1136
|
|
54
|
+
_WRITERESULTREQUEST._serialized_start=1139
|
|
55
|
+
_WRITERESULTREQUEST._serialized_end=1269
|
|
56
|
+
_WRITERESULTRESPONSE._serialized_start=1271
|
|
57
|
+
_WRITERESULTRESPONSE._serialized_end=1292
|
|
58
|
+
_COMPLETETASKREQUEST._serialized_start=1294
|
|
59
|
+
_COMPLETETASKREQUEST._serialized_end=1332
|
|
60
|
+
_COMPLETETASKRESPONSE._serialized_start=1334
|
|
61
|
+
_COMPLETETASKRESPONSE._serialized_end=1386
|
|
62
|
+
_CLAIMITEMREQUEST._serialized_start=1388
|
|
63
|
+
_CLAIMITEMREQUEST._serialized_end=1444
|
|
64
|
+
_CLAIMITEMRESPONSE._serialized_start=1446
|
|
65
|
+
_CLAIMITEMRESPONSE._serialized_end=1503
|
|
66
|
+
_RENEWCLAIMREQUEST._serialized_start=1505
|
|
67
|
+
_RENEWCLAIMREQUEST._serialized_end=1562
|
|
68
|
+
_RENEWCLAIMRESPONSE._serialized_start=1564
|
|
69
|
+
_RENEWCLAIMRESPONSE._serialized_end=1638
|
|
70
|
+
_RELEASECLAIMREQUEST._serialized_start=1640
|
|
71
|
+
_RELEASECLAIMREQUEST._serialized_end=1699
|
|
72
|
+
_RELEASECLAIMRESPONSE._serialized_start=1701
|
|
73
|
+
_RELEASECLAIMRESPONSE._serialized_end=1723
|
|
74
|
+
_UPDATEPREANNOTATIONREQUEST._serialized_start=1726
|
|
75
|
+
_UPDATEPREANNOTATIONREQUEST._serialized_end=1943
|
|
76
|
+
_UPDATEPREANNOTATIONREQUEST_ACTION._serialized_start=1845
|
|
77
|
+
_UPDATEPREANNOTATIONREQUEST_ACTION._serialized_end=1943
|
|
78
|
+
_UPDATEPREANNOTATIONRESPONSE._serialized_start=1945
|
|
79
|
+
_UPDATEPREANNOTATIONRESPONSE._serialized_end=2020
|
|
80
|
+
_LABELINGSERVICE._serialized_start=2023
|
|
81
|
+
_LABELINGSERVICE._serialized_end=3237
|
|
82
|
+
# @@protoc_insertion_point(module_scope)
|