diff --git a/atroposlib/frontend/jsonl2html.py b/atroposlib/frontend/jsonl2html.py index 45d7f322..264dbb64 100644 --- a/atroposlib/frontend/jsonl2html.py +++ b/atroposlib/frontend/jsonl2html.py @@ -87,8 +87,7 @@ def create_html_for_group(group_data, index): score_class = get_score_class(score) item_id = f"group-{index}-item-{i}" - items_html += textwrap.dedent( - f"""\ + items_html += textwrap.dedent(f"""\

Content {i}

@@ -96,8 +95,7 @@ def create_html_for_group(group_data, index):

Reward: {html.escape(str(score))}

- """ - ) + """) if not items_html: # Handle case where after length correction, there are no items @@ -108,16 +106,14 @@ def create_html_for_group(group_data, index): return "" # Skip this group entirely in the output # Use
and for native collapsibility - group_html = textwrap.dedent( - f"""\ + group_html = textwrap.dedent(f"""\
Group {index}
{items_html}
- """ - ) + """) return group_html diff --git a/environments/community/accessibility_env/accessibility_env.py b/environments/community/accessibility_env/accessibility_env.py index e401e8ca..9d8bcbd0 100644 --- a/environments/community/accessibility_env/accessibility_env.py +++ b/environments/community/accessibility_env/accessibility_env.py @@ -141,10 +141,8 @@ class AccessibilityEnv(BaseEnv): raise self.iter = 0 - print( - f"""[{self.name}] Setup complete. Loaded {len(self.dataset)} - items. Initialized {len(self.accessibility_rules)} accessibility rules.""" - ) + print(f"""[{self.name}] Setup complete. Loaded {len(self.dataset)} + items. Initialized {len(self.accessibility_rules)} accessibility rules.""") async def get_next_item(self) -> Optional[Item]: if self.iter >= len(self.dataset): @@ -288,10 +286,8 @@ class AccessibilityEnv(BaseEnv): self.tokenizer, full_exchange_messages_list_of_dicts ) except Exception as e: - print( - f"""[{self.name}] Error during tokenization for item - {original_info.get('id', 'N/A')}: {e}. Skipping this item.""" - ) + print(f"""[{self.name}] Error during tokenization for item + {original_info.get('id', 'N/A')}: {e}. Skipping this item.""") continue # Skip to the next data_item in rollout_group_data if "tokens" not in tokenized_output or "masks" not in tokenized_output: @@ -317,10 +313,8 @@ class AccessibilityEnv(BaseEnv): if ( not final_scores_batch ): # If all items were skipped (e.g., due to tokenization errors) - print( - f"""[{self.name}] No valid items to include in ScoredDataGroup - after processing all rollouts, returning None.""" - ) + print(f"""[{self.name}] No valid items to include in ScoredDataGroup + after processing all rollouts, returning None.""") return None data_to_return: ScoredDataGroup = { diff --git a/environments/community/dynastai/dynastai_local_server.py b/environments/community/dynastai/dynastai_local_server.py index 71ab5457..01bf0ad1 100755 --- a/environments/community/dynastai/dynastai_local_server.py +++ b/environments/community/dynastai/dynastai_local_server.py @@ -98,8 +98,7 @@ def main(): if not os.path.exists(html_file): with open(html_file, "w") as f: - f.write( - """ + f.write(""" @@ -181,13 +180,11 @@ def main(): - """ - ) + """) if not os.path.exists(css_file): with open(css_file, "w") as f: - f.write( - """ + f.write(""" :root { --power-color: #e74c3c; --stability-color: #2ecc71; @@ -363,13 +360,11 @@ footer { justify-content: center; margin-top: 20px; } - """ - ) + """) if not os.path.exists(js_file): with open(js_file, "w") as f: - f.write( - """ + f.write(""" // Constants const API_URL = 'http://localhost:9001/api'; let sessionId = null; @@ -828,8 +823,7 @@ window.addEventListener('load', async () => { cardText.textContent = "Cannot connect to game server. Please ensure the server is running."; } }); - """ - ) + """) # Start API server in a separate thread print(f"Starting API server on port {args.api_port}") diff --git a/environments/community/physical_space_stl/test_stl_env.py b/environments/community/physical_space_stl/test_stl_env.py index 824f0162..592602af 100644 --- a/environments/community/physical_space_stl/test_stl_env.py +++ b/environments/community/physical_space_stl/test_stl_env.py @@ -2,6 +2,7 @@ """ Test script for the PhysicalEnv that loads and processes STL files """ + import asyncio from physical_env import APIServerConfig, BaseEnvConfig, EvalHandlingEnum, PhysicalEnv diff --git a/environments/community/pytorch_optimizer_coding/FOB/pytorch_fob/tasks/tasks.py b/environments/community/pytorch_optimizer_coding/FOB/pytorch_fob/tasks/tasks.py index 1a226ff9..28c9c13c 100644 --- a/environments/community/pytorch_optimizer_coding/FOB/pytorch_fob/tasks/tasks.py +++ b/environments/community/pytorch_optimizer_coding/FOB/pytorch_fob/tasks/tasks.py @@ -84,10 +84,8 @@ class TaskDataModule(LightningDataModule): if not data: raise NotImplementedError("Each task has its own data set") if not self.batch_size or self.batch_size < 1: - raise NotImplementedError( - "Each task configures its own batch_size. \ - Please set it explicitly, to avoid confusion." - ) + raise NotImplementedError("Each task configures its own batch_size. \ + Please set it explicitly, to avoid confusion.") def train_dataloader(self): self.check_dataset(self.data_train) diff --git a/environments/community/pytorch_optimizer_coding/deploy.py b/environments/community/pytorch_optimizer_coding/deploy.py index 22494695..c1c21d30 100644 --- a/environments/community/pytorch_optimizer_coding/deploy.py +++ b/environments/community/pytorch_optimizer_coding/deploy.py @@ -92,8 +92,7 @@ def send_code(code: str): def main(): """Entrypoint for local execution. Accepts code as input.""" # Example usage: pass code as a string argument - return_obj = send_code.remote( - """ + return_obj = send_code.remote(""" import torch import math @@ -144,8 +143,7 @@ for step in range(20): print(f"Step {step + 1}: x = {x.item():.4f}, loss = {loss.item():.4f}") print(f"\\nOptimal x: {x.item():.4f}") -""" - ) +""") print("\n===== Optimizer Execution Result =====") print(f"Filename: {return_obj['filename']}") diff --git a/environments/community/pytorch_optimizer_coding/evaluator.py b/environments/community/pytorch_optimizer_coding/evaluator.py index f09d0fbf..acf4e146 100644 --- a/environments/community/pytorch_optimizer_coding/evaluator.py +++ b/environments/community/pytorch_optimizer_coding/evaluator.py @@ -34,8 +34,7 @@ class OptimizerEvaluator: categories=DiscreteScale(["yes", "no"]), explanation=False, ) - .prompt( - """ + .prompt(""" You are an expert code validator specializing in PyTorch optimizers. Your task is to determine if the provided optimizer code is completely valid and error-free. @@ -57,8 +56,7 @@ class OptimizerEvaluator: - "no" if ANY criterion fails or there are ANY potential issues Be extremely strict in your evaluation. - """ - ) + """) .via("xai/grok-3-latest", retries=2) ) diff --git a/environments/dataset_environment/launch_local_dataset_run.py b/environments/dataset_environment/launch_local_dataset_run.py index 2e95d05a..d949fe2e 100644 --- a/environments/dataset_environment/launch_local_dataset_run.py +++ b/environments/dataset_environment/launch_local_dataset_run.py @@ -14,6 +14,7 @@ Requirements: - Run from project root so example_trainer is on PYTHONPATH - example_trainer/ is a valid Python package (with __init__.py) """ + import atexit import os import signal diff --git a/environments/smolagents_integration/download_gaia.py b/environments/smolagents_integration/download_gaia.py index 7f271fdd..8158bcf3 100755 --- a/environments/smolagents_integration/download_gaia.py +++ b/environments/smolagents_integration/download_gaia.py @@ -64,8 +64,7 @@ def download_gaia_dataset(output_dir, use_raw=False): # Create a minimal GAIA.py that loads directly from metadata.jsonl using absolute paths with open(os.path.join(output_dir, "GAIA.py"), "w") as f: - f.write( - f''' + f.write(f''' """ GAIA benchmark dataset loader. Loads data directly from metadata.jsonl files. @@ -126,8 +125,7 @@ class GAIA(datasets.GeneratorBasedBuilder): # Ensure file paths include the 2023 directory and absolute path example["file_name"] = os.path.join("2023", split, example["file_name"]) yield i, example -''' - ) +''') # Verify the download worked by checking for key files validation_path = os.path.join(