f9540d6da262c88cd4dfa2c3d9e8c2e570ea2f11,mushroom_rl/algorithms/agent.py,Agent,save,#Agent#Any#,130

Before Change


        )
        self._save_pickle(PurePath(path, "agent.config"), agent_config)

        for att, method in self._save_attributes.items():
            attribute = getattr(self, att) if hasattr(self, att) else None
            save_method = getattr(self, "_save_{}".format(method)) if hasattr(
                self, "_save_{}".format(method)) else None
            if attribute is None:
                continue
            elif save_method is None:
                raise NotImplementedError(
                    "Method _save_{} is not implemented for class "{}"".format(
                        method, self.__class__.__name__)
                )
            else:
                save_method(PurePath(path, "{}.{}".format(att, method)),
                            attribute)

    def copy(self):
        
        Returns:
             A deepcopy of the agent.

After Change


        path = Path(path)
        path.parent.mkdir(parents=True, exist_ok=True)

        with ZipFile(path, "w") as zip_file:
            agent_config = dict(
                type=type(self),
                save_attributes=self._save_attributes
            )

            self._save_pickle(zip_file, "agent.config", agent_config)

            for att, method in self._save_attributes.items():
                attribute = getattr(self, att) if hasattr(self, att) else None
                save_method = getattr(self, "_save_{}".format(method)) if hasattr(
                    self, "_save_{}".format(method)) else None
                if attribute is None:
                    continue
                elif save_method is None:
                    raise NotImplementedError(
                        "Method _save_{} is not implemented for class "{}"".format(
                            method, self.__class__.__name__)
                    )
                else:
                    file_name = "{}.{}".format(att, method)
                    save_method(zip_file, file_name, attribute)

    def copy(self):
        
        Returns:
             A deepcopy of the agent.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: AIRLab-POLIMI/mushroom
Commit Name: f9540d6da262c88cd4dfa2c3d9e8c2e570ea2f11
Time: 2020-04-21
Author: boris.ilpossente@hotmail.it
File Name: mushroom_rl/algorithms/agent.py
Class Name: Agent
Method Name: save


Project Name: AIRLab-POLIMI/mushroom
Commit Name: f9540d6da262c88cd4dfa2c3d9e8c2e570ea2f11
Time: 2020-04-21
Author: boris.ilpossente@hotmail.it
File Name: mushroom_rl/algorithms/agent.py
Class Name: Agent
Method Name: load


Project Name: chainer/chainerrl
Commit Name: ccc751710226ec72b38eee46dbf5bb29946c9ac9
Time: 2019-10-02
Author: prabhat.nagarajan@gmail.com
File Name: chainerrl/misc/pretrained_models.py
Class Name:
Method Name: download_and_store_model