Skip to content

Commit 22fcd8e

Browse files
committed
Merge branch 'main' into storage-boxes
2 parents 43d0606 + 2b4773e commit 22fcd8e

42 files changed

Lines changed: 2562 additions & 1255 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
pre-commit:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v4
12+
- uses: actions/checkout@v5
1313

1414
- name: Setup python
1515
uses: actions/setup-python@v5
@@ -25,7 +25,7 @@ jobs:
2525
lint:
2626
runs-on: ubuntu-latest
2727
steps:
28-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@v5
2929

3030
- name: Setup python
3131
uses: actions/setup-python@v5

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v5
1515

1616
- name: Set up Python
1717
uses: actions/setup-python@v5
@@ -47,7 +47,7 @@ jobs:
4747
runs-on: ubuntu-latest
4848
steps:
4949
- name: Download packages artifact
50-
uses: actions/download-artifact@v4
50+
uses: actions/download-artifact@v5
5151
with:
5252
name: python-packages
5353
path: dist/

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
name: Python ${{ matrix.python-version }}
1717
steps:
18-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v5
1919

2020
- name: Setup python
2121
uses: actions/setup-python@v5

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# See https://pre-commit.com/hooks.html for more hooks
44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
6-
rev: v5.0.0
6+
rev: v6.0.0
77
hooks:
88
- id: check-added-large-files
99
- id: check-case-conflict

hcloud/actions/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import warnings
55
from typing import TYPE_CHECKING, Any, NamedTuple
66

7-
from ..core import BoundModelBase, ClientEntityBase, Meta
7+
from ..core import BoundModelBase, Meta, ResourceClientBase
88
from .domain import Action, ActionFailedException, ActionTimeoutException
99

1010
if TYPE_CHECKING:
@@ -50,7 +50,7 @@ class ActionsPageResult(NamedTuple):
5050
meta: Meta
5151

5252

53-
class ResourceActionsClient(ClientEntityBase):
53+
class ResourceActionsClient(ResourceClientBase):
5454
_resource: str
5555

5656
def __init__(self, client: Client, resource: str | None):

hcloud/certificates/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import TYPE_CHECKING, Any, NamedTuple
44

55
from ..actions import ActionsPageResult, BoundAction, ResourceActionsClient
6-
from ..core import BoundModelBase, ClientEntityBase, Meta
6+
from ..core import BoundModelBase, Meta, ResourceClientBase
77
from .domain import (
88
Certificate,
99
CreateManagedCertificateResponse,
@@ -103,7 +103,7 @@ class CertificatesPageResult(NamedTuple):
103103
meta: Meta
104104

105105

106-
class CertificatesClient(ClientEntityBase):
106+
class CertificatesClient(ResourceClientBase):
107107
_client: Client
108108

109109
actions: ResourceActionsClient

hcloud/core/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
from __future__ import annotations
22

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

66
__all__ = [
7+
"BaseDomain",
78
"BoundModelBase",
89
"ClientEntityBase",
9-
"BaseDomain",
1010
"DomainIdentityMixin",
1111
"Meta",
1212
"Pagination",
13+
"ResourceClientBase",
1314
]

hcloud/core/client.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
from __future__ import annotations
22

3+
import warnings
34
from typing import TYPE_CHECKING, Any, Callable
45

56
if TYPE_CHECKING:
67
from .._client import Client
8+
from .domain import BaseDomain
79

810

9-
class ClientEntityBase:
11+
class ResourceClientBase:
1012
_client: Client
1113

1214
max_per_page: int = 50
@@ -50,14 +52,32 @@ def _get_first_by(self, **kwargs): # type: ignore[no-untyped-def]
5052
return entities[0] if entities else None
5153

5254

55+
class ClientEntityBase(ResourceClientBase):
56+
"""
57+
Kept for backward compatibility.
58+
59+
.. deprecated:: 2.6.0
60+
Use :class:``hcloud.core.client.ResourceClientBase`` instead.
61+
"""
62+
63+
def __init__(self, client: Client):
64+
warnings.warn(
65+
"The 'hcloud.core.client.ClientEntityBase' class is deprecated, please use the "
66+
"'hcloud.core.client.ResourceClientBase' class instead.",
67+
DeprecationWarning,
68+
stacklevel=2,
69+
)
70+
super().__init__(client)
71+
72+
5373
class BoundModelBase:
5474
"""Bound Model Base"""
5575

56-
model: Any
76+
model: type[BaseDomain]
5777

5878
def __init__(
5979
self,
60-
client: ClientEntityBase,
80+
client: ResourceClientBase,
6181
data: dict,
6282
complete: bool = True,
6383
):

hcloud/datacenters/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from typing import TYPE_CHECKING, Any, NamedTuple
44

5-
from ..core import BoundModelBase, ClientEntityBase, Meta
5+
from ..core import BoundModelBase, Meta, ResourceClientBase
66
from ..locations import BoundLocation
77
from ..server_types import BoundServerType
88
from .domain import Datacenter, DatacenterServerTypes
@@ -55,7 +55,7 @@ class DatacentersPageResult(NamedTuple):
5555
meta: Meta
5656

5757

58-
class DatacentersClient(ClientEntityBase):
58+
class DatacentersClient(ResourceClientBase):
5959
_client: Client
6060

6161
def get_by_id(self, id: int) -> BoundDatacenter:

hcloud/firewalls/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import TYPE_CHECKING, Any, NamedTuple
44

55
from ..actions import ActionsPageResult, BoundAction, ResourceActionsClient
6-
from ..core import BoundModelBase, ClientEntityBase, Meta
6+
from ..core import BoundModelBase, Meta, ResourceClientBase
77
from .domain import (
88
CreateFirewallResponse,
99
Firewall,
@@ -183,7 +183,7 @@ class FirewallsPageResult(NamedTuple):
183183
meta: Meta
184184

185185

186-
class FirewallsClient(ClientEntityBase):
186+
class FirewallsClient(ResourceClientBase):
187187
_client: Client
188188

189189
actions: ResourceActionsClient

0 commit comments

Comments
 (0)