mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
Add support for pydantic v2 using v1 shims (#504)
This commit is contained in:
parent
0cb6f21d36
commit
53021f07fe
@ -1,5 +1,8 @@
|
|||||||
"""Cloud module implementation."""
|
"""Cloud module implementation."""
|
||||||
from pydantic import BaseModel
|
try:
|
||||||
|
from pydantic.v1 import BaseModel
|
||||||
|
except ImportError:
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from .module import Module
|
from .module import Module
|
||||||
|
|
||||||
|
@ -3,7 +3,11 @@ import logging
|
|||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
|
|
||||||
from pydantic import BaseModel
|
try:
|
||||||
|
from pydantic.v1 import BaseModel
|
||||||
|
except ImportError:
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
from .module import Module, merge
|
from .module import Module, merge
|
||||||
|
|
||||||
|
@ -4,7 +4,10 @@ import re
|
|||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any, Dict, List, NamedTuple, Optional, cast
|
from typing import Any, Dict, List, NamedTuple, Optional, cast
|
||||||
|
|
||||||
from pydantic import BaseModel, Field, root_validator
|
try:
|
||||||
|
from pydantic.v1 import BaseModel, Field, root_validator
|
||||||
|
except ImportError:
|
||||||
|
from pydantic import BaseModel, Field, root_validator
|
||||||
|
|
||||||
from .modules import Antitheft, Cloud, Countdown, Emeter, Schedule, Time, Usage
|
from .modules import Antitheft, Cloud, Countdown, Emeter, Schedule, Time, Usage
|
||||||
from .smartdevice import DeviceType, SmartDevice, SmartDeviceException, requires_update
|
from .smartdevice import DeviceType, SmartDevice, SmartDeviceException, requires_update
|
||||||
|
779
poetry.lock
generated
779
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@ kasa = "kasa.cli:cli"
|
|||||||
python = "^3.8"
|
python = "^3.8"
|
||||||
anyio = "*" # see https://github.com/python-trio/asyncclick/issues/18
|
anyio = "*" # see https://github.com/python-trio/asyncclick/issues/18
|
||||||
asyncclick = ">=8"
|
asyncclick = ">=8"
|
||||||
pydantic = "^1"
|
pydantic = ">=1"
|
||||||
|
|
||||||
# speed ups
|
# speed ups
|
||||||
orjson = { "version" = ">=3.9.1", optional = true }
|
orjson = { "version" = ">=3.9.1", optional = true }
|
||||||
|
Loading…
Reference in New Issue
Block a user