Skip to content

Commit 854c12b

Browse files
authored
feat: reexport references in parent ressources modules (#256)
* feat: reexport references in ressources module * refactor: use new module hierarchy for imports * style: run isort on the new imports * refactor: use new module hierarchy for imports in tests and docs * style: run isort on the new imports * fix: add missing reexport * refactor: use new module hierarchy imports in client
1 parent 23b3607 commit 854c12b

92 files changed

Lines changed: 346 additions & 207 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.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ Here is an example that creates a server and list them:
2323

2424
```python
2525
from hcloud import Client
26-
from hcloud.images.domain import Image
27-
from hcloud.server_types.domain import ServerType
26+
from hcloud.images import Image
27+
from hcloud.server_types import ServerType
2828

2929
client = Client(token="{YOUR_API_TOKEN}") # Please paste your API token here
3030

examples/create_server.py

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

33
from hcloud import Client
4-
from hcloud.images.domain import Image
5-
from hcloud.server_types.domain import ServerType
4+
from hcloud.images import Image
5+
from hcloud.server_types import ServerType
66

77
# Please paste your API token here between the quotes
88
client = Client(token="{YOUR_API_TOKEN}")

examples/usage_oop.py

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

33
from hcloud import Client
4-
from hcloud.images.domain import Image
5-
from hcloud.server_types.domain import ServerType
4+
from hcloud.images import Image
5+
from hcloud.server_types import ServerType
66

77
# Create a client
88
client = Client(token="project-token")

examples/usage_procedurale.py

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

33
from hcloud import Client
4-
from hcloud.images.domain import Image
5-
from hcloud.server_types.domain import ServerType
6-
from hcloud.servers.domain import Server
7-
from hcloud.volumes.domain import Volume
4+
from hcloud.images import Image
5+
from hcloud.server_types import ServerType
6+
from hcloud.servers import Server
7+
from hcloud.volumes import Volume
88

99
client = Client(token="project-token")
1010

hcloud/_client.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@
66

77
from .__version__ import VERSION
88
from ._exceptions import APIException
9-
from .actions.client import ActionsClient
10-
from .certificates.client import CertificatesClient
11-
from .datacenters.client import DatacentersClient
12-
from .firewalls.client import FirewallsClient
13-
from .floating_ips.client import FloatingIPsClient
14-
from .images.client import ImagesClient
15-
from .isos.client import IsosClient
16-
from .load_balancer_types.client import LoadBalancerTypesClient
17-
from .load_balancers.client import LoadBalancersClient
18-
from .locations.client import LocationsClient
19-
from .networks.client import NetworksClient
20-
from .placement_groups.client import PlacementGroupsClient
21-
from .primary_ips.client import PrimaryIPsClient
22-
from .server_types.client import ServerTypesClient
23-
from .servers.client import ServersClient
24-
from .ssh_keys.client import SSHKeysClient
25-
from .volumes.client import VolumesClient
9+
from .actions import ActionsClient
10+
from .certificates import CertificatesClient
11+
from .datacenters import DatacentersClient
12+
from .firewalls import FirewallsClient
13+
from .floating_ips import FloatingIPsClient
14+
from .images import ImagesClient
15+
from .isos import IsosClient
16+
from .load_balancer_types import LoadBalancerTypesClient
17+
from .load_balancers import LoadBalancersClient
18+
from .locations import LocationsClient
19+
from .networks import NetworksClient
20+
from .placement_groups import PlacementGroupsClient
21+
from .primary_ips import PrimaryIPsClient
22+
from .server_types import ServerTypesClient
23+
from .servers import ServersClient
24+
from .ssh_keys import SSHKeysClient
25+
from .volumes import VolumesClient
2626

2727

2828
class Client:

hcloud/actions/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from __future__ import annotations
2+
3+
from .client import ActionsClient, ActionsPageResult, BoundAction # noqa: F401
4+
from .domain import ( # noqa: F401
5+
Action,
6+
ActionException,
7+
ActionFailedException,
8+
ActionTimeoutException,
9+
)

hcloud/actions/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import time
44
from typing import TYPE_CHECKING, NamedTuple
55

6-
from ..core.client import BoundModelBase, ClientEntityBase
7-
from ..core.domain import Meta
6+
from ..core import BoundModelBase, ClientEntityBase, Meta
87
from .domain import Action, ActionFailedException, ActionTimeoutException
98

109
if TYPE_CHECKING:

hcloud/actions/domain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from dateutil.parser import isoparse
44

55
from .._exceptions import HCloudException
6-
from ..core.domain import BaseDomain
6+
from ..core import BaseDomain
77

88

99
class Action(BaseDomain):

hcloud/certificates/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from __future__ import annotations
2+
3+
from .client import ( # noqa: F401
4+
BoundCertificate,
5+
CertificatesClient,
6+
CertificatesPageResult,
7+
)
8+
from .domain import ( # noqa: F401
9+
Certificate,
10+
CreateManagedCertificateResponse,
11+
ManagedCertificateError,
12+
ManagedCertificateStatus,
13+
)

hcloud/certificates/client.py

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

33
from typing import TYPE_CHECKING, NamedTuple
44

5-
from ..actions.client import ActionsPageResult, BoundAction
6-
from ..core.client import BoundModelBase, ClientEntityBase, GetEntityByNameMixin
7-
from ..core.domain import Meta
5+
from ..actions import ActionsPageResult, BoundAction
6+
from ..core import BoundModelBase, ClientEntityBase, GetEntityByNameMixin, Meta
87
from .domain import (
98
Certificate,
109
CreateManagedCertificateResponse,

0 commit comments

Comments
 (0)