Skip to content

Commit

Permalink
Revert "Support pydantic v2 using v1 shims (#1816)"
Browse files Browse the repository at this point in the history
This reverts commit 2546b04.
  • Loading branch information
st7105 committed Oct 4, 2023
1 parent 081a911 commit 0801956
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 170 deletions.
6 changes: 1 addition & 5 deletions miio/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
from typing import TYPE_CHECKING, Dict, Optional

import click

try:
from pydantic.v1 import BaseModel, Field
except ImportError:
from pydantic import BaseModel, Field
from pydantic import BaseModel, Field

try:
from rich import print as echo
Expand Down
6 changes: 1 addition & 5 deletions miio/devtools/simulators/miiosimulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
from typing import List, Optional, Union

import click

try:
from pydantic.v1 import BaseModel, Field, PrivateAttr
except ImportError:
from pydantic import BaseModel, Field, PrivateAttr
from pydantic import BaseModel, Field, PrivateAttr
from yaml import safe_load

from miio import PushServer
Expand Down
5 changes: 1 addition & 4 deletions miio/devtools/simulators/miotsimulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
from typing import List, Union

import click
from pydantic import Field, validator

try:
from pydantic.v1 import Field, validator
except ImportError:
from pydantic import Field, validator
from miio import PushServer
from miio.miot_cloud import MiotCloud
from miio.miot_models import DeviceModel, MiotAccess, MiotProperty, MiotService
Expand Down
6 changes: 1 addition & 5 deletions miio/miot_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@

import appdirs
from micloud.miotspec import MiotSpec

try:
from pydantic.v1 import BaseModel, Field
except ImportError:
from pydantic import BaseModel, Field
from pydantic import BaseModel, Field

from miio import CloudException
from miio.miot_models import DeviceModel
Expand Down
5 changes: 1 addition & 4 deletions miio/miot_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
from enum import Enum
from typing import Any, Dict, List, Optional

try:
from pydantic.v1 import BaseModel, Field, PrivateAttr, root_validator
except ImportError:
from pydantic import BaseModel, Field, PrivateAttr, root_validator
from pydantic import BaseModel, Field, PrivateAttr, root_validator

from .descriptors import (
AccessFlags,
Expand Down
6 changes: 1 addition & 5 deletions miio/tests/test_miot_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
from pathlib import Path

import pytest

try:
from pydantic.v1 import BaseModel
except ImportError:
from pydantic import BaseModel
from pydantic import BaseModel

from miio.descriptors import (
AccessFlags,
Expand Down
183 changes: 42 additions & 141 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ tqdm = "^4"
micloud = { version = ">=0.6" }
croniter = ">=1"
defusedxml = "^0"
pydantic = ">=1,<3"
pydantic = "^1"
PyYAML = ">=5,<7"

# doc dependencies
Expand Down

0 comments on commit 0801956

Please sign in to comment.