mirror of
https://github.com/anomalyco/opencode-sdk-python.git
synced 2026-05-17 04:12:43 +00:00
feat: improve future compat with pydantic v3
This commit is contained in:
parent
86dbdbc8ee
commit
9350797779
13 changed files with 437 additions and 137 deletions
|
|
@ -59,7 +59,7 @@ from ._types import (
|
|||
ModelBuilderProtocol,
|
||||
)
|
||||
from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping
|
||||
from ._compat import PYDANTIC_V2, model_copy, model_dump
|
||||
from ._compat import PYDANTIC_V1, model_copy, model_dump
|
||||
from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type
|
||||
from ._response import (
|
||||
APIResponse,
|
||||
|
|
@ -232,7 +232,7 @@ class BaseSyncPage(BasePage[_T], Generic[_T]):
|
|||
model: Type[_T],
|
||||
options: FinalRequestOptions,
|
||||
) -> None:
|
||||
if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
|
||||
if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None:
|
||||
self.__pydantic_private__ = {}
|
||||
|
||||
self._model = model
|
||||
|
|
@ -320,7 +320,7 @@ class BaseAsyncPage(BasePage[_T], Generic[_T]):
|
|||
client: AsyncAPIClient,
|
||||
options: FinalRequestOptions,
|
||||
) -> None:
|
||||
if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
|
||||
if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None:
|
||||
self.__pydantic_private__ = {}
|
||||
|
||||
self._model = model
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue