vaapi 0.3.0__tar.gz → 0.3.2__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.
Files changed (50) hide show
  1. {vaapi-0.3.0 → vaapi-0.3.2}/PKG-INFO +1 -1
  2. {vaapi-0.3.0 → vaapi-0.3.2}/requirements.txt +2 -1
  3. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/__init__.py +1 -1
  4. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/cognition_representation/client.py +23 -85
  5. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/events/client.py +23 -85
  6. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/logs/client.py +13 -4
  7. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/run_tests.py +10 -9
  8. vaapi-0.3.2/vaapi/tests/event_tests.py +25 -0
  9. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/tests/logs_tests.py +1 -1
  10. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi.egg-info/PKG-INFO +1 -1
  11. vaapi-0.3.0/vaapi/tests/event_tests.py +0 -15
  12. {vaapi-0.3.0 → vaapi-0.3.2}/.gitignore +0 -0
  13. {vaapi-0.3.0 → vaapi-0.3.2}/README.md +0 -0
  14. {vaapi-0.3.0 → vaapi-0.3.2}/docgen.sh +0 -0
  15. {vaapi-0.3.0 → vaapi-0.3.2}/package_pypi.sh +0 -0
  16. {vaapi-0.3.0 → vaapi-0.3.2}/pyproject.toml +0 -0
  17. {vaapi-0.3.0 → vaapi-0.3.2}/setup.cfg +0 -0
  18. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/annotations/__init__.py +0 -0
  19. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/annotations/client.py +0 -0
  20. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/base_client.py +0 -0
  21. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/client.py +0 -0
  22. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/cognition_representation/__init__.py +0 -0
  23. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/core/api_error.py +0 -0
  24. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/core/client_wrapper.py +0 -0
  25. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/core/datetime_utils.py +0 -0
  26. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/core/file.py +0 -0
  27. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/core/http_client.py +0 -0
  28. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/core/jsonable_encoder.py +0 -0
  29. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/core/pydantic_utilities.py +0 -0
  30. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/core/query_encoder.py +0 -0
  31. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/core/remove_none_from_dict.py +0 -0
  32. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/core/request_options.py +0 -0
  33. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/events/__init__.py +0 -0
  34. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/game/__init__.py +0 -0
  35. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/game/client.py +0 -0
  36. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/logs/__init__.py +0 -0
  37. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/motion_representation/__init__.py +0 -0
  38. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/motion_representation/client.py +0 -0
  39. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/tests/cognition_repr_test.py +0 -0
  40. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/tests/game_tests.py +0 -0
  41. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/tests/motion_repr_test.py +0 -0
  42. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/types/annotation.py +0 -0
  43. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/types/cognition_representation.py +0 -0
  44. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/types/event.py +0 -0
  45. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/types/game.py +0 -0
  46. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/types/log.py +0 -0
  47. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi/types/motion_representation.py +0 -0
  48. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi.egg-info/SOURCES.txt +0 -0
  49. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi.egg-info/dependency_links.txt +0 -0
  50. {vaapi-0.3.0 → vaapi-0.3.2}/vaapi.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vaapi
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Python utils for adding logs to our Visual Analytics Tool
5
5
  Author-email: NaoTH Berlin United <nao-team@informatik.hu-berlin.de>
6
6
  License: Apache-2.0
@@ -1,4 +1,5 @@
1
1
  requests
2
2
  protobuf==3.20.3
3
3
  numpy >= 1.23.5, < 2.0.0
4
- httpx
4
+ httpx
5
+ pydantic
@@ -2,4 +2,4 @@
2
2
  you can perform with the API of the visual analytics tool by Berlin United for the Robocup SPL"""
3
3
 
4
4
 
5
- __version__ = "0.3.0"
5
+ __version__ = "0.3.2"
@@ -227,91 +227,6 @@ class CognitionRepresentationClient:
227
227
  request_options: typing.Optional[RequestOptions] = None,
228
228
  ) -> CognitionRepresentation:
229
229
  """
230
- Add annotations to a task like an annotator does.
231
-
232
- You will need to supply the task ID. You can find this in Label Studio by opening a task and checking the URL. It is also listed at the top of the labeling interface. Or you can use [Get tasks list](../tasks/list).
233
-
234
- The content of the result field depends on your labeling configuration. For example, send the following data as part of your POST
235
- request to send an empty annotation with the ID of the user who completed the task:
236
-
237
- ```json
238
- {
239
- "result": {},
240
- "was_cancelled": true,
241
- "ground_truth": true,
242
- "lead_time": 0,
243
- "task": 0
244
- "completed_by": 123
245
- }
246
- ```
247
-
248
- Parameters
249
- ----------
250
- id : int
251
- Task ID
252
-
253
- result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]]
254
- Labeling result in JSON format. Read more about the format in [the Label Studio documentation.](https://labelstud.io/guide/task_format)
255
-
256
- task : typing.Optional[int]
257
- Corresponding task for this annotation
258
-
259
- project : typing.Optional[int]
260
- Project ID for this annotation
261
-
262
- completed_by : typing.Optional[int]
263
- User ID of the person who created this annotation
264
-
265
- updated_by : typing.Optional[int]
266
- Last user who updated this annotation
267
-
268
- was_cancelled : typing.Optional[bool]
269
- User skipped the task
270
-
271
- ground_truth : typing.Optional[bool]
272
- This annotation is a Ground Truth
273
-
274
- lead_time : typing.Optional[float]
275
- How much time it took to annotate the task (in seconds)
276
-
277
- request_options : typing.Optional[RequestOptions]
278
- Request-specific configuration.
279
-
280
- Returns
281
- -------
282
- Annotation
283
- Created annotation
284
-
285
- Examples
286
- --------
287
- from label_studio_sdk.client import LabelStudio
288
-
289
- client = LabelStudio(
290
- api_key="YOUR_API_KEY",
291
- )
292
- client.annotations.create(
293
- id=1,
294
- result=[
295
- {
296
- "original_width": 1920,
297
- "original_height": 1080,
298
- "image_rotation": 0,
299
- "from_name": "bboxes",
300
- "to_name": "image",
301
- "type": "rectanglelabels",
302
- "value": {
303
- "x": 20,
304
- "y": 30,
305
- "width": 50,
306
- "height": 60,
307
- "rotation": 0,
308
- "values": {"rectanglelabels": ["Person"]},
309
- },
310
- }
311
- ],
312
- was_cancelled=False,
313
- ground_truth=True,
314
- )
315
230
  """
316
231
  _response = self._client_wrapper.httpx_client.request(
317
232
  f"api/cognitionrepr/",
@@ -332,3 +247,26 @@ class CognitionRepresentationClient:
332
247
  except JSONDecodeError:
333
248
  raise ApiError(status_code=_response.status_code, body=_response.text)
334
249
  raise ApiError(status_code=_response.status_code, body=_response_json)
250
+
251
+ def bulk_create(
252
+ self,
253
+ *,
254
+ repr_list: typing.List[CognitionRepresentation] = OMIT,
255
+ request_options: typing.Optional[RequestOptions] = None,
256
+ ) -> CognitionRepresentation:
257
+ """
258
+ """
259
+ _response = self._client_wrapper.httpx_client.request(
260
+ f"api/cognitionrepr/",
261
+ method="POST",
262
+ json=repr_list,
263
+ request_options=request_options,
264
+ omit=OMIT,
265
+ )
266
+ try:
267
+ if 200 <= _response.status_code < 300:
268
+ return pydantic_v1.parse_obj_as(CognitionRepresentation, _response.json()) # type: ignore
269
+ _response_json = _response.json()
270
+ except JSONDecodeError:
271
+ raise ApiError(status_code=_response.status_code, body=_response.text)
272
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -233,91 +233,6 @@ class EventsClient:
233
233
  request_options: typing.Optional[RequestOptions] = None,
234
234
  ) -> Event:
235
235
  """
236
- Add annotations to a task like an annotator does.
237
-
238
- You will need to supply the task ID. You can find this in Label Studio by opening a task and checking the URL. It is also listed at the top of the labeling interface. Or you can use [Get tasks list](../tasks/list).
239
-
240
- The content of the result field depends on your labeling configuration. For example, send the following data as part of your POST
241
- request to send an empty annotation with the ID of the user who completed the task:
242
-
243
- ```json
244
- {
245
- "result": {},
246
- "was_cancelled": true,
247
- "ground_truth": true,
248
- "lead_time": 0,
249
- "task": 0
250
- "completed_by": 123
251
- }
252
- ```
253
-
254
- Parameters
255
- ----------
256
- id : int
257
- Task ID
258
-
259
- result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]]
260
- Labeling result in JSON format. Read more about the format in [the Label Studio documentation.](https://labelstud.io/guide/task_format)
261
-
262
- task : typing.Optional[int]
263
- Corresponding task for this annotation
264
-
265
- project : typing.Optional[int]
266
- Project ID for this annotation
267
-
268
- completed_by : typing.Optional[int]
269
- User ID of the person who created this annotation
270
-
271
- updated_by : typing.Optional[int]
272
- Last user who updated this annotation
273
-
274
- was_cancelled : typing.Optional[bool]
275
- User skipped the task
276
-
277
- ground_truth : typing.Optional[bool]
278
- This annotation is a Ground Truth
279
-
280
- lead_time : typing.Optional[float]
281
- How much time it took to annotate the task (in seconds)
282
-
283
- request_options : typing.Optional[RequestOptions]
284
- Request-specific configuration.
285
-
286
- Returns
287
- -------
288
- Annotation
289
- Created annotation
290
-
291
- Examples
292
- --------
293
- from label_studio_sdk.client import LabelStudio
294
-
295
- client = LabelStudio(
296
- api_key="YOUR_API_KEY",
297
- )
298
- client.annotations.create(
299
- id=1,
300
- result=[
301
- {
302
- "original_width": 1920,
303
- "original_height": 1080,
304
- "image_rotation": 0,
305
- "from_name": "bboxes",
306
- "to_name": "image",
307
- "type": "rectanglelabels",
308
- "value": {
309
- "x": 20,
310
- "y": 30,
311
- "width": 50,
312
- "height": 60,
313
- "rotation": 0,
314
- "values": {"rectanglelabels": ["Person"]},
315
- },
316
- }
317
- ],
318
- was_cancelled=False,
319
- ground_truth=True,
320
- )
321
236
  """
322
237
  _response = self._client_wrapper.httpx_client.request(
323
238
  f"api/events/",
@@ -340,3 +255,26 @@ class EventsClient:
340
255
  except JSONDecodeError:
341
256
  raise ApiError(status_code=_response.status_code, body=_response.text)
342
257
  raise ApiError(status_code=_response.status_code, body=_response_json)
258
+
259
+ def bulk_create(
260
+ self,
261
+ *,
262
+ event_list: typing.List[Event] = OMIT,
263
+ request_options: typing.Optional[RequestOptions] = None,
264
+ ) -> Event:
265
+ """
266
+ """
267
+ _response = self._client_wrapper.httpx_client.request(
268
+ f"api/events/",
269
+ method="POST",
270
+ json=event_list,
271
+ request_options=request_options,
272
+ omit=OMIT,
273
+ )
274
+ try:
275
+ if 200 <= _response.status_code < 300:
276
+ return pydantic_v1.parse_obj_as(Event, _response.json()) # type: ignore
277
+ _response_json = _response.json()
278
+ except JSONDecodeError:
279
+ raise ApiError(status_code=_response.status_code, body=_response.text)
280
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -194,7 +194,11 @@ class LogClient:
194
194
  raise ApiError(status_code=_response.status_code, body=_response.text)
195
195
  raise ApiError(status_code=_response.status_code, body=_response_json)
196
196
 
197
- def list(self, game_id: int, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Log]:
197
+ def list(
198
+ self,
199
+ *,
200
+ game_id: typing.Optional[int] = None,
201
+ request_options: typing.Optional[RequestOptions] = None) -> typing.List[Log]:
198
202
  """
199
203
  List all logs.
200
204
 
@@ -224,9 +228,14 @@ class LogClient:
224
228
  id=1,
225
229
  )
226
230
  """
227
- _response = self._client_wrapper.httpx_client.request(
228
- f"api/logs/?game={jsonable_encoder(game_id)}", method="GET", request_options=request_options
229
- )
231
+ if game_id:
232
+ _response = self._client_wrapper.httpx_client.request(
233
+ f"api/logs/?game={jsonable_encoder(game_id)}", method="GET", request_options=request_options
234
+ )
235
+ else:
236
+ _response = self._client_wrapper.httpx_client.request(
237
+ f"api/logs/", method="GET", request_options=request_options
238
+ )
230
239
  try:
231
240
  if 200 <= _response.status_code < 300:
232
241
  return pydantic_v1.parse_obj_as(typing.List[Log], _response.json()) # type: ignore
@@ -1,4 +1,5 @@
1
1
  from vaapi.client import Vaapi
2
+ import os
2
3
  from tests.event_tests import basic_event_tests
3
4
  from tests.game_tests import basic_game_tests
4
5
  from tests.logs_tests import basic_log_tests
@@ -10,18 +11,18 @@ if __name__ == "__main__":
10
11
  client = Vaapi(
11
12
  base_url='http://127.0.0.1:8000/',
12
13
  #FIXME use env var here
13
- api_key="84c6f4b516cc9d292f1b0eba26ea88e99812fbb9",
14
+ api_key=os.environ.get("VAT_API_TOKEN"),
14
15
  )
15
- a = client.annotations.get(id=1)
16
- print(a)
16
+ #a = client.annotations.get(id=1)
17
+ #print(a)
17
18
 
18
- #basic_event_tests(client)
19
- #print()
20
- #basic_game_tests(client)
19
+ basic_event_tests(client)
21
20
  print()
21
+ #basic_game_tests(client)
22
+ #print()
22
23
  #basic_log_tests(client)
23
- print()
24
+ #print()
24
25
  #basic_cognition_repr_tests(client)
25
26
 
26
- print()
27
- basic_motion_repr_tests(client)
27
+ #print()
28
+ #basic_motion_repr_tests(client)
@@ -0,0 +1,25 @@
1
+ def basic_event_tests(client):
2
+ #a = client.events.create(name="test_event")
3
+ #print(a)
4
+
5
+ event1 = {
6
+ "name": "event1",
7
+ }
8
+ event2 = {
9
+ "name": "event2",
10
+ }
11
+ event_list = [event1, event2]
12
+ a = client.events.bulk_create(event_list=event_list)
13
+ print(a)
14
+
15
+ #b = client.events.get(id=a.id)
16
+ #print(b)
17
+
18
+ #c = client.events.list()
19
+ #print(c)
20
+
21
+ #d = client.events.update(a.id, name="test_event_renamed")
22
+ #print(d)
23
+
24
+ #e = client.events.delete(a.id)
25
+ #print(e)
@@ -8,7 +8,7 @@ def basic_log_tests(client):
8
8
 
9
9
  c = client.logs.list(game_id=2)
10
10
  print()
11
- print(c)
11
+ print(len(c))
12
12
 
13
13
  d = client.logs.update(id=a.id, player_number=13)
14
14
  print()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vaapi
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Python utils for adding logs to our Visual Analytics Tool
5
5
  Author-email: NaoTH Berlin United <nao-team@informatik.hu-berlin.de>
6
6
  License: Apache-2.0
@@ -1,15 +0,0 @@
1
- def basic_event_tests(client):
2
- a = client.events.create(name="test_event")
3
- print(a)
4
-
5
- b = client.events.get(id=a.id)
6
- print(b)
7
-
8
- c = client.events.list()
9
- print(c)
10
-
11
- d = client.events.update(a.id, name="test_event_renamed")
12
- print(d)
13
-
14
- e = client.events.delete(a.id)
15
- print(e)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes