File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/clusterfuzz/_internal/system Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 21
21
import subprocess
22
22
import sys
23
23
from typing import Optional
24
+ from typing import TypeVar
25
+ from typing import Union
24
26
25
27
import yaml
26
28
@@ -601,7 +603,12 @@ def get_ubsan_disabled_options():
601
603
}
602
604
603
605
604
- 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 ]:
605
612
"""Returns environment variable `var` directly, without evaluating it."""
606
613
return os .environ .get (var , default )
607
614
You can’t perform that action at this time.
0 commit comments