From 3c7daea3c1351112b318c5042cdef51cc586e31d Mon Sep 17 00:00:00 2001 From: Maxim Shulga Date: Sun, 2 Aug 2026 18:08:38 -0700 Subject: [PATCH] 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. --- dsc/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dsc/config.py b/dsc/config.py index d6f5f86..26e377e 100644 --- a/dsc/config.py +++ b/dsc/config.py @@ -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 == "":