Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions hcloud/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,15 @@ def __init__(self, client):
"""
self._client = client

def _get_all(
self,
list_function, # type: function
*args,
**kwargs,
):
# type (...) -> List[BoundModelBase]
def get_all(self, *args, **kwargs):
# type: (...) -> List[BoundModelBase]
results = []

page = 1
while page:
# The *PageResult tuples MUST have the following structure
# `(result: List[Bound*], meta: Meta)`
result, meta = list_function(
result, meta = self.get_list(
page=page, per_page=self.max_per_page, *args, **kwargs
)
if result:
Expand All @@ -43,10 +38,6 @@ def _get_all(

return results

def get_all(self, *args, **kwargs):
# type: (...) -> List[BoundModelBase]
return self._get_all(self.get_list, *args, **kwargs)

def get_actions(self, *args, **kwargs):
# type: (...) -> List[BoundModelBase]
if not hasattr(self, "get_actions_list"):
Expand Down