11import os
22from pathlib import Path
33import logging
4+ from typing import List , Optional
45from .credential_masking import mask_exception_message , mask_string
56
67try :
78 from dotenv import load_dotenv # type: ignore
89except ImportError :
910
10- def load_dotenv (* args , ** kwargs ) : # type: ignore[no-redef]
11+ def load_dotenv (* args : object , ** kwargs : object ) -> None : # type: ignore[no-redef]
1112 """Fallback when python-dotenv is not installed."""
1213 logger = logging .getLogger (__name__ )
1314 logger .warning (
@@ -45,7 +46,7 @@ def load_dotenv(*args, **kwargs): # type: ignore[no-redef]
4546LLM_MODEL = os .getenv ("LLM_MODEL" , "" ) or None
4647
4748DEFAULT_MODEL = os .getenv ("DEFAULT_MODEL" , "gemini" )
48- AVAILABLE_MODELS = []
49+ AVAILABLE_MODELS : List [ str ] = []
4950
5051if GEMINI_API_KEY :
5152 AVAILABLE_MODELS .append ("gemini" )
@@ -57,7 +58,7 @@ def load_dotenv(*args, **kwargs): # type: ignore[no-redef]
5758 AVAILABLE_MODELS .append ("ollama" )
5859
5960
60- def validate_gemini_key ():
61+ def validate_gemini_key () -> bool :
6162 """Validate Gemini API key by configuring the client."""
6263 if not GEMINI_API_KEY :
6364 return False
@@ -75,9 +76,9 @@ def validate_gemini_key():
7576 return False
7677
7778
78- def validate_env_vars ():
79+ def validate_env_vars () -> bool :
7980 """Validate that required environment variables are set."""
80- missing_vars = []
81+ missing_vars : List [ str ] = []
8182
8283 if not NCBI_API_KEY :
8384 missing_vars .append ("NCBI_API_KEY" )
@@ -103,9 +104,9 @@ def validate_env_vars():
103104validate_env_vars ()
104105
105106
106- def check_required_vars ():
107+ def check_required_vars () -> bool :
107108 """Check if all required environment variables are set."""
108- missing_vars = []
109+ missing_vars : List [ str ] = []
109110
110111 if not NCBI_API_KEY :
111112 missing_vars .append ("NCBI_API_KEY" )
@@ -212,7 +213,7 @@ def check_required_vars():
212213MAX_LOG_FILES = 5 # Keep 5 rotated log files
213214
214215
215- def setup_logging ():
216+ def setup_logging () -> logging . Logger :
216217 """Configure logging with file rotation.
217218
218219 Falls back to console-only logging if file handlers can't be created.
@@ -237,7 +238,7 @@ def setup_logging():
237238 root_logger .removeHandler (handler )
238239
239240 # Try to create file handlers, but handle permission errors gracefully
240- file_handlers_created = []
241+ file_handlers_created : List [ str ] = []
241242
242243 try :
243244 # Main application log handler with rotation
0 commit comments