From 5ac2d05a45b14d25b8dcaa06479cbb524fa53c65 Mon Sep 17 00:00:00 2001 From: Teresia Olsson Date: Thu, 7 May 2026 17:43:01 +0200 Subject: [PATCH 1/2] Change name of get_peer_name to attached_to. --- pyaml/common/element.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyaml/common/element.py b/pyaml/common/element.py index f323f25a..8a2beb0f 100644 --- a/pyaml/common/element.py +++ b/pyaml/common/element.py @@ -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()}" From 3df8423e8e8672ef4883bb2745b802a9c056f365 Mon Sep 17 00:00:00 2001 From: Teresia Olsson Date: Thu, 7 May 2026 18:09:27 +0200 Subject: [PATCH 2/2] Change get_peer_name to attached_to. --- pyaml/common/element.py | 2 +- pyaml/magnet/magnet.py | 2 +- pyaml/tuning_tools/measurement_tool.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyaml/common/element.py b/pyaml/common/element.py index 8a2beb0f..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 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: