We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7f0feb3 commit dba7d7bCopy full SHA for dba7d7b
src/clusterfuzz/_internal/system/environment.py
@@ -21,6 +21,8 @@
21
import subprocess
22
import sys
23
from typing import Optional
24
+from typing import TypeVar
25
+from typing import Union
26
27
import yaml
28
@@ -601,7 +603,12 @@ def get_ubsan_disabled_options():
601
603
}
602
604
605
-def get_value_raw(var: str, default: Optional[str] = None) -> Optional[str]:
606
+# This allows the type checker to notice that if the default value passed to
607
+# `get_value_raw()` is not None, then the function will never return None.
608
+_MaybeStr = TypeVar('MaybeStr', bound=Optional[str])
609
+
610
611
+def get_value_raw(var: str, default: _MaybeStr = None) -> Union[str, _MaybeStr]:
612
"""Returns environment variable `var` directly, without evaluating it."""
613
return os.environ.get(var, default)
614
0 commit comments