f2408b719c991b98ba5dc77db81dc184805b33df,rllib/env/pettingzoo_env.py,PettingZooEnv,step,#PettingZooEnv#Any#,141

Before Change


        for agent in self.agents:

            // Execute only for agents that have not been done in previous steps
            if agent in action_dict.keys():
                if not env_done:
                    assert agent == self.aec_env.agent_selection, \
                        f"environment has a nontrivial ordering, and " \
                        "cannot be used with the POMGameEnv wrapper\"" \
                        "nCurrent agent: {self.aec_env.agent_selection}" \
                        "\nExpected agent: {agent}"
                    // Execute agent action in environment
                    self.obs[agent] = self.aec_env.step(
                        action_dict[agent], observe=True)
                    if all(self.aec_env.dones.values()):
                        env_done = True
                        self.dones["__all__"] = True
                else:
                    self.obs[agent] = self.aec_env.observe(agent)
                // Get reward
                self.rewards[agent] = self.aec_env.rewards[agent]
                // Update done status
                self.dones[agent] = self.aec_env.dones[agent]

            // For agents with done = True, remove from dones, rewards and
            // observations.
            else:
                del self.dones[agent]
                del self.rewards[agent]
                del self.obs[agent]
                del self.infos[agent]

        // update self.agents
        self.agents = list(action_dict.keys())

        // Update infos stepwise
        for agent in self.agents:

After Change


            infos (dict): Optional info values for each agent id.
        
        stepped_agents = set()
        while self.aec_env.agent_selection not in stepped_agents:
            agent = self.aec_env.agent_selection
            assert agent in action_dict, \
                "Live environment agent is not in actions dictionary"
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: ray-project/ray
Commit Name: f2408b719c991b98ba5dc77db81dc184805b33df
Time: 2020-09-17
Author: weepingwillowben@gmail.com
File Name: rllib/env/pettingzoo_env.py
Class Name: PettingZooEnv
Method Name: step


Project Name: chainer/chainercv
Commit Name: 1cd87b67822c94c49d30ce1eabce792b3db7c272
Time: 2017-06-14
Author: yuyuniitani@gmail.com
File Name: chainercv/links/model/vgg/vgg.py
Class Name: VGG16Layers
Method Name: __init__


Project Name: ray-project/ray
Commit Name: 1d532d1cb8b829bdf7055a22c206032ca0b72e46
Time: 2020-04-02
Author: rkooo567@gmail.com
File Name: python/ray/dashboard/metrics_exporter/schema.py
Class Name: BaseModel
Method Name: parse_obj