Skip to content

Commit 38bb7ae

Browse files
committed
fix: rename BoundModelBase to BaseBoundModel
1 parent 8f0572e commit 38bb7ae

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

hcloud/core/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
from __future__ import annotations
22

3-
from .client import BaseResourceClient, BoundModelBase, ClientEntityBase
3+
from .client import BaseBoundModel, BaseResourceClient, BoundModelBase, ClientEntityBase
44
from .domain import BaseDomain, DomainIdentityMixin, Meta, Pagination
55

66
__all__ = [
7+
"BaseBoundModel",
78
"BaseDomain",
89
"BaseResourceClient",
910
"BoundModelBase",

hcloud/core/client.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
if TYPE_CHECKING:
77
from .._client import Client
8+
from .domain import BaseDomain
89

910

1011
class BaseResourceClient:
@@ -69,10 +70,10 @@ def __init__(self, client: Client):
6970
super().__init__(client)
7071

7172

72-
class BoundModelBase:
73-
"""Bound Model Base"""
73+
class BaseBoundModel:
74+
"""Base Bound Model"""
7475

75-
model: Any
76+
model: type[BaseDomain]
7677

7778
def __init__(
7879
self,
@@ -121,3 +122,26 @@ def __eq__(self, other: Any) -> bool:
121122
if not isinstance(other, self.__class__):
122123
return NotImplemented
123124
return self.data_model == other.data_model
125+
126+
127+
class BoundModelBase(BaseBoundModel):
128+
"""
129+
Kept for backward compatibility.
130+
131+
.. deprecated:: 2.6.0
132+
Use :class:``hcloud.core.client.BaseBoundModel`` instead.
133+
"""
134+
135+
def __init__(
136+
self,
137+
client: BaseResourceClient,
138+
data: dict,
139+
complete: bool = True,
140+
):
141+
warnings.warn(
142+
"The 'hcloud.core.client.BoundModelBase' class is deprecated, please use the "
143+
"'hcloud.core.client.BaseBoundModel' class instead.",
144+
DeprecationWarning,
145+
stacklevel=2,
146+
)
147+
super().__init__(client, data, complete)

tests/unit/core/test_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
import pytest
77

88
from hcloud.actions import ActionsPageResult
9-
from hcloud.core import BaseDomain, BaseResourceClient, BoundModelBase, Meta
9+
from hcloud.core import BaseBoundModel, BaseDomain, BaseResourceClient, Meta
1010

1111

12-
class TestBoundModelBase:
12+
class TestBaseBoundModel:
1313
@pytest.fixture()
1414
def bound_model_class(self):
1515
class Model(BaseDomain):
@@ -21,7 +21,7 @@ def __init__(self, id, name="", description=""):
2121
self.name = name
2222
self.description = description
2323

24-
class BoundModel(BoundModelBase, Model):
24+
class BoundModel(BaseBoundModel, Model):
2525
model = Model
2626

2727
return BoundModel

0 commit comments

Comments
 (0)