Skip to content

Commit 0f72248

Browse files
committed
Camera.set_transform: do not eval strings.
It is possible to pass a string as transform which is then evaled. The expectation is that it's a tuple of 3 booleans. The support for strings was because Cockpit conf file is read as string but Cockpit is doing that parsing so this is no longer needed or desirable.
1 parent a8c1657 commit 0f72248

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

microscope/abc.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import threading
3030
import time
3131
import typing
32-
from ast import literal_eval
3332
from enum import EnumMeta
3433
from threading import Thread
3534

@@ -864,7 +863,7 @@ def _process_data(self, data):
864863
}[flips](data)
865864
return super()._process_data(data)
866865

867-
def get_transform(self):
866+
def get_transform(self) -> typing.Tuple[bool, bool, bool]:
868867
"""Return the current transform without readout transform."""
869868
return self._client_transform
870869

@@ -878,10 +877,8 @@ def _update_transform(self, transform):
878877
ud = not ud
879878
self._transform = (lr, ud, rot)
880879

881-
def set_transform(self, transform):
880+
def set_transform(self, transform: typing.Tuple[bool, bool, bool]) -> None:
882881
"""Set client transform and update resultant transform."""
883-
if isinstance(transform, str):
884-
transform = literal_eval(transform)
885882
self._client_transform = transform
886883
self._update_transform()
887884

0 commit comments

Comments
 (0)