Skip to content

Commit

Permalink
style: private function moved
Browse files Browse the repository at this point in the history
  • Loading branch information
Sciator committed Nov 27, 2023
1 parent 9290d4e commit ae2c18b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions influxdb_client/client/tasks_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,6 @@ def find_tasks(self, **kwargs):
"""
return self._service.get_tasks(**kwargs).tasks

def _find_tasks_next_page(self, page: _Page, **kwargs):
if not page.has_next:
return _Page.empty()

args = {**kwargs, 'after': page.next_after} if page.next_after is not None else kwargs
tasks_response = self._service.get_tasks(**args)

tasks = tasks_response.tasks
has_next = tasks_response.links.next is not None
last_id = tasks[-1].id if tasks else None

return _Page(tasks, has_next, last_id)

def find_tasks_iter(self, **kwargs):
"""Iterate over all tasks with pagination.
Expand Down Expand Up @@ -272,3 +259,16 @@ def get_logs(self, task_id: str) -> List['LogEvent']:
def find_tasks_by_user(self, task_user_id):
"""List all tasks by user."""
return self.find_tasks(user=task_user_id)

def _find_tasks_next_page(self, page: _Page, **kwargs):
if not page.has_next:
return _Page.empty()

args = {**kwargs, 'after': page.next_after} if page.next_after is not None else kwargs
tasks_response = self._service.get_tasks(**args)

tasks = tasks_response.tasks
has_next = tasks_response.links.next is not None
last_id = tasks[-1].id if tasks else None

return _Page(tasks, has_next, last_id)

0 comments on commit ae2c18b

Please sign in to comment.