@@ -36,6 +36,7 @@ class Configuration:
3636 DEFAULT_LOG_LEVEL = logging .DEBUG
3737 DEFAULT_LANGUAGE = None # None means run all languages
3838 DEFAULT_STRICT_MODE = False # None means run all languages
39+ DEFAULT_NUM_THREADS = 2
3940
4041 # Environment variable names
4142 ENV_SERVICE_URL = "SERVICE_URL"
@@ -45,6 +46,7 @@ class Configuration:
4546 ENV_LOG_LEVEL = "LOG_LEVEL"
4647 ENV_LANGUAGE = "LANGUAGE"
4748 ENV_STRICT_MODE = "STRICT_MODE"
49+ ENV_NUM_THREADS = "NUM_THREADS"
4850
4951 def __init__ (
5052 self ,
@@ -54,7 +56,8 @@ def __init__(
5456 timeout : Optional [int ] = None ,
5557 log_level : Optional [int ] = None ,
5658 language : Optional [str ] = None ,
57- strict_mode : Optional [str ] = None
59+ strict_mode : Optional [str ] = None ,
60+ num_threads : Optional [int ] = None
5861 ):
5962 """
6063 Initialize Configuration with provided values or defaults.
@@ -67,6 +70,7 @@ def __init__(
6770 log_level: Logging level
6871 language: Language filter (e.g., 'c', 'go', 'python'). None means run all languages.
6972 strict_mode: Stricter matching mode for integration tests
73+ num_threads: Number of threads to use
7074 """
7175 # Resolve paths to absolute paths
7276 self .input_dir = os .path .abspath (
@@ -122,6 +126,18 @@ def __init__(
122126 self .DEFAULT_STRICT_MODE
123127 )
124128
129+ # Get num_threads with precedence
130+ num_threads_str = self ._get_env (self .ENV_NUM_THREADS )
131+ if num_threads is not None :
132+ self .num_threads = num_threads
133+ elif num_threads_str :
134+ try :
135+ self .num_threads = int (num_threads_str )
136+ except ValueError :
137+ self .num_threads = self .DEFAULT_NUM_THREADS
138+ else :
139+ self .num_threads = self .DEFAULT_NUM_THREADS
140+
125141
126142 @classmethod
127143 def create (
@@ -169,6 +185,9 @@ def create(
169185 if hasattr (args , 'strict_mode' ) and args .strict_mode is not None :
170186 kwargs ['strict_mode' ] = args .strict_mode
171187
188+ if hasattr (args , 'num_threads' ) and args .num_threads is not None :
189+ kwargs ['num_threads' ] = args .num_threads
190+
172191
173192 # Create with only the provided CLI args
174193 # __init__ will handle precedence: provided value > env var > default
@@ -244,7 +263,8 @@ def __repr__(self) -> str:
244263 f"service_url={ self .service_url !r} , "
245264 f"timeout={ self .timeout } , "
246265 f"log_level={ self .log_level } , "
247- f"language={ self .language !r} )"
266+ f"language={ self .language !r} , "
267+ f"num_threads={ self .num_threads } )"
248268 )
249269
250270
@@ -275,6 +295,7 @@ def __init__(
275295 timeout : Optional [int ] = None ,
276296 log_level : Optional [int ] = None ,
277297 language : Optional [str ] = None ,
298+ num_threads : Optional [int ] = None ,
278299 gsheets_mode : Optional [str ] = None ,
279300 input_sheet_id : Optional [str ] = None ,
280301 output_sheet_id : Optional [str ] = None ,
@@ -291,6 +312,7 @@ def __init__(
291312 timeout: Request timeout in seconds
292313 log_level: Logging level
293314 language: Language filter (e.g., 'c', 'go', 'python'). None means run all languages.
315+ num_threads: Number of threads to use
294316 gsheets_mode: Google Sheets mode: 'none', 'input', 'output', or 'both'
295317 input_sheet_id: Google Sheets ID for reading input data
296318 output_sheet_id: Google Sheets ID for writing results
@@ -304,7 +326,8 @@ def __init__(
304326 service_url = service_url ,
305327 timeout = timeout ,
306328 log_level = log_level ,
307- language = language
329+ language = language ,
330+ num_threads = num_threads
308331 )
309332
310333 # Google Sheets mode
@@ -420,6 +443,8 @@ def create(
420443 kwargs ['log_level' ] = Configuration ._parse_log_level_static (args .log_level )
421444 if hasattr (args , 'language' ) and args .language is not None :
422445 kwargs ['language' ] = args .language
446+ if hasattr (args , 'num_threads' ) and args .num_threads is not None :
447+ kwargs ['num_threads' ] = args .num_threads
423448
424449 # Extract Google Sheets kwargs
425450 if hasattr (args , 'gsheets_mode' ) and args .gsheets_mode is not None :
0 commit comments