bluehive 0.1.0a15__py3-none-any.whl → 0.1.0a16__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.
bluehive/_models.py CHANGED
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import os
4
4
  import inspect
5
+ import weakref
5
6
  from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast
6
7
  from datetime import date, datetime
7
8
  from typing_extensions import (
@@ -573,6 +574,9 @@ class CachedDiscriminatorType(Protocol):
573
574
  __discriminator__: DiscriminatorDetails
574
575
 
575
576
 
577
+ DISCRIMINATOR_CACHE: weakref.WeakKeyDictionary[type, DiscriminatorDetails] = weakref.WeakKeyDictionary()
578
+
579
+
576
580
  class DiscriminatorDetails:
577
581
  field_name: str
578
582
  """The name of the discriminator field in the variant class, e.g.
@@ -615,8 +619,9 @@ class DiscriminatorDetails:
615
619
 
616
620
 
617
621
  def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, ...]) -> DiscriminatorDetails | None:
618
- if isinstance(union, CachedDiscriminatorType):
619
- return union.__discriminator__
622
+ cached = DISCRIMINATOR_CACHE.get(union)
623
+ if cached is not None:
624
+ return cached
620
625
 
621
626
  discriminator_field_name: str | None = None
622
627
 
@@ -669,7 +674,7 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
669
674
  discriminator_field=discriminator_field_name,
670
675
  discriminator_alias=discriminator_alias,
671
676
  )
672
- cast(CachedDiscriminatorType, union).__discriminator__ = details
677
+ DISCRIMINATOR_CACHE.setdefault(union, details)
673
678
  return details
674
679
 
675
680
 
bluehive/_utils/_sync.py CHANGED
@@ -1,10 +1,8 @@
1
1
  from __future__ import annotations
2
2
 
3
- import sys
4
3
  import asyncio
5
4
  import functools
6
- import contextvars
7
- from typing import Any, TypeVar, Callable, Awaitable
5
+ from typing import TypeVar, Callable, Awaitable
8
6
  from typing_extensions import ParamSpec
9
7
 
10
8
  import anyio
@@ -15,34 +13,11 @@ T_Retval = TypeVar("T_Retval")
15
13
  T_ParamSpec = ParamSpec("T_ParamSpec")
16
14
 
17
15
 
18
- if sys.version_info >= (3, 9):
19
- _asyncio_to_thread = asyncio.to_thread
20
- else:
21
- # backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread
22
- # for Python 3.8 support
23
- async def _asyncio_to_thread(
24
- func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
25
- ) -> Any:
26
- """Asynchronously run function *func* in a separate thread.
27
-
28
- Any *args and **kwargs supplied for this function are directly passed
29
- to *func*. Also, the current :class:`contextvars.Context` is propagated,
30
- allowing context variables from the main thread to be accessed in the
31
- separate thread.
32
-
33
- Returns a coroutine that can be awaited to get the eventual result of *func*.
34
- """
35
- loop = asyncio.events.get_running_loop()
36
- ctx = contextvars.copy_context()
37
- func_call = functools.partial(ctx.run, func, *args, **kwargs)
38
- return await loop.run_in_executor(None, func_call)
39
-
40
-
41
16
  async def to_thread(
42
17
  func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
43
18
  ) -> T_Retval:
44
19
  if sniffio.current_async_library() == "asyncio":
45
- return await _asyncio_to_thread(func, *args, **kwargs)
20
+ return await asyncio.to_thread(func, *args, **kwargs)
46
21
 
47
22
  return await anyio.to_thread.run_sync(
48
23
  functools.partial(func, *args, **kwargs),
@@ -53,10 +28,7 @@ async def to_thread(
53
28
  def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]:
54
29
  """
55
30
  Take a blocking function and create an async one that receives the same
56
- positional and keyword arguments. For python version 3.9 and above, it uses
57
- asyncio.to_thread to run the function in a separate thread. For python version
58
- 3.8, it uses locally defined copy of the asyncio.to_thread function which was
59
- introduced in python 3.9.
31
+ positional and keyword arguments.
60
32
 
61
33
  Usage:
62
34
 
bluehive/_utils/_utils.py CHANGED
@@ -133,7 +133,7 @@ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]:
133
133
  # Type safe methods for narrowing types with TypeVars.
134
134
  # The default narrowing for isinstance(obj, dict) is dict[unknown, unknown],
135
135
  # however this cause Pyright to rightfully report errors. As we know we don't
136
- # care about the contained types we can safely use `object` in it's place.
136
+ # care about the contained types we can safely use `object` in its place.
137
137
  #
138
138
  # There are two separate functions defined, `is_*` and `is_*_t` for different use cases.
139
139
  # `is_*` is for when you're dealing with an unknown input
bluehive/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "bluehive"
4
- __version__ = "0.1.0-alpha.15" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.16" # x-release-please-version
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bluehive
3
- Version: 0.1.0a15
3
+ Version: 0.1.0a16
4
4
  Summary: The official Python library for the bluehive API
5
5
  Project-URL: Homepage, https://github.com/bluehive-health/bluehive-sdk-python
6
6
  Project-URL: Repository, https://github.com/bluehive-health/bluehive-sdk-python
@@ -13,7 +13,6 @@ Classifier: Operating System :: Microsoft :: Windows
13
13
  Classifier: Operating System :: OS Independent
14
14
  Classifier: Operating System :: POSIX
15
15
  Classifier: Operating System :: POSIX :: Linux
16
- Classifier: Programming Language :: Python :: 3.8
17
16
  Classifier: Programming Language :: Python :: 3.9
18
17
  Classifier: Programming Language :: Python :: 3.10
19
18
  Classifier: Programming Language :: Python :: 3.11
@@ -21,7 +20,7 @@ Classifier: Programming Language :: Python :: 3.12
21
20
  Classifier: Programming Language :: Python :: 3.13
22
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
22
  Classifier: Typing :: Typed
24
- Requires-Python: >=3.8
23
+ Requires-Python: >=3.9
25
24
  Requires-Dist: anyio<5,>=3.5.0
26
25
  Requires-Dist: distro<2,>=1.7.0
27
26
  Requires-Dist: httpx<1,>=0.23.0
@@ -38,7 +37,7 @@ Description-Content-Type: text/markdown
38
37
  <!-- prettier-ignore -->
39
38
  [![PyPI version](https://img.shields.io/pypi/v/bluehive.svg?label=pypi%20(stable))](https://pypi.org/project/bluehive/)
40
39
 
41
- The BlueHive Python library provides convenient access to the BlueHive REST API from any Python 3.8+
40
+ The BlueHive Python library provides convenient access to the BlueHive REST API from any Python 3.9+
42
41
  application. The library includes type definitions for all request params and response fields,
43
42
  and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
44
43
 
@@ -403,7 +402,7 @@ print(bluehive.__version__)
403
402
 
404
403
  ## Requirements
405
404
 
406
- Python 3.8 or higher.
405
+ Python 3.9 or higher.
407
406
 
408
407
  ## Contributing
409
408
 
@@ -5,13 +5,13 @@ bluehive/_compat.py,sha256=DQBVORjFb33zch24jzkhM14msvnzY7mmSmgDLaVFUM8,6562
5
5
  bluehive/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
6
6
  bluehive/_exceptions.py,sha256=QOhLZv_tev7t7XO_pk0NoT7nzwA5VU6wtZdVWarToqo,3224
7
7
  bluehive/_files.py,sha256=KnEzGi_O756MvKyJ4fOCW_u3JhOeWPQ4RsmDvqihDQU,3545
8
- bluehive/_models.py,sha256=lKnskYPONAWDvWo8tmbbVk7HmG7UOsI0Nve0vSMmkRc,30452
8
+ bluehive/_models.py,sha256=_jpXNYoIJGzLCqeD4LcmiD4UgZKYMLg4cZ8TcWUn94I,30559
9
9
  bluehive/_qs.py,sha256=craIKyvPktJ94cvf9zn8j8ekG9dWJzhWv0ob34lIOv4,4828
10
10
  bluehive/_resource.py,sha256=MI2mGktYiePpr3PUh2uCPn1ubEsju6JkKoMupdTaqtc,1112
11
11
  bluehive/_response.py,sha256=u3wZ9ksvCqcP549TZTsozw0LNZmHf1yPVWPo1hxMNDg,28800
12
12
  bluehive/_streaming.py,sha256=ULiijxzSukAhT9t9G-1Mo2ks4iUt6kvD9NHYB8WlJwk,10157
13
13
  bluehive/_types.py,sha256=9h31eihqlGo3KevS5EpSAWg-hJWTZW4wsWCrlTkVC_4,7238
14
- bluehive/_version.py,sha256=3uN7yfthe1XPYhzKyeUZYeuZsCx5qKRq1yw7OpNHvvQ,169
14
+ bluehive/_version.py,sha256=i9ZMvfbu6h4X8CxoSlAhHuiNeQ7WnJy5726PzLHpCxA,169
15
15
  bluehive/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  bluehive/_utils/__init__.py,sha256=7fch0GT9zpNnErbciSpUNa-SjTxxjY6kxHxKMOM4AGs,2305
17
17
  bluehive/_utils/_compat.py,sha256=D8gtAvjJQrDWt9upS0XaG9Rr5l1QhiAx_I_1utT_tt0,1195
@@ -21,10 +21,10 @@ bluehive/_utils/_proxy.py,sha256=aglnj2yBTDyGX9Akk2crZHrl10oqRmceUy2Zp008XEs,197
21
21
  bluehive/_utils/_reflection.py,sha256=ZmGkIgT_PuwedyNBrrKGbxoWtkpytJNU1uU4QHnmEMU,1364
22
22
  bluehive/_utils/_resources_proxy.py,sha256=s7RcbodmBmI6jHSGhKsr1OFkzC-sNTyzLr3MK2-LUi0,599
23
23
  bluehive/_utils/_streams.py,sha256=SMC90diFFecpEg_zgDRVbdR3hSEIgVVij4taD-noMLM,289
24
- bluehive/_utils/_sync.py,sha256=TpGLrrhRNWTJtODNE6Fup3_k7zrWm1j2RlirzBwre-0,2862
24
+ bluehive/_utils/_sync.py,sha256=HBnZkkBnzxtwOZe0212C4EyoRvxhTVtTrLFDz2_xVCg,1589
25
25
  bluehive/_utils/_transform.py,sha256=NjCzmnfqYrsAikUHQig6N9QfuTVbKipuP3ur9mcNF-E,15951
26
26
  bluehive/_utils/_typing.py,sha256=N_5PPuFNsaygbtA_npZd98SVN1LQQvFTKL6bkWPBZGU,4786
27
- bluehive/_utils/_utils.py,sha256=0dDqauUbVZEXV0NVl7Bwu904Wwo5eyFCZpQThhFNhyA,12253
27
+ bluehive/_utils/_utils.py,sha256=ugfUaneOK7I8h9b3656flwf5u_kthY0gvNuqvgOLoSU,12252
28
28
  bluehive/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
29
29
  bluehive/resources/__init__.py,sha256=8WjWJ-hLJYuUYGN3CV08MHez2UhBI-wYSLVK-4c7UeI,4758
30
30
  bluehive/resources/database.py,sha256=oAbB1lZwzO-PwMyPqQgW6-h5BTHyt6apLH9vKA7Hw-g,5218
@@ -91,7 +91,7 @@ bluehive/types/employers/service_bundle_list_response.py,sha256=vnZlYv7KObJ0OSSY
91
91
  bluehive/types/employers/service_bundle_retrieve_response.py,sha256=9nwdzfgErAQFzqwivKhKCLqA9k7ZsMj4YbNig09-Eho,1030
92
92
  bluehive/types/employers/service_bundle_update_params.py,sha256=gxRnvCSsBsUqi1M91nhEXgj-2l03xlrnPeXOPAQ1ujA,812
93
93
  bluehive/types/employers/service_bundle_update_response.py,sha256=zUR_nYflDEmLSmTcFb4EaTELCInqZZI-VIBHgcPq7G4,1026
94
- bluehive-0.1.0a15.dist-info/METADATA,sha256=fQANK2hG4-P6lF-E8Gpa9G0rj8stVLYo-ieElm7LE6w,13679
95
- bluehive-0.1.0a15.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
96
- bluehive-0.1.0a15.dist-info/licenses/LICENSE,sha256=Q2LP5YQQAGzyScIIkgum9Z19KCG4jZvZHMgDQ_vOOqM,11338
97
- bluehive-0.1.0a15.dist-info/RECORD,,
94
+ bluehive-0.1.0a16.dist-info/METADATA,sha256=bDwQnW4EprZfCCeiUEqvD4L-jUdvbceEm04ZAZsEjUU,13629
95
+ bluehive-0.1.0a16.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
96
+ bluehive-0.1.0a16.dist-info/licenses/LICENSE,sha256=Q2LP5YQQAGzyScIIkgum9Z19KCG4jZvZHMgDQ_vOOqM,11338
97
+ bluehive-0.1.0a16.dist-info/RECORD,,