Annotate env_str as returning an optional string
It returns the default when a variable is unset, and that default is None, so the previous annotation was wrong for both the parameter and the result.
This commit is contained in:
1 parent
e6034a69a6
commit
3c7daea3c1
1 file changed
+2
-1
+2
-1
@@ -8,6 +8,7 @@ that never equals the integer it is compared against.
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
from dsc.errors import ConfigError
|
||||
|
||||
@@ -15,7 +16,7 @@ _TRUE_VALUES = {"true", "1", "yes", "on"}
|
||||
_FALSE_VALUES = {"false", "0", "no", "off"}
|
||||
|
||||
|
||||
def env_str(name: str, default: str = None) -> str:
|
||||
def env_str(name: str, default: Optional[str] = None) -> Optional[str]:
|
||||
"""Return a text setting. An empty variable counts as unset."""
|
||||
value = os.getenv(name)
|
||||
if value is None or value == "":
|
||||
|
||||
Reference in new issue
Block a user