Skip to content

Commit 5bdb82e

Browse files
committed
fix: pylint
1 parent ddfc3d1 commit 5bdb82e

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

causal_testing/main.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def create_causal_test(self, test: dict, base_test: BaseTestCase) -> CausalTestC
307307
estimator=estimator,
308308
)
309309

310-
def run_tests_in_batches(self, batch_size=100, silent=False) -> List[CausalTestResult]:
310+
def run_tests_in_batches(self, batch_size: int = 100, silent: bool = False) -> List[CausalTestResult]:
311311
"""
312312
Run tests in batches to reduce memory usage.
313313
@@ -326,12 +326,11 @@ def run_tests_in_batches(self, batch_size=100, silent=False) -> List[CausalTestR
326326

327327
logger.info(f"Processing {num_tests} tests in {num_batches} batches of up to {batch_size} tests each")
328328
all_results = []
329-
with tqdm(total=num_tests, desc="Overall progress", mininterval=0.1) as overall_pbar:
329+
with tqdm(total=num_tests, desc="Overall progress", mininterval=0.1) as progress:
330330
# Process each batch
331331
for batch_idx in range(num_batches):
332332
start_idx = batch_idx * batch_size
333333
end_idx = min(start_idx + batch_size, num_tests)
334-
current_batch_size = end_idx - start_idx
335334

336335
logger.info(f"Processing batch {batch_idx + 1} of {num_batches} (tests {start_idx} to {end_idx - 1})")
337336

@@ -344,21 +343,21 @@ def run_tests_in_batches(self, batch_size=100, silent=False) -> List[CausalTestR
344343
try:
345344
result = test_case.execute_test()
346345
batch_results.append(result)
347-
except Exception as e:
346+
except (TypeError, AttributeError) as e:
348347
if not silent:
349-
logger.error(f"Error running test: {str(e)}")
348+
logger.error(f"Type or attribute error in test: {str(e)}")
350349
raise
351350
result = CausalTestResult(
352351
estimator=test_case.estimator,
353352
test_value=TestValue("Error", str(e)),
354353
)
355354
batch_results.append(result)
356355

357-
overall_pbar.update(1)
356+
progress.update(1)
358357

359358
all_results.extend(batch_results)
360359

361-
logger.info(f"Completed batch {batch_idx + 1} of {num_batches} ({current_batch_size} tests)")
360+
logger.info(f"Completed batch {batch_idx + 1} of {num_batches}")
362361

363362
logger.info(f"Completed processing all {len(all_results)} tests in {num_batches} batches")
364363
return all_results

0 commit comments

Comments
 (0)