Skip to content

Commit

Permalink
manubot#337 Add real types for util.
Browse files Browse the repository at this point in the history
Also add more time to download CSL and stuff.
  • Loading branch information
xihh87 committed Jun 29, 2022
1 parent 4793bac commit ed3ed86
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions manubot/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import typing
from types import ModuleType

default_timeout = (3, 15)
default_timeout = (3, 27)

if typing.TYPE_CHECKING:
# allow type annotations of lazy-imported packages
Expand Down Expand Up @@ -72,9 +72,11 @@ def is_http_url(string: str) -> bool:
return parsed_url.scheme in _http_url_schemes


def read_serialized_data(path: str, timeout_seconds: int = default_timeout):
def read_serialized_data(
path: str, timeout_seconds: typing.Union[tuple, int, float, None] = default_timeout
):
"""
Read seralized data from a local file path or web-address.
Read serialized data from a local file path or web-address.
If file format extension is not detected in path, assumes JSON.
If a URL does not contain the appropriate suffix, one workaround
is to hack the fragment like https://example.org#/variables.toml
Expand Down

0 comments on commit ed3ed86

Please sign in to comment.