@@ -1065,7 +1065,7 @@ def build_wiki_content(actions: List, config: Dict[str, Any]) -> str:
10651065 actions = filtered_actions
10661066
10671067 combined_actions = []
1068- actions_by_target = {}
1068+ actions_by_target : Dict [ str , List [ Any ]] = {}
10691069
10701070 for action in actions :
10711071 content_id = extract_content_id_from_permalink (get_target_permalink (action ))
@@ -1121,7 +1121,7 @@ def build_wiki_content(actions: List, config: Dict[str, Any]) -> str:
11211121 actions = actions [:max_entries ]
11221122
11231123 # Group actions by date
1124- actions_by_date = {}
1124+ actions_by_date : Dict [ str , List [ Any ]] = {}
11251125 for action in actions :
11261126 date_str = get_action_datetime (action ).strftime ("%Y-%m-%d" )
11271127 if date_str not in actions_by_date :
@@ -1371,10 +1371,10 @@ def process_modlog_actions(reddit, config: Dict[str, Any]) -> List:
13711371
13721372def load_env_config () -> Dict [str , Any ]:
13731373 """Load configuration from environment variables"""
1374- env_config = {}
1374+ env_config : Dict [ str , Any ] = {}
13751375
13761376 # Reddit credentials
1377- reddit_config = {}
1377+ reddit_config : Dict [ str , Any ] = {}
13781378 if os .getenv ("REDDIT_CLIENT_ID" ):
13791379 reddit_config ["client_id" ] = os .getenv ("REDDIT_CLIENT_ID" )
13801380 if os .getenv ("REDDIT_CLIENT_SECRET" ):
@@ -1388,31 +1388,39 @@ def load_env_config() -> Dict[str, Any]:
13881388 env_config ["reddit" ] = reddit_config
13891389
13901390 # Application settings
1391- if os .getenv ("SOURCE_SUBREDDIT" ):
1392- env_config ["source_subreddit" ] = os .getenv ("SOURCE_SUBREDDIT" )
1393- if os .getenv ("WIKI_PAGE" ):
1394- env_config ["wiki_page" ] = os .getenv ("WIKI_PAGE" )
1395- if os .getenv ("RETENTION_DAYS" ):
1396- env_config ["retention_days" ] = int (os .getenv ("RETENTION_DAYS" ))
1397- if os .getenv ("BATCH_SIZE" ):
1398- env_config ["batch_size" ] = int (os .getenv ("BATCH_SIZE" ))
1399- if os .getenv ("UPDATE_INTERVAL" ):
1400- env_config ["update_interval" ] = int (os .getenv ("UPDATE_INTERVAL" ))
1401- if os .getenv ("ANONYMIZE_MODERATORS" ):
1402- env_config ["anonymize_moderators" ] = os .getenv ("ANONYMIZE_MODERATORS" ).lower () == "true"
1391+ source_subreddit = os .getenv ("SOURCE_SUBREDDIT" )
1392+ if source_subreddit :
1393+ env_config ["source_subreddit" ] = source_subreddit
1394+ wiki_page = os .getenv ("WIKI_PAGE" )
1395+ if wiki_page :
1396+ env_config ["wiki_page" ] = wiki_page
1397+ retention_days = os .getenv ("RETENTION_DAYS" )
1398+ if retention_days :
1399+ env_config ["retention_days" ] = int (retention_days )
1400+ batch_size = os .getenv ("BATCH_SIZE" )
1401+ if batch_size :
1402+ env_config ["batch_size" ] = int (batch_size )
1403+ update_interval = os .getenv ("UPDATE_INTERVAL" )
1404+ if update_interval :
1405+ env_config ["update_interval" ] = int (update_interval )
1406+ anonymize_moderators = os .getenv ("ANONYMIZE_MODERATORS" )
1407+ if anonymize_moderators :
1408+ env_config ["anonymize_moderators" ] = anonymize_moderators .lower () == "true"
14031409
14041410 # Wiki actions (comma-separated list)
1405- if os .getenv ("WIKI_ACTIONS" ):
1411+ wiki_actions = os .getenv ("WIKI_ACTIONS" )
1412+ if wiki_actions :
14061413 try :
1407- raw_actions = [action .strip () for action in os . getenv ( "WIKI_ACTIONS" ) .split ("," )]
1414+ raw_actions = [action .strip () for action in wiki_actions .split ("," )]
14081415 env_config ["wiki_actions" ] = validate_wiki_actions (raw_actions )
14091416 except ValueError as e :
14101417 logger .error (f"WIKI_ACTIONS environment variable invalid: { e } " )
14111418 raise
14121419
14131420 # Ignored moderators (comma-separated list)
1414- if os .getenv ("IGNORED_MODERATORS" ):
1415- env_config ["ignored_moderators" ] = [mod .strip () for mod in os .getenv ("IGNORED_MODERATORS" ).split ("," )]
1421+ ignored_moderators = os .getenv ("IGNORED_MODERATORS" )
1422+ if ignored_moderators :
1423+ env_config ["ignored_moderators" ] = [mod .strip () for mod in ignored_moderators .split ("," )]
14161424
14171425 return env_config
14181426
0 commit comments