Skip to content

Commit c71e83d

Browse files
committed
update pydantic v2
Signed-off-by: ふぁ <[email protected]>
1 parent c4f2272 commit c71e83d

7 files changed

Lines changed: 13 additions & 16 deletions

File tree

twitter_openapi_python/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "twitter_openapi_python"
3-
version = "0.0.12"
3+
version = "0.0.13"
44
description = "Twitter OpenAPI"
55
authors = ["fa0311 <[email protected]>"]
66
license = "proprietary" # or "AGPL-3.0-only"
@@ -12,7 +12,7 @@ include = ["twitter_openapi_python/py.typed"]
1212

1313
[tool.poetry.dependencies]
1414
python = "^3.7"
15-
pydantic = "^1.10.5, <2"
15+
pydantic = ">=2.6"
1616

1717
twitter-openapi-python-generated = "0.0.7"
1818

-16 Bytes
Binary file not shown.

twitter_openapi_python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
PYTHON_REQUIRES = ">=3.7"
88
REQUIRES = [
99
"twitter_openapi_python_generated == 0.0.6",
10-
"pydantic >= 1.10.5, < 2",
10+
"pydantic >= 2.6",
1111
]
1212

1313
setup(

twitter_openapi_python/twitter_openapi_python/models/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# flake8: noqa
44

55

6-
from twitter_openapi_python.models.base import BaseModel, GenericModel
6+
from twitter_openapi_python.models.base import BaseModel
77
from twitter_openapi_python.models.header import ApiUtilsHeader
88
from twitter_openapi_python.models.initial_state import (
99
InitialStateApiUtilsRaw,
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
from pydantic import BaseModel as PydanticBaseModel
2-
from pydantic.generics import GenericModel as PydanticGenericModel
1+
from typing import TypeVar
32

3+
from pydantic import BaseModel as PydanticBaseModel
44

5-
class BaseModel(PydanticBaseModel):
6-
class Config:
7-
arbitrary_types_allowed = True
5+
T = TypeVar("T")
86

97

10-
class GenericModel(PydanticGenericModel):
11-
class Config:
12-
arbitrary_types_allowed = True
8+
class BaseModel(PydanticBaseModel):
9+
model_config = {"arbitrary_types_allowed": True}

twitter_openapi_python/twitter_openapi_python/models/response.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import twitter_openapi_python_generated as twitter
44
from pydantic import Field
55

6-
from twitter_openapi_python.models import ApiUtilsHeader, BaseModel, GenericModel
6+
from twitter_openapi_python.models import ApiUtilsHeader, BaseModel
77

88
T1 = TypeVar("T1")
99
T2 = TypeVar("T2")
@@ -13,7 +13,7 @@ class TwitterApiUtilsRaw(BaseModel):
1313
response: twitter.ApiResponse = Field()
1414

1515

16-
class TwitterApiUtilsResponse(GenericModel, Generic[T1]):
16+
class TwitterApiUtilsResponse(BaseModel, Generic[T1]):
1717
raw: TwitterApiUtilsRaw = Field()
1818
data: T1 = Field()
1919
header: ApiUtilsHeader = Field()

twitter_openapi_python/twitter_openapi_python/models/timeline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import twitter_openapi_python_generated.models as models
55
from pydantic import Field
66

7-
from twitter_openapi_python.models import BaseModel, GenericModel
7+
from twitter_openapi_python.models import BaseModel
88

99
T = TypeVar("T")
1010

@@ -34,7 +34,7 @@ class UserApiUtilsData(BaseModel):
3434
user: models.User = Field()
3535

3636

37-
class TimelineApiUtilsResponse(GenericModel, Generic[T]):
37+
class TimelineApiUtilsResponse(BaseModel, Generic[T]):
3838
raw: ApiUtilsRaw = Field()
3939
cursor: CursorApiUtilsResponse = Field()
4040
data: List[T] = Field(default_factory=list)

0 commit comments

Comments
 (0)