Skip to content

Commit cd1016f

Browse files
committed
DOC: docstrings for 'restore' and 'compare' API groups
1 parent 19637c5 commit cd1016f

File tree

1 file changed

+49
-3
lines changed

1 file changed

+49
-3
lines changed

src/save_and_restore_api/_api_threads.py

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ def composite_snapshot_get_items(self, uniqueId):
799799
-------
800800
list[dict]
801801
List of snapshot items (PVs). The format is consistent with the format of
802-
``snapshotData["snapshotItems"]``
802+
``snapshotData["snapshotItems"]``.
803803
"""
804804
method, url = self._prepare_composite_snapshot_get_items(uniqueId=uniqueId)
805805
return self.send_request(method, url)
@@ -896,7 +896,8 @@ def composite_snapshot_consistency_check(self, uniqueNodeIds, *, auth=None):
896896
list[dict]
897897
List of conflicting PVs. Each PV is represented as a dictionary of parameters.
898898
If the list is empty, then there are no conflicts and the composite snapshot
899-
can be created or updated.
899+
can be created or updated. The format is consistent with the format of
900+
``snapshotData["snapshotItems"]``.
900901
"""
901902
method, url, body_json = self._prepare_composite_snapshot_consistency_check(uniqueNodeIds=uniqueNodeIds)
902903
return self.send_request(method, url, body_json=body_json, auth=auth)
@@ -908,10 +909,22 @@ def composite_snapshot_consistency_check(self, uniqueNodeIds, *, auth=None):
908909
def restore_node(self, nodeId, *, auth=None):
909910
"""
910911
Restore PVs based on the data from an existing snapshot node specified by nodeId.
911-
912912
Returns a list of snapshotItems that were NOT restored. Ideally the list should be empty.
913913
914914
API: POST /restore/node
915+
916+
Parameters
917+
----------
918+
nodeId : str
919+
Unique ID of the snapshot node.
920+
auth : httpx.BasicAuth, optional
921+
Object with authentication data (generated using ``auth_gen`` method).
922+
923+
Returns
924+
-------
925+
list[dict]
926+
List of snapshot items (PVs) that were NOT restored. The format is consistent with
927+
the format of ``snapshotData["snapshotItems"]``.
915928
"""
916929
method, url, params = self._prepare_restore_node(nodeId=nodeId)
917930
return self.send_request(method, url, params=params, auth=auth)
@@ -924,6 +937,20 @@ def restore_items(self, *, snapshotItems, auth=None):
924937
Returns a list of snapshotItems that were NOT restored. Ideally the list should be empty.
925938
926939
API: POST /restore/items
940+
941+
Parameters
942+
----------
943+
snapshotItems : list of dict
944+
List of snapshot items (PVs) to be restored. The format is consistent with
945+
the format of ``snapshotData["snapshotItems"]``.
946+
auth : httpx.BasicAuth, optional
947+
Object with authentication data (generated using ``auth_gen`` method).
948+
949+
Returns
950+
-------
951+
list[dict]
952+
List of snapshot items (PVs) that were NOT restored. The format is consistent with
953+
the format of ``snapshotData["snapshotItems"]``.
927954
"""
928955
method, url, body_json = self._prepare_restore_items(snapshotItems=snapshotItems)
929956
return self.send_request(method, url, body_json=body_json, auth=auth)
@@ -939,6 +966,25 @@ def compare(self, nodeId, *, tolerance=None, compareMode=None, skipReadback=None
939966
the snapshot.
940967
941968
API: GET /compare/{nodeId}
969+
970+
Parameters
971+
----------
972+
nodeId : str
973+
Unique ID of the snapshot or composite snapshot node.
974+
tolerance : float, optional
975+
Tolerance for numerical comparisons. If not specified or None, the default is 0.
976+
compareMode : str, optional
977+
Comparison mode. Supported values: ``"ABSOLUTE"``, ``"RELATIVE"``.
978+
skipReadback : bool, optional
979+
If True, then ``pvName`` live value is used for PVs with specified ``readbackPvName``.
980+
If not specified, then the default is False and the readback PV is used for comparison.
981+
982+
Returns
983+
-------
984+
list[dict]
985+
List of comparison results for each PV in the snapshot. Each PV is represented as a
986+
dictionary with the following keys: ``pvName``, ``equal``, ``compare``, ``storedValue``,
987+
``liveValue``.
942988
"""
943989
method, url, params = self._prepare_compare(
944990
nodeId=nodeId, tolerance=tolerance, compareMode=compareMode, skipReadback=skipReadback

0 commit comments

Comments
 (0)