aiinbx 0.7.0__tar.gz → 0.7.1__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.
Potentially problematic release.
This version of aiinbx might be problematic. Click here for more details.
- aiinbx-0.7.1/.release-please-manifest.json +3 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/CHANGELOG.md +13 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/PKG-INFO +4 -5
- {aiinbx-0.7.0 → aiinbx-0.7.1}/README.md +2 -2
- {aiinbx-0.7.0 → aiinbx-0.7.1}/pyproject.toml +3 -4
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_models.py +8 -3
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_utils/_sync.py +3 -31
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_version.py +1 -1
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/test_models.py +4 -4
- aiinbx-0.7.0/.release-please-manifest.json +0 -3
- {aiinbx-0.7.0 → aiinbx-0.7.1}/.gitignore +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/CONTRIBUTING.md +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/LICENSE +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/SECURITY.md +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/api.md +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/bin/check-release-environment +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/bin/publish-pypi +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/examples/.keep +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/noxfile.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/release-please-config.json +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/requirements-dev.lock +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/requirements.lock +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/ai_inbx/lib/.keep +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/__init__.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_base_client.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_client.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_compat.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_constants.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_exceptions.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_files.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_qs.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_resource.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_response.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_streaming.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_types.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_utils/__init__.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_utils/_compat.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_utils/_datetime_parse.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_utils/_logs.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_utils/_proxy.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_utils/_reflection.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_utils/_resources_proxy.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_utils/_streams.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_utils/_transform.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_utils/_typing.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/_utils/_utils.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/lib/.keep +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/py.typed +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/resources/__init__.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/resources/domains.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/resources/emails.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/resources/meta.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/resources/threads.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/resources/webhooks.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/__init__.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/domain_create_params.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/domain_create_response.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/domain_delete_response.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/domain_list_response.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/domain_retrieve_response.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/domain_verify_response.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/email_reply_params.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/email_reply_response.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/email_retrieve_response.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/email_send_params.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/email_send_response.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/inbound_email_received_webhook_event.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/meta_webhooks_schema_response.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/outbound_email_bounced_webhook_event.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/outbound_email_clicked_webhook_event.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/outbound_email_complained_webhook_event.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/outbound_email_delivered_webhook_event.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/outbound_email_opened_webhook_event.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/outbound_email_rejected_webhook_event.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/thread_forward_params.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/thread_forward_response.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/thread_retrieve_response.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/thread_search_params.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/thread_search_response.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/src/aiinbx/types/unwrap_webhook_event.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/__init__.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/api_resources/__init__.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/api_resources/test_domains.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/api_resources/test_emails.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/api_resources/test_meta.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/api_resources/test_threads.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/api_resources/test_webhooks.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/conftest.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/sample_file.txt +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/test_client.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/test_deepcopy.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/test_extract_files.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/test_files.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/test_qs.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/test_required_args.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/test_response.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/test_streaming.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/test_transform.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/test_utils/test_datetime_parse.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/test_utils/test_proxy.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/test_utils/test_typing.py +0 -0
- {aiinbx-0.7.0 → aiinbx-0.7.1}/tests/utils.py +0 -0
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.1 (2025-11-11)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.7.0...v0.7.1](https://github.com/aiinbx/aiinbx-py/compare/v0.7.0...v0.7.1)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* compat with Python 3.14 ([17da3dd](https://github.com/aiinbx/aiinbx-py/commit/17da3dd00711f92f515ab05562b79eb784d0ce24))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Chores
|
|
13
|
+
|
|
14
|
+
* **internal:** codegen related update ([2976852](https://github.com/aiinbx/aiinbx-py/commit/2976852cdedba8ffdaed6879fd51d87708419503))
|
|
15
|
+
|
|
3
16
|
## 0.7.0 (2025-11-04)
|
|
4
17
|
|
|
5
18
|
Full Changelog: [v0.6.0...v0.7.0](https://github.com/aiinbx/aiinbx-py/compare/v0.6.0...v0.7.0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: aiinbx
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.1
|
|
4
4
|
Summary: The official Python library for the AIInbx API
|
|
5
5
|
Project-URL: Homepage, https://github.com/aiinbx/aiinbx-py
|
|
6
6
|
Project-URL: Repository, https://github.com/aiinbx/aiinbx-py
|
|
@@ -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.
|
|
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
|
[)](https://pypi.org/project/aiinbx/)
|
|
40
39
|
|
|
41
|
-
The AI Inbx Python library provides convenient access to the AI Inbx REST API from any Python 3.
|
|
40
|
+
The AI Inbx Python library provides convenient access to the AI Inbx 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
|
|
|
@@ -391,7 +390,7 @@ print(aiinbx.__version__)
|
|
|
391
390
|
|
|
392
391
|
## Requirements
|
|
393
392
|
|
|
394
|
-
Python 3.
|
|
393
|
+
Python 3.9 or higher.
|
|
395
394
|
|
|
396
395
|
## Contributing
|
|
397
396
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<!-- prettier-ignore -->
|
|
4
4
|
[)](https://pypi.org/project/aiinbx/)
|
|
5
5
|
|
|
6
|
-
The AI Inbx Python library provides convenient access to the AI Inbx REST API from any Python 3.
|
|
6
|
+
The AI Inbx Python library provides convenient access to the AI Inbx REST API from any Python 3.9+
|
|
7
7
|
application. The library includes type definitions for all request params and response fields,
|
|
8
8
|
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
|
|
9
9
|
|
|
@@ -356,7 +356,7 @@ print(aiinbx.__version__)
|
|
|
356
356
|
|
|
357
357
|
## Requirements
|
|
358
358
|
|
|
359
|
-
Python 3.
|
|
359
|
+
Python 3.9 or higher.
|
|
360
360
|
|
|
361
361
|
## Contributing
|
|
362
362
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "aiinbx"
|
|
3
|
-
version = "0.7.
|
|
3
|
+
version = "0.7.1"
|
|
4
4
|
description = "The official Python library for the AIInbx API"
|
|
5
5
|
dynamic = ["readme"]
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -15,11 +15,10 @@ dependencies = [
|
|
|
15
15
|
"distro>=1.7.0, <2",
|
|
16
16
|
"sniffio",
|
|
17
17
|
]
|
|
18
|
-
requires-python = ">= 3.
|
|
18
|
+
requires-python = ">= 3.9"
|
|
19
19
|
classifiers = [
|
|
20
20
|
"Typing :: Typed",
|
|
21
21
|
"Intended Audience :: Developers",
|
|
22
|
-
"Programming Language :: Python :: 3.8",
|
|
23
22
|
"Programming Language :: Python :: 3.9",
|
|
24
23
|
"Programming Language :: Python :: 3.10",
|
|
25
24
|
"Programming Language :: Python :: 3.11",
|
|
@@ -141,7 +140,7 @@ filterwarnings = [
|
|
|
141
140
|
# there are a couple of flags that are still disabled by
|
|
142
141
|
# default in strict mode as they are experimental and niche.
|
|
143
142
|
typeCheckingMode = "strict"
|
|
144
|
-
pythonVersion = "3.
|
|
143
|
+
pythonVersion = "3.9"
|
|
145
144
|
|
|
146
145
|
exclude = [
|
|
147
146
|
"_dev",
|
|
@@ -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
|
-
|
|
619
|
-
|
|
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
|
-
|
|
677
|
+
DISCRIMINATOR_CACHE.setdefault(union, details)
|
|
673
678
|
return details
|
|
674
679
|
|
|
675
680
|
|
|
@@ -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
|
|
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
|
|
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.
|
|
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
|
|
|
@@ -9,7 +9,7 @@ from pydantic import Field
|
|
|
9
9
|
|
|
10
10
|
from aiinbx._utils import PropertyInfo
|
|
11
11
|
from aiinbx._compat import PYDANTIC_V1, parse_obj, model_dump, model_json
|
|
12
|
-
from aiinbx._models import BaseModel, construct_type
|
|
12
|
+
from aiinbx._models import DISCRIMINATOR_CACHE, BaseModel, construct_type
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class BasicModel(BaseModel):
|
|
@@ -809,7 +809,7 @@ def test_discriminated_unions_invalid_data_uses_cache() -> None:
|
|
|
809
809
|
|
|
810
810
|
UnionType = cast(Any, Union[A, B])
|
|
811
811
|
|
|
812
|
-
assert not
|
|
812
|
+
assert not DISCRIMINATOR_CACHE.get(UnionType)
|
|
813
813
|
|
|
814
814
|
m = construct_type(
|
|
815
815
|
value={"type": "b", "data": "foo"}, type_=cast(Any, Annotated[UnionType, PropertyInfo(discriminator="type")])
|
|
@@ -818,7 +818,7 @@ def test_discriminated_unions_invalid_data_uses_cache() -> None:
|
|
|
818
818
|
assert m.type == "b"
|
|
819
819
|
assert m.data == "foo" # type: ignore[comparison-overlap]
|
|
820
820
|
|
|
821
|
-
discriminator = UnionType
|
|
821
|
+
discriminator = DISCRIMINATOR_CACHE.get(UnionType)
|
|
822
822
|
assert discriminator is not None
|
|
823
823
|
|
|
824
824
|
m = construct_type(
|
|
@@ -830,7 +830,7 @@ def test_discriminated_unions_invalid_data_uses_cache() -> None:
|
|
|
830
830
|
|
|
831
831
|
# if the discriminator details object stays the same between invocations then
|
|
832
832
|
# we hit the cache
|
|
833
|
-
assert UnionType
|
|
833
|
+
assert DISCRIMINATOR_CACHE.get(UnionType) is discriminator
|
|
834
834
|
|
|
835
835
|
|
|
836
836
|
@pytest.mark.skipif(PYDANTIC_V1, reason="TypeAliasType is not supported in Pydantic v1")
|
|
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
|
|
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
|