1- from typing import Any , AsyncIterator , Optional , Tuple
1+ from typing import Any , AsyncIterator , Literal , Optional , Tuple
22
33import arro3 .core
44
@@ -142,29 +142,6 @@ class DuckdbClient:
142142 A list of STAC Collections
143143 """
144144
145- def migrate_href (href : str , version : Optional [str ] = None ) -> dict [str , Any ]:
146- """
147- Migrates a STAC dictionary at the given href to another version.
148-
149- Migration can be as simple as updating the `stac_version` attribute, but
150- sometimes can be more complicated. For example, when migrating to v1.1.0,
151- [eo:bands and raster:bands should be consolidated to the new bands
152- structure](https://github.com/radiantearth/stac-spec/releases/tag/v1.1.0-beta.1).
153-
154- See [the stac-rs
155- documentation](https://docs.rs/stac/latest/stac/enum.Version.html) for
156- supported versions.
157-
158- Args:
159- href (str): The href to read the STAC object from
160- version (str | None): The version to migrate to. If not provided, the
161- value will be migrated to the latest stable version.
162-
163- Examples:
164- >>> item = stacrs.migrate_href("examples/simple-item.json", "1.1.0-beta.1")
165- >>> assert item["stac_version"] == "1.1.0-beta.1"
166- """
167-
168145def migrate (value : dict [str , Any ], version : Optional [str ] = None ) -> dict [str , Any ]:
169146 """
170147 Migrates a STAC dictionary to another version.
@@ -179,8 +156,8 @@ def migrate(value: dict[str, Any], version: Optional[str] = None) -> dict[str, A
179156 supported versions.
180157
181158 Args:
182- value (dict[str, Any]) : The STAC value to migrate
183- version (str | None) : The version to migrate to. If not provided, the
159+ value: The STAC value to migrate
160+ version: The version to migrate to. If not provided, the
184161 value will be migrated to the latest stable version.
185162
186163 Returns:
@@ -270,35 +247,35 @@ async def search(
270247 Searches a STAC API server.
271248
272249 Args:
273- href (str) : The STAC API to search.
274- intersects (str | dict[str, Any] | GeoInterface | None) : Searches items
250+ href: The STAC API to search.
251+ intersects: Searches items
275252 by performing intersection between their geometry and provided GeoJSON
276253 geometry.
277- ids (list[str] | None) : Array of Item ids to return.
278- collections (list[str] | None) : Array of one or more Collection IDs that
254+ ids: Array of Item ids to return.
255+ collections: Array of one or more Collection IDs that
279256 each matching Item must be in.
280- max_items (int | None) : The maximum number of items to iterate through.
281- limit (int | None) : The page size returned from the server. Use
257+ max_items: The maximum number of items to iterate through.
258+ limit: The page size returned from the server. Use
282259 `max_items` to actually limit the number of items returned from this
283260 function.
284- bbox (list[float] | None) : Requested bounding box.
285- datetime (str | None) : Single date+time, or a range (`/` separator),
261+ bbox: Requested bounding box.
262+ datetime: Single date+time, or a range (`/` separator),
286263 formatted to RFC 3339, section 5.6. Use double dots .. for open
287264 date ranges.
288- include (list[str]] | None) : fields to include in the response (see [the
265+ include: fields to include in the response (see [the
289266 extension
290267 docs](https://github.com/stac-api-extensions/fields?tab=readme-ov-file#includeexclude-semantics))
291268 for more on the semantics).
292- exclude (list[str]] | None) : fields to exclude from the response (see [the
269+ exclude: fields to exclude from the response (see [the
293270 extension
294271 docs](https://github.com/stac-api-extensions/fields?tab=readme-ov-file#includeexclude-semantics))
295272 for more on the semantics).
296- sortby (list[str] | None) : Fields by which to sort results (use `-field` to sort descending).
297- filter (str | dict[str, Any] | none) : CQL2 filter expression. Strings
273+ sortby: Fields by which to sort results (use `-field` to sort descending).
274+ filter: CQL2 filter expression. Strings
298275 will be interpreted as cql2-text, dictionaries as cql2-json.
299- query (dict[str, Any] | None) : Additional filtering based on properties.
276+ query: Additional filtering based on properties.
300277 It is recommended to use filter instead, if possible.
301- use_duckdb (bool | None) : Query with DuckDB. If None and the href has a
278+ use_duckdb: Query with DuckDB. If None and the href has a
302279 'parquet' or 'geoparquet' extension, will be set to True. Defaults
303280 to None.
304281 kwargs: Additional parameters to pass in to the search.
@@ -340,40 +317,40 @@ async def search_to(
340317 Searches a STAC API server and saves the result to an output file.
341318
342319 Args:
343- outfile (str) : The output href. This can be a local file path, or any
320+ outfile: The output href. This can be a local file path, or any
344321 url scheme supported by [stac::object_store::write].
345- href (str) : The STAC API to search.
346- intersects (str | dict[str, Any] | GeoInterface | None) : Searches items
322+ href: The STAC API to search.
323+ intersects: Searches items
347324 by performing intersection between their geometry and provided GeoJSON
348325 geometry.
349- ids (list[str] | None) : Array of Item ids to return.
350- collections (list[str] | None) : Array of one or more Collection IDs that
326+ ids: Array of Item ids to return.
327+ collections: Array of one or more Collection IDs that
351328 each matching Item must be in.
352- max_items (int | None) : The maximum number of items to iterate through.
353- limit (int | None) : The page size returned from the server. Use
329+ max_items: The maximum number of items to iterate through.
330+ limit: The page size returned from the server. Use
354331 `max_items` to actually limit the number of items returned from this
355332 function.
356- bbox (list[float] | None) : Requested bounding box.
357- datetime (str | None) : Single date+time, or a range ('/' separator),
333+ bbox: Requested bounding box.
334+ datetime: Single date+time, or a range ('/' separator),
358335 formatted to RFC 3339, section 5.6. Use double dots .. for open
359336 date ranges.
360- include (list[str]] | None) : fields to include in the response (see [the
337+ include: fields to include in the response (see [the
361338 extension
362339 docs](https://github.com/stac-api-extensions/fields?tab=readme-ov-file#includeexclude-semantics))
363340 for more on the semantics).
364- exclude (list[str]] | None) : fields to exclude from the response (see [the
341+ exclude: fields to exclude from the response (see [the
365342 extension
366343 docs](https://github.com/stac-api-extensions/fields?tab=readme-ov-file#includeexclude-semantics))
367344 for more on the semantics).
368- sortby (list[str] | None) : Fields by which to sort results (use `-field` to sort descending).
369- filter (str | dict[str, Any] | none) : CQL2 filter expression. Strings
345+ sortby: Fields by which to sort results (use `-field` to sort descending).
346+ filter: CQL2 filter expression. Strings
370347 will be interpreted as cql2-text, dictionaries as cql2-json.
371- query (dict[str, Any] | None) : Additional filtering based on properties.
348+ query: Additional filtering based on properties.
372349 It is recommended to use filter instead, if possible.
373- format (str | None) : The output format. If none, will be inferred from
350+ format: The output format. If none, will be inferred from
374351 the outfile extension, and if that fails will fall back to compact JSON.
375- options (list[tuple[str, str]] | None) : Configuration values to pass to the object store backend.
376- use_duckdb (bool | None) : Query with DuckDB. If None and the href has a
352+ options: Configuration values to pass to the object store backend.
353+ use_duckdb: Query with DuckDB. If None and the href has a
377354 'parquet' or 'geoparquet' extension, will be set to True. Defaults
378355 to None.
379356
@@ -417,12 +394,12 @@ async def write(
417394 Writes STAC to a href.
418395
419396 Args:
420- href (str) : The href to write to
421- value (dict[str, Any] | list[dict[str, Any]]) : The value to write. This
397+ href: The href to write to
398+ value: The value to write. This
422399 can be a STAC dictionary or a list of items.
423- format (str | None) : The output format to write. If not provided, will be
400+ format: The output format to write. If not provided, will be
424401 inferred from the href's extension.
425- options (list[tuple[str, str]] | None) : Options for configuring an
402+ options: Options for configuring an
426403 object store, e.g. your AWS credentials.
427404
428405 Returns:
@@ -435,12 +412,18 @@ async def write(
435412 >>> await stacrs.write("items.parquet", items)
436413 """
437414
438- def version (name : str | None = None ) -> str | None :
415+ def version (
416+ name : Literal ["stac" ]
417+ | Literal ["stac-api" ]
418+ | Literal ["stac-duckdb" ]
419+ | Literal ["duckdb" ]
420+ | None = None ,
421+ ) -> str | None :
439422 """
440423 Returns this package's version, or the version of a upstream.
441424
442425 Args:
443- name (str | None) : The name of the upstream version to return. Valid
426+ name: The name of the upstream version to return. Valid
444427 values are "stac", "stac-api", "stac-duckdb", or "duckdb".
445428
446429 Returns:
0 commit comments