Skip to content

Commit

Permalink
fix: tighten the Timeout type to non-optional (#538)
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 authored Jun 12, 2023
1 parent 25a2743 commit a65ae48
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Added

- Timeout option added to `Client.open` [#463](https://github.com/stac-utils/pystac-client/pull/463)
- Timeout option added to `Client.open` [#463](https://github.com/stac-utils/pystac-client/pull/463), [#538](https://github.com/stac-utils/pystac-client/pull/538)
- Support for fetching catalog queryables [#477](https://github.com/stac-utils/pystac-client/pull/477)
- PySTAC Client specific warnings [#480](https://github.com/stac-utils/pystac-client/pull/480)
- Support for fetching and merging a selection of queryables [#511](https://github.com/stac-utils/pystac-client/pull/511)
Expand Down
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 a65ae48

Please sign in to comment.