Skip to content

Commit

Permalink
Black, isort, and flake8.
Browse files Browse the repository at this point in the history
  • Loading branch information
canismarko committed Oct 16, 2024
1 parent b52b528 commit ac527ae
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/firefly/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import pydm
import pyqtgraph as pg
import qtawesome as qta
from ophydregistry import Registry
from ophyd_async.core import NotConnected
from ophydregistry import Registry
from qasync import asyncSlot
from qtpy import QtCore, QtWidgets
from qtpy.QtCore import Signal
Expand Down Expand Up @@ -110,7 +110,9 @@ async def setup_instrument(self, load_instrument=True):
await beamline.load()
except NotConnected as exc:
log.exception(exc)
msg = "One or more devices failed to load. See console logs for details."
msg = (
"One or more devices failed to load. See console logs for details."
)
self.error_message.showMessage(msg)
self.registry_changed.emit(beamline.registry)
# Make actions for launching other windows
Expand Down
10 changes: 8 additions & 2 deletions src/haven/positioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ def set_name(self, name: str):
# Readback should be named the same as its parent in read()
self.readback.set_name(name)

def watch_done(self, value, done_event: asyncio.Event, started_event: asyncio.Event):
def watch_done(
self, value, done_event: asyncio.Event, started_event: asyncio.Event
):
"""Update the event when the done value is actually done."""
print(f"Received new done value: {value}.")
if value != self.done_value:
Expand Down Expand Up @@ -96,7 +98,11 @@ async def set(self, value: float, timeout: CalculatableTimeout = CALCULATE_TIMEO
elif hasattr(self, "done"):
# Monitor the `done` signal
print(f"Monitoring progress via ``done`` signal: {self.done.name}.")
self.done.subscribe_value(partial(self.watch_done, done_event=done_event, started_event=started_event))
self.done.subscribe_value(
partial(
self.watch_done, done_event=done_event, started_event=started_event
)
)
done_status = AsyncStatus(asyncio.wait_for(done_event.wait(), timeout))
else:
# Monitor based on readback position
Expand Down
2 changes: 1 addition & 1 deletion src/haven/tests/test_energy_positioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async def test_set_energy(positioner):
# Trick the Undulator into being done
set_mock_value(positioner.undulator.energy.done, BusyStatus.BUSY)
await asyncio.sleep(0.01) # Let the event loop run
set_mock_value(positioner.undulator.energy.done, BusyStatus.DONE)
set_mock_value(positioner.undulator.energy.done, BusyStatus.DONE)
await status
# Check that all the sub-components were set properly
assert await positioner.monochromator.energy.user_setpoint.get_value() == 10000
Expand Down
2 changes: 1 addition & 1 deletion src/haven/tests/test_xray_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
from ophyd_async.core import get_mock_put, set_mock_value

from haven.devices.xray_source import PlanarUndulator, BusyStatus
from haven.devices.xray_source import BusyStatus, PlanarUndulator


@pytest.fixture()
Expand Down

0 comments on commit ac527ae

Please sign in to comment.