Skip to content

Commit c7bf002

Browse files
committed
Move timeout resolution to __init__ per review feedback
1 parent 8d19138 commit c7bf002

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/hatch/index/core.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import hyperlink
88

99
from hatch._version import __version__
10+
from hatch.utils.network import DEFAULT_TIMEOUT
1011

1112
if TYPE_CHECKING:
1213
import httpx
@@ -48,14 +49,12 @@ def __init__(self, repo: str, *, user="", auth="", ca_cert=None, client_cert=Non
4849
if ca_cert:
4950
self.__verify = ca_cert
5051

51-
self.__timeout = timeout
52+
self.__timeout = DEFAULT_TIMEOUT if timeout is None else timeout
5253

5354
@cached_property
5455
def client(self) -> httpx.Client:
5556
import httpx
5657

57-
from hatch.utils.network import DEFAULT_TIMEOUT
58-
5958
user_agent = (
6059
f"Hatch/{__version__} "
6160
f"{sys.implementation.name}/{'.'.join(map(str, sys.version_info[:3]))} "
@@ -64,7 +63,7 @@ def client(self) -> httpx.Client:
6463
return httpx.Client(
6564
headers={"User-Agent": user_agent},
6665
transport=httpx.HTTPTransport(retries=3, verify=self.__verify, cert=self.__cert),
67-
timeout=DEFAULT_TIMEOUT if self.__timeout is None else self.__timeout,
66+
timeout=self.__timeout,
6867
)
6968

7069
def upload_artifact(self, artifact: Path, data: dict):

0 commit comments

Comments
 (0)