diff --git a/pyaml/common/element.py b/pyaml/common/element.py index f323f25a..11ab1f02 100644 --- a/pyaml/common/element.py +++ b/pyaml/common/element.py @@ -16,7 +16,7 @@ def __pyaml_repr__(obj): if isinstance(obj, Element): return repr(obj._cfg).replace( "ConfigModel(", - obj.__class__.__name__ + "(peer='" + obj.get_peer_name() + "', ", + obj.__class__.__name__ + "(peer='" + obj.attached_to() + "', ", ) else: # no peer @@ -124,9 +124,9 @@ def peer(self) -> "ElementHolder": """ return self._peer - def get_peer_name(self) -> str: + def attached_to(self) -> str: """ - Returns a string representation of peer simulator or control system + Returns a string of which peer the element is attached to. """ return "None" if self._peer is None else f"{self._peer.__class__.__name__}:{self._peer.name()}" diff --git a/pyaml/magnet/magnet.py b/pyaml/magnet/magnet.py index d98b5ca7..2dca34c9 100644 --- a/pyaml/magnet/magnet.py +++ b/pyaml/magnet/magnet.py @@ -116,7 +116,7 @@ def get_model_name(self) -> str: def __repr__(self): return "%s(peer='%s', name='%s', model_name='%s', magnet_model=%s)" % ( self.__class__.__name__, - self.get_peer_name(), + self.attached_to(), self.get_name(), self.__modelName, repr(self.__model), diff --git a/pyaml/tuning_tools/measurement_tool.py b/pyaml/tuning_tools/measurement_tool.py index e2e40955..09c3d772 100644 --- a/pyaml/tuning_tools/measurement_tool.py +++ b/pyaml/tuning_tools/measurement_tool.py @@ -153,7 +153,7 @@ def callback(action: Action, data: dict): ok = True if self._callback is not None: # Add source and peer - cb_data["mode"] = f"{self.get_peer_name()}" + cb_data["mode"] = f"{self.attached_to()}" cb_data["source"] = self ok = self._callback(action, cb_data) if not ok and raiseException: