Skip to content

Commit

Permalink
Linting: black, flake8, and isort.
Browse files Browse the repository at this point in the history
  • Loading branch information
canismarko committed Dec 6, 2024
1 parent cc35248 commit 75e2c1a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 22 deletions.
17 changes: 8 additions & 9 deletions src/firefly/queue_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import logging
import time
import warnings
from typing import Mapping, Optional

from bluesky_queueserver_api import comm_base
Expand Down Expand Up @@ -58,11 +56,13 @@ def queue_status(status_mapping: Mapping[str, str] = {}):
to_update["status_changed"] = (status,)
# Check individual status items to see if they've changed
status_diff = {
key: val for key, val in status.items()
key: val
for key, val in status.items()
if key not in last_status or val != last_status[key]
}
updated_params = {
status_mapping[key]: (val,) for key, val in status_diff.items()
status_mapping[key]: (val,)
for key, val in status_diff.items()
if key in status_mapping
}
to_update.update(updated_params)
Expand Down Expand Up @@ -97,7 +97,6 @@ class QueueClient(QObject):
"devices_allowed_uid": "devices_allowed_changed",
}


# Signals responding to queue changes
status_changed = Signal(dict)
length_changed = Signal(int)
Expand All @@ -122,7 +121,7 @@ def __init__(self, *args, api, **kwargs):
next(self.status) # Prime the generator

def start(self):
# Start the time so that it
# Start the time so that it
self.timer.start(int(self.timeout * 1000))

@asyncSlot(bool)
Expand Down Expand Up @@ -170,7 +169,7 @@ async def toggle_autostart(self, enable: bool):
self.check_result(result, task="toggle auto-start")
finally:
await self.update()

@asyncSlot(bool)
async def stop_queue(self, stop: bool):
"""Turn on/off whether the queue will stop after the current plan."""
Expand Down Expand Up @@ -255,9 +254,9 @@ async def queue_status(self) -> dict:
The response from the queueserver regarding its status. If
the queueserver is not reachable, then
``status['manager_state']`` will be ``"disconnected"``.
"""

try:
status = await self.api.status()
except comm_base.RequestTimeoutError as e:
Expand Down
4 changes: 1 addition & 3 deletions src/firefly/tests/test_queue_client.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import datetime as dt
import time
from unittest.mock import AsyncMock
from collections import ChainMap
from unittest.mock import AsyncMock

import pytest
from pytestqt.exceptions import TimeoutError
from qtpy.QtCore import QTimer
from qtpy.QtWidgets import QAction

from firefly import queue_client


qs_status = {
"msg": "RE Manager v0.0.18",
"items_in_queue": 0,
Expand Down
14 changes: 4 additions & 10 deletions src/queueserver/queueserver_startup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import logging
import re # noqa: F401
from functools import partial, wraps

import bluesky.preprocessors as bpp # noqa: F401
import databroker # noqa: F401
from bluesky.plan_stubs import abs_set
from bluesky.plan_stubs import abs_set # noqa: F401
from bluesky.plan_stubs import mv as _mv # noqa: F401
from bluesky.plan_stubs import mvr, null, pause, rel_set, sleep, stop
from bluesky.plan_stubs import mvr, null, pause, rel_set, sleep, stop # noqa: F401
from bluesky.plans import ( # noqa: F401
count,
grid_scan,
Expand Down Expand Up @@ -54,18 +53,13 @@
globals().setdefault(name, cpt)


from collections.abc import Hashable

# Workaround for https://github.com/bluesky/bluesky-queueserver/issues/310
from typing import Any, Optional, Union

from bluesky.protocols import Movable, NamedMovable, Status
from bluesky.utils import MsgGenerator
from collections.abc import Hashable


def mv(
*args,
group: Optional[Hashable] = None,
group: Hashable | None = None,
**kwargs,
):
"""
Expand Down

0 comments on commit 75e2c1a

Please sign in to comment.