From 54758aaad110ab99b5da2774b2ebb3f45f4cb66c Mon Sep 17 00:00:00 2001 From: Ian Schneider Date: Thu, 7 Nov 2024 13:58:45 -0700 Subject: [PATCH] format and type hint fixes --- planet/clients/subscriptions.py | 7 ++++--- tests/integration/test_data_api.py | 17 +++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/planet/clients/subscriptions.py b/planet/clients/subscriptions.py index f51da1ed..82194dc3 100644 --- a/planet/clients/subscriptions.py +++ b/planet/clients/subscriptions.py @@ -1,7 +1,7 @@ """Planet Subscriptions API Python client.""" import logging -from typing import Any, AsyncIterator, Awaitable, Callable, Dict, Iterator, Optional, Sequence, TypeVar, Union, overload +from typing import Any, AsyncIterator, Awaitable, Dict, Iterator, Optional, Sequence, TypeVar, Union from typing_extensions import Literal @@ -381,6 +381,7 @@ def __init__(self, def list_subscriptions(self, status: Optional[Sequence[str]] = None, + source_type: Optional[str] = None, limit: int = 100) -> Iterator[Dict]: """Iterate over list of account subscriptions with optional filtering. @@ -405,7 +406,7 @@ def list_subscriptions(self, ClientError: on a client error. """ - results = self._client.list_subscriptions(status, limit) + results = self._client.list_subscriptions(status, source_type, limit) try: while True: @@ -546,7 +547,7 @@ def get_results_csv( "processing", "failed", "success"]]] = None - ) -> AsyncIterator[str]: + ) -> Iterator[str]: """Iterate over rows of results CSV for a Subscription. Parameters: diff --git a/tests/integration/test_data_api.py b/tests/integration/test_data_api.py index c4d2246c..f177dd24 100644 --- a/tests/integration/test_data_api.py +++ b/tests/integration/test_data_api.py @@ -27,7 +27,8 @@ from planet import exceptions, DataClient, data_filter from planet.clients.data import (LIST_SORT_DEFAULT, LIST_SEARCH_TYPE_DEFAULT, - SEARCH_SORT_DEFAULT, DataAPI) + SEARCH_SORT_DEFAULT, + DataAPI) from planet.http import Session TEST_URL = 'http://www.mocknotrealurl.com/api/path' @@ -442,8 +443,8 @@ def test_create_search_basic_sync(search_filter, data_api): respx.post(TEST_SEARCHES_URL).return_value = mock_resp search = data_api.create_search(item_types=['PSScene'], - search_filter=search_filter, - name='test') + search_filter=search_filter, + name='test') # check that request is correct expected_request = { @@ -632,9 +633,9 @@ def test_update_search_basic_sync(search_filter, data_api): f'{TEST_SEARCHES_URL}/{VALID_SEARCH_ID}').return_value = mock_resp search = data_api.update_search(VALID_SEARCH_ID, - item_types=['PSScene'], - search_filter=search_filter, - name='test') + item_types=['PSScene'], + search_filter=search_filter, + name='test') # check that request is correct expected_request = { @@ -1495,8 +1496,8 @@ async def _stream_img(): Path(tmpdir, 'img.tif').write_text('i exist') path = data_api.download_asset(basic_udm2_asset, - directory=tmpdir, - overwrite=overwrite) + directory=tmpdir, + overwrite=overwrite) assert path.name == 'img.tif' assert path.is_file()