11import json
22import logging
33import os
4- from typing import Dict , List , Type , Any
4+ from typing import Dict , List , Any , Optional
55from .analyzer import AnalyzerInterface , AnalyzerResult
66from .reporter import ReporterInterface
77
88class Context :
99 """Application context that manages analyzers and configuration."""
1010
11- def __init__ (self , config_path : str = None , debug : bool = False ):
11+ def __init__ (self , config_path : Optional [ str ] = None , debug : bool = False ):
1212 self .config_path = config_path
1313 self .debug = debug
1414
@@ -21,13 +21,13 @@ def __init__(self, config_path: str = None, debug: bool = False):
2121 )
2222
2323 # Initialize components
24- self .sensitive_patterns = []
25- self .config = {}
24+ self .sensitive_patterns : List [ tuple [ str , str ]] = []
25+ self .config : Dict [ str , Any ] = {}
2626
2727 # Initialize analyzer registry
2828 self ._analyzers : Dict [str , List [AnalyzerInterface ]] = {}
2929 self ._reporters : Dict [str , List [ReporterInterface ]] = {}
30- self .plan_data = None
30+ self .plan_data : Optional [ Dict [ str , Any ]] = None
3131
3232 def register_analyzer (self , analyzer : AnalyzerInterface ) -> None :
3333 """Register an analyzer in its category.
@@ -90,7 +90,7 @@ def set_plan_data(self, plan_data: Dict) -> None:
9090 """
9191 self .plan_data = plan_data
9292
93- def get_plan_data (self ) -> Dict :
93+ def get_plan_data (self ) -> Optional [ Dict [ str , Any ]] :
9494 """Retrieve stored plan data.
9595
9696 Returns:
@@ -122,6 +122,7 @@ def _merge_external_config(self) -> None:
122122 """Merge external configuration with default configuration"""
123123 self .logger .debug (f"Merging external config file: { self .config_path } " )
124124 try :
125+ assert self .config_path is not None
125126 with open (self .config_path , 'r' ) as f :
126127 external_config = json .load (f )
127128
0 commit comments