Skip to content

Commit

Permalink
fix: tighten the Timeout type to non-optional
Browse files Browse the repository at this point in the history
The type itself should be non-optional, and functions/methods should declare whether
they need a timeout or whether it's optional.
  • Loading branch information
gadomski committed Jun 12, 2023
1 parent 25a2743 commit c230d0c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pystac_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def open(
modifier: Optional[Callable[[Modifiable], None]] = None,
request_modifier: Optional[Callable[[Request], Union[Request, None]]] = None,
stac_io: Optional[StacApiIO] = None,
timeout: Timeout = None,
timeout: Optional[Timeout] = None,
) -> "Client":
"""Opens a STAC Catalog or API
This function will read the root catalog of a STAC Catalog or API
Expand Down Expand Up @@ -197,7 +197,7 @@ def from_file( # type: ignore
parameters: Optional[Dict[str, Any]] = None,
modifier: Optional[Callable[[Modifiable], None]] = None,
request_modifier: Optional[Callable[[Request], Union[Request, None]]] = None,
timeout: Timeout = None,
timeout: Optional[Timeout] = None,
) -> "Client":
"""Open a STAC Catalog/API
Expand Down
6 changes: 3 additions & 3 deletions pystac_client/stac_api_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
logger = logging.getLogger(__name__)


Timeout: TypeAlias = Optional[Union[float, Tuple[float, float], Tuple[float, None]]]
Timeout: TypeAlias = Union[float, Tuple[float, float], Tuple[float, None]]


class StacApiIO(DefaultStacIO):
Expand All @@ -49,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: Timeout = None,
timeout: Optional[Timeout] = None,
max_retries: Optional[int] = 5,
):
"""Initialize class for API IO
Expand Down Expand Up @@ -104,7 +104,7 @@ def update(
headers: Optional[Dict[str, str]] = None,
parameters: Optional[Dict[str, Any]] = None,
request_modifier: Optional[Callable[[Request], Union[Request, None]]] = None,
timeout: Timeout = None,
timeout: Optional[Timeout] = None,
) -> None:
"""Updates this StacApi's headers, parameters, and/or request_modifer.
Expand Down

0 comments on commit c230d0c

Please sign in to comment.