Process multiple files in parallel Args: file_paths: List of file paths or directories to process output_dir: Base output directory parse_method: Parsing method for all files recursive: Whether to search directories recursively
(
self,
file_paths: List[str],
output_dir: str,
parse_method: str = "auto",
recursive: bool = True,
**kwargs,
)
| 199 | return False, file_path, error_msg |
| 200 | |
| 201 | def process_batch( |
| 202 | self, |
| 203 | file_paths: List[str], |
| 204 | output_dir: str, |
| 205 | parse_method: str = "auto", |
| 206 | recursive: bool = True, |
| 207 | **kwargs, |
| 208 | ) -> BatchProcessingResult: |
| 209 | """ |
| 210 | Process multiple files in parallel |
| 211 | |
| 212 | Args: |
| 213 | file_paths: List of file paths or directories to process |
| 214 | output_dir: Base output directory |
| 215 | parse_method: Parsing method for all files |
| 216 | recursive: Whether to search directories recursively |
| 217 | **kwargs: Additional parser arguments |
| 218 | |
| 219 | Returns: |
| 220 | BatchProcessingResult with processing statistics |
| 221 | """ |
| 222 | start_time = time.time() |
| 223 | |
| 224 | # Filter to supported files |
| 225 | supported_files = self.filter_supported_files(file_paths, recursive) |
| 226 | |
| 227 | if not supported_files: |
| 228 | self.logger.warning("No supported files found to process") |
| 229 | return BatchProcessingResult( |
| 230 | successful_files=[], |
| 231 | failed_files=[], |
| 232 | total_files=0, |
| 233 | processing_time=0.0, |
| 234 | errors={}, |
| 235 | output_dir=output_dir, |
| 236 | ) |
| 237 | |
| 238 | self.logger.info(f"Found {len(supported_files)} files to process") |
| 239 | |
| 240 | # Create output directory |
| 241 | output_path = Path(output_dir) |
| 242 | output_path.mkdir(parents=True, exist_ok=True) |
| 243 | |
| 244 | # Process files in parallel |
| 245 | successful_files = [] |
| 246 | failed_files = [] |
| 247 | errors = {} |
| 248 | |
| 249 | # Create progress bar if requested |
| 250 | pbar = None |
| 251 | if self.show_progress: |
| 252 | pbar = tqdm( |
| 253 | total=len(supported_files), |
| 254 | desc=f"Processing files ({self.parser_type})", |
| 255 | unit="file", |
| 256 | ) |
| 257 | |
| 258 | try: |
no test coverage detected