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,4 +1,7 @@
|
||||
"""Cloud module implementation."""
|
||||
try:
|
||||
from pydantic.v1 import BaseModel
|
||||
except ImportError:
|
||||
from pydantic import BaseModel
|
||||
|
||||
from .module import Module
|
||||
|
@ -3,8 +3,12 @@ import logging
|
||||
from enum import Enum
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
try:
|
||||
from pydantic.v1 import BaseModel
|
||||
except ImportError:
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
from .module import Module, merge
|
||||
|
||||
|
||||
|
@ -4,6 +4,9 @@ import re
|
||||
from enum import Enum
|
||||
from typing import Any, Dict, List, NamedTuple, Optional, cast
|
||||
|
||||
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
|
||||
|
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"
|
||||
anyio = "*" # see https://github.com/python-trio/asyncclick/issues/18
|
||||
asyncclick = ">=8"
|
||||
pydantic = "^1"
|
||||
pydantic = ">=1"
|
||||
|
||||
# speed ups
|
||||
orjson = { "version" = ">=3.9.1", optional = true }
|
||||
|
Loading…
Reference in New Issue
Block a user