Skip to content

Commit 86a537a

Browse files
committed
maint: run black version 22.3.0 (latest).
1 parent 22b0219 commit 86a537a

File tree

13 files changed

+71
-37
lines changed

13 files changed

+71
-37
lines changed

microscope/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323

2424
class MicroscopeError(Exception):
25-
"""Base class for Python Microscope exceptions.
26-
"""
25+
"""Base class for Python Microscope exceptions."""
2726

2827
pass
2928

@@ -136,7 +135,7 @@ class AxisLimits(typing.NamedTuple):
136135

137136

138137
class Binning(typing.NamedTuple):
139-
"""A tuple containing parameters for horizontal and vertical binning. """
138+
"""A tuple containing parameters for horizontal and vertical binning."""
140139

141140
h: int
142141
v: int

microscope/abc.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,7 @@ def trigger_type(self) -> microscope.TriggerType:
247247
def set_trigger(
248248
self, ttype: microscope.TriggerType, tmode: microscope.TriggerMode
249249
) -> None:
250-
"""Set device for a specific trigger.
251-
"""
250+
"""Set device for a specific trigger."""
252251
raise NotImplementedError()
253252

254253
@abc.abstractmethod
@@ -960,7 +959,7 @@ def _get_roi(self) -> microscope.ROI:
960959
raise NotImplementedError()
961960

962961
def get_roi(self) -> microscope.ROI:
963-
"""Return current ROI. """
962+
"""Return current ROI."""
964963
roi = self._get_roi()
965964
if self._transform[2]:
966965
# 90 degree rotation
@@ -1015,8 +1014,7 @@ def __init__(self, **kwargs):
10151014
self._comms_lock = threading.RLock()
10161015

10171016
def _readline(self) -> bytes:
1018-
"""Read a line from connection without leading and trailing whitespace.
1019-
"""
1017+
"""Read a line from connection without leading and trailing whitespace."""
10201018
return self.connection.readline().strip()
10211019

10221020
def _write(self, command: bytes) -> int:

microscope/cameras/andorsdk3.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ def wrapper(self, *args, **kwargs):
206206

207207

208208
class AndorSDK3(
209-
microscope.abc.FloatingDeviceMixin, microscope.abc.Camera,
209+
microscope.abc.FloatingDeviceMixin,
210+
microscope.abc.Camera,
210211
):
211212
SDK_INITIALIZED = False
212213

microscope/cameras/atmcd.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,8 @@ def __str__(self):
13621362

13631363

13641364
class AndorAtmcd(
1365-
microscope.abc.FloatingDeviceMixin, microscope.abc.Camera,
1365+
microscope.abc.FloatingDeviceMixin,
1366+
microscope.abc.Camera,
13661367
):
13671368
"""Implements CameraDevice interface for Andor ATMCD library."""
13681369

microscope/cameras/pvcam.py

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,15 @@ def dllFunc(name, args=[], argnames=[], buf_len=0):
839839
["can_num", "cam_name"],
840840
buf_len=CAM_NAME_LEN,
841841
)
842-
dllFunc("pl_cam_get_total", [OUTPUT(int16),], ["total_cams",])
842+
dllFunc(
843+
"pl_cam_get_total",
844+
[
845+
OUTPUT(int16),
846+
],
847+
[
848+
"total_cams",
849+
],
850+
)
843851
dllFunc(
844852
"pl_cam_open",
845853
[STRING, OUTPUT(int16), int16],
@@ -890,24 +898,42 @@ def dllFunc(name, args=[], argnames=[], buf_len=0):
890898
[int16, uns32, uns32, OUTPUT(uns32)],
891899
["hcam", "param_id", "index", "length"],
892900
)
893-
dllFunc("pl_pp_reset", [int16,], ["hcam"])
901+
dllFunc(
902+
"pl_pp_reset",
903+
[
904+
int16,
905+
],
906+
["hcam"],
907+
)
894908
dllFunc(
895909
"pl_create_smart_stream_struct",
896910
[OUTPUT(smart_stream_type), uns16],
897911
["pSmtStruct", "entries"],
898912
)
899913
dllFunc(
900914
"pl_release_smart_stream_struct",
901-
[ctypes.POINTER(smart_stream_type),],
902-
["pSmtStruct",],
915+
[
916+
ctypes.POINTER(smart_stream_type),
917+
],
918+
[
919+
"pSmtStruct",
920+
],
903921
)
904922
dllFunc(
905-
"pl_create_frame_info_struct", [OUTPUT(FRAME_INFO),], ["pNewFrameInfo"]
923+
"pl_create_frame_info_struct",
924+
[
925+
OUTPUT(FRAME_INFO),
926+
],
927+
["pNewFrameInfo"],
906928
)
907929
dllFunc(
908930
"pl_release_frame_info_struct",
909-
[ctypes.POINTER(FRAME_INFO),],
910-
["pFrameInfoToDel",],
931+
[
932+
ctypes.POINTER(FRAME_INFO),
933+
],
934+
[
935+
"pFrameInfoToDel",
936+
],
911937
)
912938
dllFunc("pl_exp_abort", [int16, int16], ["hcam", "cam_state"])
913939
dllFunc(
@@ -1370,7 +1396,8 @@ def values(self):
13701396

13711397

13721398
class PVCamera(
1373-
microscope.abc.FloatingDeviceMixin, microscope.abc.Camera,
1399+
microscope.abc.FloatingDeviceMixin,
1400+
microscope.abc.Camera,
13741401
):
13751402
"""Implements the CameraDevice interface for the pvcam library."""
13761403

microscope/controllers/zaber.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060

6161
class _ZaberReply:
62-
"""Wraps a Zaber reply to easily index its multiple fields. """
62+
"""Wraps a Zaber reply to easily index its multiple fields."""
6363

6464
def __init__(self, data: bytes) -> None:
6565
self._data = data
@@ -351,18 +351,20 @@ def axes(self) -> typing.Mapping[str, microscope.abc.StageAxis]:
351351
return self._axes
352352

353353
def move_by(self, delta: typing.Mapping[str, float]) -> None:
354-
"""Move specified axes by the specified distance. """
354+
"""Move specified axes by the specified distance."""
355355
for axis_name, axis_delta in delta.items():
356356
self._dev_conn.move_by_relative_position(
357-
int(axis_name), int(axis_delta),
357+
int(axis_name),
358+
int(axis_delta),
358359
)
359360
self._dev_conn.wait_until_idle()
360361

361362
def move_to(self, position: typing.Mapping[str, float]) -> None:
362-
"""Move specified axes by the specified distance. """
363+
"""Move specified axes by the specified distance."""
363364
for axis_name, axis_position in position.items():
364365
self._dev_conn.move_to_absolute_position(
365-
int(axis_name), int(axis_position),
366+
int(axis_name),
367+
int(axis_position),
366368
)
367369
self._dev_conn.wait_until_idle()
368370

@@ -441,7 +443,11 @@ def __init__(self, dev_conn: _ZaberDeviceConnection, channel: int) -> None:
441443
)
442444
value = float(reply.response)
443445
self.add_setting(
444-
our_name, "float", lambda x=value: x, None, values=tuple(),
446+
our_name,
447+
"float",
448+
lambda x=value: x,
449+
None,
450+
values=tuple(),
445451
)
446452

447453
def _do_shutdown(self) -> None:

microscope/lights/toptica.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def _get_max_power_mw(self) -> float:
257257
return self._max_power
258258

259259
def _get_power_mw(self) -> float:
260-
return self._conn.show_power_uW() * (10 ** -3)
260+
return self._conn.show_power_uW() * (10**-3)
261261

262262
def _set_power_mw(self, mw: float) -> None:
263263
self._conn.set_normal_channel_power(mw)

microscope/simulators/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def one_gaussian(self, w, h, dark, light):
138138
y0 = np.random.randint(h)
139139
xx, yy = np.meshgrid(range(w), range(h))
140140
return dark + light * np.exp(
141-
-((xx - x0) ** 2 + (yy - y0) ** 2) / (2 * sigma ** 2)
141+
-((xx - x0) ** 2 + (yy - y0) ** 2) / (2 * sigma**2)
142142
)
143143

144144
def sawtooth(self, w, h, dark, light):

microscope/testsuite/devices.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from enum import IntEnum
2424

2525
import microscope.abc
26+
2627
# These classes were originally in testsuite but have been moved to
2728
# their own subpackage, these imports are for backwards compatibility.
2829
from microscope.simulators import (

microscope/testsuite/mock_devices.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,7 @@ def handle(self, command):
314314

315315

316316
class CoboltLaserMock(SerialMock):
317-
"""Modelled after a Cobolt Jive laser 561nm.
318-
"""
317+
"""Modelled after a Cobolt Jive laser 561nm."""
319318

320319
eol = b"\r"
321320

@@ -473,8 +472,7 @@ def handle(self, command):
473472

474473

475474
class OmicronDeepstarLaserMock(SerialMock):
476-
"""Modelled after a TA Deepstar 488nm.
477-
"""
475+
"""Modelled after a TA Deepstar 488nm."""
478476

479477
eol = b"\r\n"
480478

0 commit comments

Comments
 (0)