Skip to content
This repository was archived by the owner on Sep 22, 2023. It is now read-only.

Commit 5857f6d

Browse files
committed
fix: Workaround mypy's bool narrowing bug with ternery operator
* Thanks to @pranavrajpal! (python/mypy#11853 (comment))
1 parent 0261e86 commit 5857f6d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/ai/backend/client/config.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ class APIConfig:
175175
_endpoints: List[URL]
176176
_group: str
177177
_hash_type: str
178+
_skip_sslcert_validation: bool
178179

179180
def __init__(
180181
self, *,
@@ -222,12 +223,15 @@ def __init__(
222223
env_vfolders = set(get_env('VFOLDER_MOUNTS', '', clean=_clean_tokens))
223224
self._vfolder_mounts = [*(arg_vfolders | env_vfolders)]
224225
# prefer the argument flag and fallback to env if the flag is not set.
225-
self._skip_sslcert_validation = (skip_sslcert_validation
226-
if skip_sslcert_validation else
227-
get_env('SKIP_SSLCERT_VALIDATION', 'no', clean=bool_env))
228-
self._connection_timeout = connection_timeout if connection_timeout else \
226+
if skip_sslcert_validation:
227+
self._skip_sslcert_validation = True
228+
else:
229+
self._skip_sslcert_validation = get_env(
230+
'SKIP_SSLCERT_VALIDATION', 'no', clean=bool_env,
231+
)
232+
self._connection_timeout = connection_timeout if connection_timeout is not None else \
229233
get_env('CONNECTION_TIMEOUT', self.DEFAULTS['connection_timeout'], clean=float)
230-
self._read_timeout = read_timeout if read_timeout else \
234+
self._read_timeout = read_timeout if read_timeout is not None else \
231235
get_env('READ_TIMEOUT', self.DEFAULTS['read_timeout'], clean=float)
232236
self._announcement_handler = announcement_handler
233237

0 commit comments

Comments
 (0)