Skip to content

Commit

Permalink
Support for pydantic v2 using v1 shims
Browse files Browse the repository at this point in the history
  • Loading branch information
dext0r committed Nov 19, 2024
1 parent 906a4dd commit b9d0766
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion custom_components/yandex_smart_home/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from homeassistant.helpers.aiohttp_client import SERVER_SOFTWARE, async_create_clientsession, async_get_clientsession
from homeassistant.helpers.event import async_call_later
from homeassistant.util import dt
from pydantic import BaseModel
from pydantic.v1 import BaseModel

from . import handlers
from .const import CLOUD_BASE_URL, DOMAIN, ISSUE_ID_RECONNECTING_TOO_FAST
Expand Down
2 changes: 1 addition & 1 deletion custom_components/yandex_smart_home/cloud_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from homeassistant.helpers.event import async_call_later
from homeassistant.helpers.http import KEY_HASS
from multidict import MultiDictProxy
from pydantic import BaseModel
from pydantic.v1 import BaseModel
import yarl

from .const import CLOUD_STREAM_BASE_URL
Expand Down
2 changes: 1 addition & 1 deletion custom_components/yandex_smart_home/notifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
async_track_template_result,
)
from homeassistant.helpers.template import Template
from pydantic import ValidationError
from pydantic.v1 import ValidationError

from . import DOMAIN
from .capability import Capability
Expand Down
4 changes: 2 additions & 2 deletions custom_components/yandex_smart_home/schema/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from typing import Any

from pydantic import BaseModel
from pydantic.generics import GenericModel
from pydantic.v1 import BaseModel
from pydantic.v1.generics import GenericModel


class APIModel(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/yandex_smart_home/schema/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from enum import StrEnum
import time

from pydantic import Field
from pydantic.v1 import Field

from .base import APIModel
from .device import DeviceState
Expand Down
2 changes: 1 addition & 1 deletion custom_components/yandex_smart_home/schema/capability.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from enum import StrEnum
from typing import Annotated, Any, Literal, TypeVar, Union

from pydantic import Field
from pydantic.v1 import Field

from .base import APIModel
from .capability_color import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from enum import StrEnum
from typing import Annotated, Any, Literal, Self, Union

from pydantic import Field, root_validator
from pydantic.v1 import Field, root_validator

from .base import APIModel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from enum import StrEnum
from typing import Any

from pydantic import root_validator, validator
from pydantic.v1 import root_validator, validator

from .base import APIModel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from enum import StrEnum
from typing import Any, Generic, Literal, TypeVar

from pydantic import validator
from pydantic.v1 import validator

from .base import GenericAPIModel

Expand Down

0 comments on commit b9d0766

Please sign in to comment.