Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pyaml/common/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()}"

Expand Down
2 changes: 1 addition & 1 deletion pyaml/magnet/magnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion pyaml/tuning_tools/measurement_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading