nebius/SWE-bench-extra huggingface dataset:
Repository: planetlabs/planet-client-python

Issue:
Remove reported data from CLI download
Currently, when requesting a download, the CLI reports the number of files in an order. 

For example, for an order with 12 files here's what one would see to stdout:

```
❯ planet orders download my-oid
Downloaded 12 files.
```

**Proposal:**
After [lengthy discussions](https://github.com/planetlabs/planet-client-python/pull/355#issuecomment-1010215231), I propose that the CLI should remain silent upon a download request. Specifically, the download request should not output to stdout nor stderr, but using the INFO log, which already exists in `body.write()`, to communicate the files downloaded.

**To do:**
1) Remove `click.echo(f'Downloaded {len(filenames)} files.')` in `planet.cli.orders.download()` (line 126)
2) Update the CLI's test in `tests.unit.test_cli_orders.test_cli_orders_download()` to no longer expect "`'Downloaded 4 files.\n'`"

Comments:

Patch:
diff --git a/planet/cli/orders.py b/planet/cli/orders.py
index ab03c78..a30b561 100644
--- a/planet/cli/orders.py
+++ b/planet/cli/orders.py
@@ -118,12 +118,11 @@ async def download(ctx, order_id, quiet, overwrite, dest):
         with planet.reporting.StateBar(order_id=order_id,
                                        disable=quiet) as bar:
             await cl.poll(str(order_id), report=bar.update)
-            filenames = await cl.download_order(
+            _ = await cl.download_order(
                     str(order_id),
                     directory=dest,
                     overwrite=overwrite,
                     progress_bar=not quiet)
-    click.echo(f'Downloaded {len(filenames)} files.')
 
 
 def split_id_list(ctx, param, value):


Test patch:
diff --git a/tests/unit/test_cli_orders.py b/tests/unit/test_cli_orders.py
index ff9c16a..ee1f4a0 100644
--- a/tests/unit/test_cli_orders.py
+++ b/tests/unit/test_cli_orders.py
@@ -89,8 +89,8 @@ def test_cli_orders_download(runner, patch_ordersclient, oid):
         return
     patch_ordersclient('poll', poll)
 
-    # Number of files in all_test_files
-    expected = 'Downloaded 4 files.\n'
+    # Download should not report anything
+    expected = ''
 
     # allow for some progress reporting
     result = runner.invoke(
Repository: planetlabs/planet-client-python

Issue:
Report invalid item-types with more human-readable list
With `planet data search` if I do an improper item-type I get a response like:

```
Error: Invalid value for 'ITEM_TYPES': ['psscend'] should be one of {'PSScene', 'MOD09GA', 'MYD09GA', 'MYD09GQ', 'SkySatCollect', 'REOrthoTile', 'REScene', 'MOD09GQ', 'PSScene4Band', 'Sentinel1', 'Sentinel2L1C', 'SkySatScene', 'Landsat8L1G', 'PSOrthoTile', 'PSScene3Band'}
```

The { and ' characters make it feel like a dump of a program. It'd be better to have it look like a more natural list. 

`planet orders request` does it in a more readable way, so likely can just copy theirs: 
```
Error: Invalid value: item_type - 'skysatcollectd' is not one of 'PSScene', 'Landsat8L1G', 'SkySatScene', 'SkySatCollect', 'PSOrthoTile', 'REOrthoTile', 'PSScene3Band', 'Sentinel2L1C'.
```

Comments:

Patch:
diff --git a/planet/cli/data.py b/planet/cli/data.py
index 1abdcde..5588c6d 100644
--- a/planet/cli/data.py
+++ b/planet/cli/data.py
@@ -19,7 +19,7 @@ import click
 
 from planet import data_filter, DataClient
 from planet.clients.data import SEARCH_SORT, SEARCH_SORT_DEFAULT, STATS_INTERVAL
-from planet.specs import get_item_types
+from planet.specs import get_item_types, SpecificationException
 
 from . import types
 from .cmds import coro, translate_exceptions
@@ -64,11 +64,12 @@ def assets_to_filter(ctx, param, assets: List[str]) -> Optional[dict]:
 
 def check_item_types(ctx, param, item_types) -> Optional[List[dict]]:
     # Set difference between given item types and all item types
-    set_diff = set([item.lower() for item in item_types]) - set(
+    invalid_item_types = set([item.lower() for item in item_types]) - set(
         [a.lower() for a in ALL_ITEM_TYPES])
-    if set_diff:
-        raise click.BadParameter(
-            f'{item_types} should be one of {ALL_ITEM_TYPES}')
+    if invalid_item_types:
+        raise SpecificationException(invalid_item_types,
+                                     ALL_ITEM_TYPES,
+                                     'item_type')
     else:
         return item_types
 


Test patch:
diff --git a/tests/unit/test_data_item_type.py b/tests/unit/test_data_item_type.py
index 41d7b78..a777609 100644
--- a/tests/unit/test_data_item_type.py
+++ b/tests/unit/test_data_item_type.py
@@ -13,7 +13,7 @@
 # limitations under the License.
 import logging
 import pytest
-import click
+from planet.specs import SpecificationException
 from planet.cli.data import check_item_types
 
 LOGGER = logging.getLogger(__name__)
@@ -51,5 +51,5 @@ def test_item_type_success(item_types):
 
 def test_item_type_fail():
     ctx = MockContext()
-    with pytest.raises(click.BadParameter):
+    with pytest.raises(SpecificationException):
         check_item_types(ctx, 'item_type', "bad_item_type")
Repository: planetlabs/planet-client-python

Issue:
Include basemaps orders in `planet order list` output
**Is your feature request related to a problem? Please describe.**

Planet now supports [basemaps in orders](https://developers.planet.com/apis/orders/basemaps/). This works great with all the core orders commands, except for `list`. You can `get` a basemaps order, `wait`, and `download` it. 
 
**Describe the solution you'd like**
To have `planet orders list` return basemaps and scene orders.

The core API team wanted to make everything backwards compatible, so they kept the GET at https://api.planet.com/compute/ops/orders/v2/ to just the scene orders. They introduced a parameter called `source_type`, that can take values like `all`, `basemaps`, `scenes`, `basemaps,scenes`. 

I propose we just return `all`, since the SDK and CLI just output the JSON directly, so returning an extra JSON attribute doesn't effect anything. Our `list` should aim to show all the options at the end point.

**Describe alternatives you've considered**

We could consider supporting the `source_type` parameter as an option, with a default to `all`. But that could also be ticketed as its own issue.

**Additional context**



Comments:

Patch:
diff --git a/planet/clients/orders.py b/planet/clients/orders.py
index e405046..733e96f 100644
--- a/planet/clients/orders.py
+++ b/planet/clients/orders.py
@@ -481,15 +481,14 @@ class OrdersClient:
             planet.exceptions.ClientError: If state is not valid.
         """
         url = self._orders_url()
+        params = {"source_type": "all"}
 
         if state:
             if state not in ORDER_STATE_SEQUENCE:
                 raise exceptions.ClientError(
                     f'Order state ({state}) is not a valid state. '
                     f'Valid states are {ORDER_STATE_SEQUENCE}')
-            params = {"state": state}
-        else:
-            params = None
+            params['state'] = state
 
         response = await self._session.request(method='GET',
                                                url=url,


Test patch:
diff --git a/tests/integration/test_orders_api.py b/tests/integration/test_orders_api.py
index d7ddab2..bb1a63e 100644
--- a/tests/integration/test_orders_api.py
+++ b/tests/integration/test_orders_api.py
@@ -123,7 +123,7 @@ async def test_list_orders_basic(order_descriptions, session):
 @respx.mock
 @pytest.mark.asyncio
 async def test_list_orders_state(order_descriptions, session):
-    list_url = TEST_ORDERS_URL + '?state=failed'
+    list_url = TEST_ORDERS_URL + '?source_type=all&state=failed'
 
     order1, order2, _ = order_descriptions
 
diff --git a/tests/integration/test_orders_cli.py b/tests/integration/test_orders_cli.py
index 59909c8..16c7a9f 100644
--- a/tests/integration/test_orders_cli.py
+++ b/tests/integration/test_orders_cli.py
@@ -85,7 +85,7 @@ def test_cli_orders_list_empty(invoke):
 
 @respx.mock
 def test_cli_orders_list_state(invoke, order_descriptions):
-    list_url = TEST_ORDERS_URL + '?state=failed'
+    list_url = TEST_ORDERS_URL + '?source_type=all&state=failed'
 
     order1, order2, _ = order_descriptions
Repository: planetlabs/planet-client-python

Issue:
`planet subscriptions results` not returning more than 20 results
**Expected behavior**
`planet subscriptions results <sub-id>` to return 100 results as specified as the default in the documentation. Or to return 
the proper number of results if `--limit` is greater than 20 (it works properly if the limit is less than 20)

**Actual behavior (describe the problem)**

Only 20 results are returned, even if the `--limit` is set to be greater than 20. 

It seems like the cli client is not actually paging through results - it just does the first 20 and stops. I verified that the http endpoint has more results. It has 20 on the first page, but it has a 'next' link that has 20 per page.

**Workaround**
Going to the http end point directly and following the 'next' links?

**Minimum, Complete, Viable Code Sample**

```console
> planet subscriptions results <sub-id> --limit 21
```

Should result in 21 calls returned, only 20 are.

**Environment Information**
* Operation System Information: macOS-12.2.1-arm64-arm-64bit
* Python version 3.9.15: (main, Oct 11 2022, 21:39:54)  [Clang 14.0.0 (clang-1400.0.29.102)]
* Planet package version: planet, version 2.0a7dev

**Installation Method**
* pip


Comments:

Patch:
diff --git a/planet/clients/subscriptions.py b/planet/clients/subscriptions.py
index dd884a1..ac9ea69 100644
--- a/planet/clients/subscriptions.py
+++ b/planet/clients/subscriptions.py
@@ -221,7 +221,6 @@ class SubscriptionsClient:
 
         class _ResultsPager(Paged):
             """Navigates pages of messages about subscription results."""
-            NEXT_KEY = '_next'
             ITEMS_KEY = 'results'
 
         params = {'status': [val for val in status or {}]}


Test patch:
diff --git a/tests/integration/test_subscriptions_api.py b/tests/integration/test_subscriptions_api.py
index 4658660..44daf66 100644
--- a/tests/integration/test_subscriptions_api.py
+++ b/tests/integration/test_subscriptions_api.py
@@ -122,7 +122,7 @@ def result_pages(status=None, size=40):
         pm = datetime.now().isoformat()
         if len(results) == size:
             url = f'https://api.planet.com/subscriptions/v1/42/results?pm={pm}'
-            page['_links']['_next'] = url
+            page['_links']['next'] = url
         pages.append(page)
     return pages
Repository: planetlabs/planet-client-python

Issue:
Implement CLI command: planet data search-delete
As specified in https://github.com/planetlabs/planet-client-python/blob/main/design-docs/CLI-Data.md#search-delete

Comments:

Patch:
diff --git a/planet/cli/data.py b/planet/cli/data.py
index b730609..dc0bc8e 100644
--- a/planet/cli/data.py
+++ b/planet/cli/data.py
@@ -352,8 +352,19 @@ async def search_get(ctx, search_id, pretty):
         echo_json(items, pretty)
 
 
+@data.command()
+@click.pass_context
+@translate_exceptions
+@coro
+@click.argument('search_id')
+async def search_delete(ctx, search_id):
+    """Delete an existing saved search.
+    """
+    async with data_client(ctx) as cl:
+        await cl.delete_search(search_id)
+
+
 # TODO: search_update()".
-# TODO: search_delete()".
 # TODO: search_run()".
 # TODO: item_get()".
 # TODO: asset_activate()".


Test patch:
diff --git a/tests/integration/test_data_cli.py b/tests/integration/test_data_cli.py
index 109497c..881693c 100644
--- a/tests/integration/test_data_cli.py
+++ b/tests/integration/test_data_cli.py
@@ -53,6 +53,7 @@ def test_data_command_registered(invoke):
     assert "search" in result.output
     assert "search-create" in result.output
     assert "search-get" in result.output
+    assert "search-delete" in result.output
     # Add other sub-commands here.
 
 
@@ -701,9 +702,31 @@ def test_search_get_id_not_found(invoke, search_id):
     assert 'Error: {"message": "Error message"}\n' == result.output
 
 
+@respx.mock
+def test_search_delete_success(invoke, search_id, search_result):
+    delete_url = f'{TEST_SEARCHES_URL}/{search_id}'
+    mock_resp = httpx.Response(HTTPStatus.NO_CONTENT, json=search_result)
+    respx.delete(delete_url).return_value = mock_resp
+
+    result = invoke(['search-delete', search_id])
+
+    assert not result.exception
+
+
+@respx.mock
+def test_search_delete_nonexistant_search_id(invoke, search_id, search_result):
+    delete_url = f'{TEST_SEARCHES_URL}/{search_id}'
+    mock_resp = httpx.Response(404, json=search_result)
+    respx.delete(delete_url).return_value = mock_resp
+
+    result = invoke(['search-delete', search_id])
+
+    assert result.exception
+    assert result.exit_code == 1
+
+
 # TODO: basic test for "planet data search-create".
 # TODO: basic test for "planet data search-update".
-# TODO: basic test for "planet data search-delete".
 # TODO: basic test for "planet data search-get".
 # TODO: basic test for "planet data search-list".
 # TODO: basic test for "planet data search-run".
Repository: planetlabs/planet-client-python

Issue:
Add time_range_type parameter to subscription source params
The new parameter is a string and one of "acquired", or "published". This is a new API feature. Previously, "published" was the only option.

Comments:

Patch:
diff --git a/CHANGES.txt b/CHANGES.txt
index 105eff2..2c6d297 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,8 +1,8 @@
 2.1.0 (TBD)
 
 Added:
-- Support for catalog source publishing stages has been added to
-  subscription_request.catalog_source (#977).
+- Support for catalog source publishing stages (#977) and time range types
+  (#978) have been added to subscription_request.catalog_source.
 - Add the option to get Planetary Variable subscription results as a CSV file
   (#981).
 - A subscription_request.planetary_variable_source function has been added
diff --git a/planet/subscription_request.py b/planet/subscription_request.py
index 4d494ec..75db02a 100644
--- a/planet/subscription_request.py
+++ b/planet/subscription_request.py
@@ -154,6 +154,7 @@ def catalog_source(
     publishing_stages: Optional[Sequence[Literal["preview",
                                                  "standard",
                                                  "finalized"]]] = None,
+    time_range_type: Optional[Literal["acquired", "published"]] = None,
 ) -> dict:
     """Construct a Catalog subscription source.
 
@@ -201,6 +202,7 @@ def catalog_source(
         ...     },
         ...     start_time=datetime(2021, 3, 1),
         ...     publishing_stages=["standard"],
+        ...     time_range_type="acquired",
         ... )
         >>> request = build_request(
         ...     "Standard PSScene Ortho Analytic",
@@ -247,6 +249,9 @@ def catalog_source(
     if publishing_stages:
         parameters['publishing_stages'] = list(set(publishing_stages))
 
+    if time_range_type:
+        parameters['time_range_type'] = time_range_type
+
     return {"type": "catalog", "parameters": parameters}
 
 


Test patch:
diff --git a/tests/unit/test_subscription_request.py b/tests/unit/test_subscription_request.py
index 34cd5fa..1b09afa 100644
--- a/tests/unit/test_subscription_request.py
+++ b/tests/unit/test_subscription_request.py
@@ -394,3 +394,16 @@ def test_catalog_source_publishing_stages(publishing_stages, geom_geojson):
 
     assert source["parameters"]["publishing_stages"] == list(
         set(publishing_stages))
+
+
+def test_catalog_source_time_range_type_acquired(geom_geojson):
+    """Configure 'acquired' time range type for a catalog source."""
+    source = subscription_request.catalog_source(
+        item_types=["PSScene"],
+        asset_types=["ortho_analytic_4b"],
+        geometry=geom_geojson,
+        start_time=datetime(2021, 3, 1),
+        time_range_type="acquired",
+    )
+
+    assert source["parameters"]["time_range_type"] == "acquired"