From b0ac96cede37600f149c1625a9d7bf78feff34cd Mon Sep 17 00:00:00 2001 From: rht Date: Thu, 11 Jan 2024 17:49:58 -0500 Subject: [PATCH] fix: Use new API to loop over agents_by_type --- examples/sugarscape_g1mt/sugarscape_g1mt/model.py | 2 +- examples/wolf_sheep/wolf_sheep/scheduler.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/sugarscape_g1mt/sugarscape_g1mt/model.py b/examples/sugarscape_g1mt/sugarscape_g1mt/model.py index ae93ac4df..2cba53d17 100644 --- a/examples/sugarscape_g1mt/sugarscape_g1mt/model.py +++ b/examples/sugarscape_g1mt/sugarscape_g1mt/model.py @@ -153,7 +153,7 @@ def step(self): and then randomly activates traders """ # step Resource agents - for resource in self.schedule.agents_by_type[Resource].values(): + for resource in self.schedule.agents_by_type[Resource]: resource.step() # step trader agents diff --git a/examples/wolf_sheep/wolf_sheep/scheduler.py b/examples/wolf_sheep/wolf_sheep/scheduler.py index 4279de716..9a7c7d7b2 100644 --- a/examples/wolf_sheep/wolf_sheep/scheduler.py +++ b/examples/wolf_sheep/wolf_sheep/scheduler.py @@ -23,7 +23,7 @@ def get_type_count( that satisfy the filter function. """ count = 0 - for agent in self.agents_by_type[type_class].values(): + for agent in self.agents_by_type[type_class]: if filter_func is None or filter_func(agent): count += 1 return count