From 0c551e88b99b82627c08982c9b6c68c472b93303 Mon Sep 17 00:00:00 2001 From: MrCreosote Date: Thu, 15 Oct 2026 15:35:48 -0700 Subject: [PATCH] Make not_falsy generic to preserve argument types for static analysis Typing obj as Any erased the caller's type on return, so attributes assigned via not_falsy (e.g. self._s3cli = not_falsy(s3cli, ...)) were inferred as Any, breaking IDE go-to-definition/references on their methods. --- cdmtaskservice/arg_checkers.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cdmtaskservice/arg_checkers.py b/cdmtaskservice/arg_checkers.py index ebd51380..116b2346 100644 --- a/cdmtaskservice/arg_checkers.py +++ b/cdmtaskservice/arg_checkers.py @@ -8,17 +8,19 @@ ''' import datetime -from typing import Any +from typing import TypeVar import unicodedata +_T = TypeVar("_T") -def not_falsy(obj: Any, name: str): + +def not_falsy(obj: _T, name: str) -> _T: """ Check an argument is not falsy. - + obj - the argument to check. name - the name of the argument to use in exceptions. - + returns the object. """ if not obj: