Skip to content

Commit a65ae48

Browse files
authored
fix: tighten the Timeout type to non-optional (#538)
The type itself should be non-optional, and functions/methods should declare whether they need a timeout or whether it's optional.
1 parent 25a2743 commit a65ae48

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99

1010
### Added
1111

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

pystac_client/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def open(
101101
modifier: Optional[Callable[[Modifiable], None]] = None,
102102
request_modifier: Optional[Callable[[Request], Union[Request, None]]] = None,
103103
stac_io: Optional[StacApiIO] = None,
104-
timeout: Timeout = None,
104+
timeout: Optional[Timeout] = None,
105105
) -> "Client":
106106
"""Opens a STAC Catalog or API
107107
This function will read the root catalog of a STAC Catalog or API
@@ -197,7 +197,7 @@ def from_file( # type: ignore
197197
parameters: Optional[Dict[str, Any]] = None,
198198
modifier: Optional[Callable[[Modifiable], None]] = None,
199199
request_modifier: Optional[Callable[[Request], Union[Request, None]]] = None,
200-
timeout: Timeout = None,
200+
timeout: Optional[Timeout] = None,
201201
) -> "Client":
202202
"""Open a STAC Catalog/API
203203

pystac_client/stac_api_io.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
logger = logging.getLogger(__name__)
4040

4141

42-
Timeout: TypeAlias = Optional[Union[float, Tuple[float, float], Tuple[float, None]]]
42+
Timeout: TypeAlias = Union[float, Tuple[float, float], Tuple[float, None]]
4343

4444

4545
class StacApiIO(DefaultStacIO):
@@ -49,7 +49,7 @@ def __init__(
4949
conformance: Optional[List[str]] = None,
5050
parameters: Optional[Dict[str, Any]] = None,
5151
request_modifier: Optional[Callable[[Request], Union[Request, None]]] = None,
52-
timeout: Timeout = None,
52+
timeout: Optional[Timeout] = None,
5353
max_retries: Optional[int] = 5,
5454
):
5555
"""Initialize class for API IO
@@ -104,7 +104,7 @@ def update(
104104
headers: Optional[Dict[str, str]] = None,
105105
parameters: Optional[Dict[str, Any]] = None,
106106
request_modifier: Optional[Callable[[Request], Union[Request, None]]] = None,
107-
timeout: Timeout = None,
107+
timeout: Optional[Timeout] = None,
108108
) -> None:
109109
"""Updates this StacApi's headers, parameters, and/or request_modifer.
110110

0 commit comments

Comments
 (0)