hubmap-search-sdk 1.0.0a3__py3-none-any.whl → 1.0.0a5__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.
@@ -409,7 +409,8 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
409
409
 
410
410
  idempotency_header = self._idempotency_header
411
411
  if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers:
412
- headers[idempotency_header] = options.idempotency_key or self._idempotency_key()
412
+ options.idempotency_key = options.idempotency_key or self._idempotency_key()
413
+ headers[idempotency_header] = options.idempotency_key
413
414
 
414
415
  # Don't set these headers if they were already set or removed by the caller. We check
415
416
  # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case.
@@ -946,6 +947,10 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
946
947
  request = self._build_request(options, retries_taken=retries_taken)
947
948
  self._prepare_request(request)
948
949
 
950
+ if options.idempotency_key:
951
+ # ensure the idempotency key is reused between requests
952
+ input_options.idempotency_key = options.idempotency_key
953
+
949
954
  kwargs: HttpxSendArgs = {}
950
955
  if self.custom_auth is not None:
951
956
  kwargs["auth"] = self.custom_auth
@@ -1487,6 +1492,10 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1487
1492
  request = self._build_request(options, retries_taken=retries_taken)
1488
1493
  await self._prepare_request(request)
1489
1494
 
1495
+ if options.idempotency_key:
1496
+ # ensure the idempotency key is reused between requests
1497
+ input_options.idempotency_key = options.idempotency_key
1498
+
1490
1499
  kwargs: HttpxSendArgs = {}
1491
1500
  if self.custom_auth is not None:
1492
1501
  kwargs["auth"] = self.custom_auth
@@ -5,13 +5,15 @@ import base64
5
5
  import pathlib
6
6
  from typing import Any, Mapping, TypeVar, cast
7
7
  from datetime import date, datetime
8
- from typing_extensions import Literal, get_args, override, get_type_hints
8
+ from typing_extensions import Literal, get_args, override, get_type_hints as _get_type_hints
9
9
 
10
10
  import anyio
11
11
  import pydantic
12
12
 
13
13
  from ._utils import (
14
14
  is_list,
15
+ is_given,
16
+ lru_cache,
15
17
  is_mapping,
16
18
  is_iterable,
17
19
  )
@@ -108,6 +110,7 @@ def transform(
108
110
  return cast(_T, transformed)
109
111
 
110
112
 
113
+ @lru_cache(maxsize=8096)
111
114
  def _get_annotated_type(type_: type) -> type | None:
112
115
  """If the given type is an `Annotated` type then it is returned, if not `None` is returned.
113
116
 
@@ -258,6 +261,11 @@ def _transform_typeddict(
258
261
  result: dict[str, object] = {}
259
262
  annotations = get_type_hints(expected_type, include_extras=True)
260
263
  for key, value in data.items():
264
+ if not is_given(value):
265
+ # we don't need to include `NotGiven` values here as they'll
266
+ # be stripped out before the request is sent anyway
267
+ continue
268
+
261
269
  type_ = annotations.get(key)
262
270
  if type_ is None:
263
271
  # we do not have a type annotation for this field, leave it as is
@@ -415,6 +423,11 @@ async def _async_transform_typeddict(
415
423
  result: dict[str, object] = {}
416
424
  annotations = get_type_hints(expected_type, include_extras=True)
417
425
  for key, value in data.items():
426
+ if not is_given(value):
427
+ # we don't need to include `NotGiven` values here as they'll
428
+ # be stripped out before the request is sent anyway
429
+ continue
430
+
418
431
  type_ = annotations.get(key)
419
432
  if type_ is None:
420
433
  # we do not have a type annotation for this field, leave it as is
@@ -422,3 +435,13 @@ async def _async_transform_typeddict(
422
435
  else:
423
436
  result[_maybe_transform_key(key, type_)] = await _async_transform_recursive(value, annotation=type_)
424
437
  return result
438
+
439
+
440
+ @lru_cache(maxsize=8096)
441
+ def get_type_hints(
442
+ obj: Any,
443
+ globalns: dict[str, Any] | None = None,
444
+ localns: Mapping[str, Any] | None = None,
445
+ include_extras: bool = False,
446
+ ) -> dict[str, Any]:
447
+ return _get_type_hints(obj, globalns=globalns, localns=localns, include_extras=include_extras)
@@ -13,6 +13,7 @@ from typing_extensions import (
13
13
  get_origin,
14
14
  )
15
15
 
16
+ from ._utils import lru_cache
16
17
  from .._types import InheritsGeneric
17
18
  from .._compat import is_union as _is_union
18
19
 
@@ -66,6 +67,7 @@ def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]:
66
67
 
67
68
 
68
69
  # Extracts T from Annotated[T, ...] or from Required[Annotated[T, ...]]
70
+ @lru_cache(maxsize=8096)
69
71
  def strip_annotated_type(typ: type) -> type:
70
72
  if is_required_type(typ) or is_annotated_type(typ):
71
73
  return strip_annotated_type(cast(type, get_args(typ)[0]))
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "hubmap_search_sdk"
4
- __version__ = "1.0.0-alpha.3" # x-release-please-version
4
+ __version__ = "1.0.0-alpha.5" # x-release-please-version
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: hubmap_search_sdk
3
- Version: 1.0.0a3
3
+ Version: 1.0.0a5
4
4
  Summary: The official Python library for the hubmap-search-sdk API
5
5
  Project-URL: Homepage, https://github.com/hubmapconsortium/search-python-sdk
6
6
  Project-URL: Repository, https://github.com/hubmapconsortium/search-python-sdk
@@ -1,5 +1,5 @@
1
1
  hubmap_search_sdk/__init__.py,sha256=eUNBFfdHquxHRjxdtY6YQ0pw-jeQuVT7fm5mtYzB8hY,2545
2
- hubmap_search_sdk/_base_client.py,sha256=k6ZlBU4noBUiaK569l3DbV0CPkHuvlnIXAbyvqUNhPc,65547
2
+ hubmap_search_sdk/_base_client.py,sha256=49nAPIRmISLm4KAZfnc6ZIL9qSR3t3M0nbzPPlpQzV0,65955
3
3
  hubmap_search_sdk/_client.py,sha256=_B5lY2StPqLRgECImsspnws_3o0WbTfeMwZvhZTLRfo,19485
4
4
  hubmap_search_sdk/_compat.py,sha256=VWemUKbj6DDkQ-O4baSpHVLJafotzeXmCQGJugfVTIw,6580
5
5
  hubmap_search_sdk/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
@@ -11,7 +11,7 @@ hubmap_search_sdk/_resource.py,sha256=z9CsPEtCJP9np1GfCrGKkqUmlGd10QdY9ZtINq4vyI
11
11
  hubmap_search_sdk/_response.py,sha256=V9jyjwgBvmdB9MqltIZFs4gLcdbj1MmLdhwS-ILkBSk,28881
12
12
  hubmap_search_sdk/_streaming.py,sha256=Anm1GDFtbRi3IL4NaaajTXDlwv75_Rm-bi6TD_0tSxU,10136
13
13
  hubmap_search_sdk/_types.py,sha256=Xxqpn7vIdO1HG3-TJaQdHFEI1etNZxdSS3QOOeakw0A,6154
14
- hubmap_search_sdk/_version.py,sha256=o2OZ_rKBPkzUU3HqaEL5ZNC_bjnnZhsSgkINHbyyzDk,177
14
+ hubmap_search_sdk/_version.py,sha256=9OC1Jzuwi9Uj8v2_o13VWq2Xjyhp1FsNBcLmAgiy4nA,177
15
15
  hubmap_search_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  hubmap_search_sdk/_utils/__init__.py,sha256=PNZ_QJuzZEgyYXqkO1HVhGkj5IU9bglVUcw7H-Knjzw,2062
17
17
  hubmap_search_sdk/_utils/_logs.py,sha256=vEolshfk2D36E9yV2JC0vIbMfBmiM-lIAw-ledyLVVI,807
@@ -19,8 +19,8 @@ hubmap_search_sdk/_utils/_proxy.py,sha256=z3zsateHtb0EARTWKk8QZNHfPkqJbqwd1lM993
19
19
  hubmap_search_sdk/_utils/_reflection.py,sha256=ZmGkIgT_PuwedyNBrrKGbxoWtkpytJNU1uU4QHnmEMU,1364
20
20
  hubmap_search_sdk/_utils/_streams.py,sha256=SMC90diFFecpEg_zgDRVbdR3hSEIgVVij4taD-noMLM,289
21
21
  hubmap_search_sdk/_utils/_sync.py,sha256=TpGLrrhRNWTJtODNE6Fup3_k7zrWm1j2RlirzBwre-0,2862
22
- hubmap_search_sdk/_utils/_transform.py,sha256=xfcRTFidCyPhQ7hXeivxpAS0x-NhTyr20iXm1cKcJYk,14857
23
- hubmap_search_sdk/_utils/_typing.py,sha256=nTJz0jcrQbEgxwy4TtAkNxuU0QHHlmc6mQtA6vIR8tg,4501
22
+ hubmap_search_sdk/_utils/_transform.py,sha256=n7kskEWz6o__aoNvhFoGVyDoalNe6mJwp-g7BWkdj88,15617
23
+ hubmap_search_sdk/_utils/_typing.py,sha256=nOFiIH5faG-h5Ha-Ky2aZxw5kmR6iX8KzNtsn3JEWoA,4556
24
24
  hubmap_search_sdk/_utils/_utils.py,sha256=8UmbPOy_AAr2uUjjFui-VZSrVBHRj6bfNEKRp5YZP2A,12004
25
25
  hubmap_search_sdk/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
26
26
  hubmap_search_sdk/resources/__init__.py,sha256=in53qeBTsjQ4j4Gy2lRL9ptQbjduHnnROAmu6IbragQ,4761
@@ -48,7 +48,7 @@ hubmap_search_sdk/types/search_execute_query_params.py,sha256=La2udYbqLYPTzIRJtt
48
48
  hubmap_search_sdk/types/update_update_document_at_index_params.py,sha256=F6bL-5xzqfI1ClajCan9M2pWhKyP2qFENNXHE1unj54,341
49
49
  hubmap_search_sdk/types/update_update_document_params.py,sha256=LM65ha6n6USOen2DqlL8R0N8APX9uAduWzqReXqJWOI,302
50
50
  hubmap_search_sdk/types/update_update_document_with_scope_params.py,sha256=3Se48DT25C8gP_yvEoYWMg0whAD9qWPWMQH1rpvg8Zc,371
51
- hubmap_search_sdk-1.0.0a3.dist-info/METADATA,sha256=OSMBvhjXuOTC8sEKg6RZtgRy6sF7L0TijaiG1ErMftE,12669
52
- hubmap_search_sdk-1.0.0a3.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
53
- hubmap_search_sdk-1.0.0a3.dist-info/licenses/LICENSE,sha256=lLxIB8m5gVPdScdg81tBYiNbRkVgIBWcmAN1yJwrOME,1057
54
- hubmap_search_sdk-1.0.0a3.dist-info/RECORD,,
51
+ hubmap_search_sdk-1.0.0a5.dist-info/METADATA,sha256=2gbO9lchkffC1D1eF6EHLxySSHpc8a_VlqkUiFt82Q8,12669
52
+ hubmap_search_sdk-1.0.0a5.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
53
+ hubmap_search_sdk-1.0.0a5.dist-info/licenses/LICENSE,sha256=lLxIB8m5gVPdScdg81tBYiNbRkVgIBWcmAN1yJwrOME,1057
54
+ hubmap_search_sdk-1.0.0a5.dist-info/RECORD,,