From 3b7c7c7b4aa1f265989ef482c8610d904c72ea5d Mon Sep 17 00:00:00 2001 From: jpolchlo Date: Fri, 31 Mar 2023 11:02:02 -0400 Subject: [PATCH] Push Timeout type alias to all relevant locations --- pystac_client/client.py | 7 +------ pystac_client/stac_api_io.py | 6 +++++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pystac_client/client.py b/pystac_client/client.py index d98699e7..3867f00d 100644 --- a/pystac_client/client.py +++ b/pystac_client/client.py @@ -7,10 +7,8 @@ Iterator, List, Optional, - Tuple, Union, ) -from typing_extensions import TypeAlias import pystac import pystac.utils @@ -37,15 +35,12 @@ QueryLike, SortbyLike, ) -from pystac_client.stac_api_io import StacApiIO +from pystac_client.stac_api_io import StacApiIO, Timeout if TYPE_CHECKING: from pystac.item import Item as Item_Type -Timeout: TypeAlias = Optional[Union[float, Tuple[float, float], Tuple[float, None]]] - - class Client(pystac.Catalog): """A Client for interacting with the root of a STAC Catalog or API diff --git a/pystac_client/stac_api_io.py b/pystac_client/stac_api_io.py index 3a216c60..90c9132d 100644 --- a/pystac_client/stac_api_io.py +++ b/pystac_client/stac_api_io.py @@ -13,6 +13,7 @@ Tuple, Union, ) +from typing_extensions import TypeAlias from urllib.parse import urlparse import pystac @@ -38,6 +39,9 @@ logger = logging.getLogger(__name__) +Timeout: TypeAlias = Optional[Union[float, Tuple[float, float], Tuple[float, None]]] + + class StacApiIO(DefaultStacIO): def __init__( self, @@ -45,7 +49,7 @@ def __init__( conformance: Optional[List[str]] = None, parameters: Optional[Dict[str, Any]] = None, request_modifier: Optional[Callable[[Request], Union[Request, None]]] = None, - timeout: Optional[Union[float, Tuple[float, float], Tuple[float, None]]] = None, + timeout: Timeout = None, ): """Initialize class for API IO