From f5e4e686eea91dbdc8e5ee750285d1b77c336346 Mon Sep 17 00:00:00 2001 From: haosenwang1018 Date: Tue, 24 Feb 2026 21:43:09 +0000 Subject: [PATCH] style: use 'is None' instead of '== None' per PEP 8 PEP 8 recommends using 'is None' / 'is not None' for singleton comparisons since None is a singleton object. Using '==' can give unexpected results if __eq__ is overridden. Files changed: - autoagent/tools/meta/edit_workflow.py - constant.py - evaluation/math500/run_infer.py --- autoagent/tools/meta/edit_workflow.py | 2 +- constant.py | 2 +- evaluation/math500/run_infer.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/autoagent/tools/meta/edit_workflow.py b/autoagent/tools/meta/edit_workflow.py index 99b8bd9..67131bf 100644 --- a/autoagent/tools/meta/edit_workflow.py +++ b/autoagent/tools/meta/edit_workflow.py @@ -128,7 +128,7 @@ def single_event_to_code(event: dict, agent_info_dict: dict) -> str: - listen (list[str]): the listen to the event - agent (dict): the agent to run """ - if event["listen"] == None or len(event["listen"]) == 0: + if event["listen"] is None or len(event["listen"]) == 0: event_method = "make_event" else: event_method = "listen_group([{}])".format(", ".join(event["listen"])) diff --git a/constant.py b/constant.py index ba72a2b..ef38ce7 100644 --- a/constant.py +++ b/constant.py @@ -11,7 +11,7 @@ def str_to_bool(value): if isinstance(value, bool): return value - if value == None: + if value is None: return None value = str(value).lower().strip() diff --git a/evaluation/math500/run_infer.py b/evaluation/math500/run_infer.py index 507e4d4..5a28514 100644 --- a/evaluation/math500/run_infer.py +++ b/evaluation/math500/run_infer.py @@ -33,7 +33,7 @@ async def run_inference(item, save_dir, workflow): if workflow == "majority_voting": answer = await majority_voting(prompt) - elif workflow == None: + elif workflow is None: agent = get_math_solver_agent(model="deepseek/deepseek-chat") client = MetaChain() messages = [ @@ -93,7 +93,7 @@ async def main(args): print(f"Total number of items to process: {len(test_dataset)}") - if args.workflow == None: + if args.workflow is None: save_dir = os.path.join(args.save_dir, "math_solver") save_dir = Path(save_dir) save_dir.mkdir(parents=True, exist_ok=True)