vaapi 0.7.46__tar.gz → 0.7.47__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.
- {vaapi-0.7.46 → vaapi-0.7.47}/PKG-INFO +1 -1
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/__init__.py +1 -1
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/core/pagination.py +0 -1
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/image/client.py +31 -9
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/image.py +2 -3
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi.egg-info/PKG-INFO +1 -1
- {vaapi-0.7.46 → vaapi-0.7.47}/README.md +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/pyproject.toml +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/setup.cfg +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/base_client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/behavior_frame_option/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/behavior_frame_option/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/behavior_options/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/behavior_options/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/behavior_options_state/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/behavior_options_state/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/cognition_frame/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/cognition_frame/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/cognition_representation/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/cognition_representation/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/core/api_error.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/core/client_wrapper.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/core/datetime_utils.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/core/file.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/core/http_client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/core/jsonable_encoder.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/core/pydantic_utilities.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/core/query_encoder.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/core/remove_none_from_dict.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/core/request_options.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/events/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/events/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/experiment/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/experiment/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/game/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/game/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/image/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/log_status/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/log_status/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/logs/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/logs/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/motion_frame/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/motion_frame/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/motion_representation/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/motion_representation/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/robots/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/robots/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/teams/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/teams/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/timeline/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/timeline/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/annotation.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/behavior_option.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/behavior_option_state.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/behaviorframe_options.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/cognition_frame.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/cognition_representation.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/event.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/experiment.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/frame_filter.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/game.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/log.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/log_status.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/motion_frame.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/motion_representation.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/robots.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/teams.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/timeline.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/video.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/xabsl_symbol_complete.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/types/xabsl_symbol_sparse.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/videos/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/videos/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/xabsl_symbol_complete/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/xabsl_symbol_complete/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/xabsl_symbol_sparse/__init__.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi/xabsl_symbol_sparse/client.py +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi.egg-info/SOURCES.txt +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi.egg-info/dependency_links.txt +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi.egg-info/requires.txt +0 -0
- {vaapi-0.7.46 → vaapi-0.7.47}/vaapi.egg-info/top_level.txt +0 -0
|
@@ -5,7 +5,6 @@ from ..core.pydantic_utilities import pydantic_v1
|
|
|
5
5
|
T = typing.TypeVar("T")
|
|
6
6
|
|
|
7
7
|
class SyncPage(pydantic_v1.BaseModel, typing.Generic[T]):
|
|
8
|
-
count : int
|
|
9
8
|
has_next: bool
|
|
10
9
|
items: typing.Optional[typing.List[T]]
|
|
11
10
|
get_next: typing.Optional[typing.Callable[[], typing.Optional[Self]]]
|
|
@@ -7,7 +7,8 @@ from ..core.jsonable_encoder import jsonable_encoder
|
|
|
7
7
|
from ..core.pydantic_utilities import pydantic_v1
|
|
8
8
|
from ..core.request_options import RequestOptions
|
|
9
9
|
from ..core.pagination import SyncPager
|
|
10
|
-
from ..types.image import Image,
|
|
10
|
+
from ..types.image import Image, ImagePagination
|
|
11
|
+
import urllib.parse
|
|
11
12
|
# this is used as the default value for optional parameters
|
|
12
13
|
OMIT = typing.cast(typing.Any, ...)
|
|
13
14
|
|
|
@@ -149,7 +150,7 @@ class ImageClient:
|
|
|
149
150
|
payload = OMIT
|
|
150
151
|
|
|
151
152
|
_response = self._client_wrapper.httpx_client.request(
|
|
152
|
-
"api/images/bulk-update",
|
|
153
|
+
"api/images/bulk-update/",
|
|
153
154
|
method="PATCH",
|
|
154
155
|
json=payload,
|
|
155
156
|
request_options=request_options,
|
|
@@ -165,8 +166,8 @@ class ImageClient:
|
|
|
165
166
|
|
|
166
167
|
def list(
|
|
167
168
|
self,
|
|
168
|
-
offset: typing.Optional[int] = None,
|
|
169
169
|
limit: typing.Optional[int] = None,
|
|
170
|
+
cursor: typing.Optional[str] = None,
|
|
170
171
|
request_options: typing.Optional[RequestOptions] = None,
|
|
171
172
|
**filters: typing.Any,
|
|
172
173
|
) -> SyncPager[Image]:
|
|
@@ -180,11 +181,17 @@ class ImageClient:
|
|
|
180
181
|
api_key="YOUR_API_KEY",
|
|
181
182
|
)
|
|
182
183
|
"""
|
|
183
|
-
|
|
184
|
+
# 1. Safely pull cursor/offset out of filters if they were passed inside kwargs
|
|
185
|
+
cursor = cursor or filters.pop('cursor', None)
|
|
184
186
|
limit = limit if limit is not None else 100
|
|
187
|
+
|
|
188
|
+
# 2. Build our query params safely
|
|
185
189
|
query_params = {k: v for k, v in filters.items()}
|
|
186
190
|
query_params['limit'] = limit
|
|
187
|
-
|
|
191
|
+
|
|
192
|
+
if cursor is not None:
|
|
193
|
+
query_params['cursor'] = cursor
|
|
194
|
+
|
|
188
195
|
_response = self._client_wrapper.httpx_client.request(
|
|
189
196
|
"api/images/",
|
|
190
197
|
method="GET",
|
|
@@ -193,22 +200,37 @@ class ImageClient:
|
|
|
193
200
|
)
|
|
194
201
|
try:
|
|
195
202
|
if 200 <= _response.status_code < 300:
|
|
196
|
-
_parsed_response = pydantic_v1.parse_obj_as(
|
|
203
|
+
_parsed_response = pydantic_v1.parse_obj_as(ImagePagination, _response.json())
|
|
197
204
|
|
|
198
|
-
_has_next = _parsed_response.next
|
|
205
|
+
_has_next = _parsed_response.next is not None
|
|
206
|
+
|
|
207
|
+
# 3. Extract the next cursor from the URL provided by Django
|
|
208
|
+
next_cursor = None
|
|
209
|
+
if _has_next and _parsed_response.next:
|
|
210
|
+
parsed_url = urllib.parse.urlparse(_parsed_response.next)
|
|
211
|
+
url_params = urllib.parse.parse_qs(parsed_url.query)
|
|
212
|
+
next_cursor = url_params.get('cursor', [None])[0]
|
|
199
213
|
|
|
214
|
+
# 4. Pass the cursor to the lambda instead of modifying the offset
|
|
200
215
|
_get_next = lambda: self.list(
|
|
201
|
-
offset=offset + limit, # Increase offset by limit to get the next page
|
|
202
216
|
limit=limit,
|
|
217
|
+
cursor=next_cursor, # Subsequest requests go blazing fast via cursor
|
|
203
218
|
request_options=request_options,
|
|
204
219
|
**filters
|
|
205
220
|
) if _has_next else None
|
|
206
221
|
|
|
207
222
|
_items = _parsed_response.results
|
|
208
|
-
|
|
223
|
+
|
|
224
|
+
return SyncPager(
|
|
225
|
+
has_next=_has_next,
|
|
226
|
+
items=_items,
|
|
227
|
+
get_next=_get_next,
|
|
228
|
+
)
|
|
229
|
+
|
|
209
230
|
_response_json = _response.json()
|
|
210
231
|
except JSONDecodeError:
|
|
211
232
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
233
|
+
|
|
212
234
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
213
235
|
|
|
214
236
|
def create(
|
|
@@ -97,12 +97,11 @@ class Image(pydantic_v1.BaseModel):
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
|
|
100
|
-
class
|
|
100
|
+
class ImagePagination(pydantic_v1.BaseModel):
|
|
101
101
|
"""
|
|
102
|
-
|
|
102
|
+
Cursor paginated response for tasks
|
|
103
103
|
"""
|
|
104
104
|
results: typing.List[Image]
|
|
105
|
-
count: int
|
|
106
105
|
next: typing.Any
|
|
107
106
|
previous: typing.Any
|
|
108
107
|
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|