Skip to content

Commit

Permalink
Make linters happy
Browse files Browse the repository at this point in the history
  • Loading branch information
rtuck99 committed Oct 17, 2024
1 parent 7f76b7a commit 3739ed4
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import time
from datetime import datetime, timedelta, timezone
from datetime import UTC, datetime, timedelta

import numpy as np
from dodal.devices.detector import DetectorParams
Expand Down Expand Up @@ -93,7 +93,7 @@ def create_goniometer_axes(

def get_start_and_predicted_end_time(time_expected: float) -> tuple[str, str]:
time_format = r"%Y-%m-%dT%H:%M:%SZ"
start = datetime.fromtimestamp(time.time(), tz=timezone.utc)
start = datetime.fromtimestamp(time.time(), tz=UTC)
end_est = start + timedelta(seconds=time_expected)
return start.strftime(time_format), end_est.strftime(time_format)

Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import numpy
import numpy as np
import pytest
from bluesky.protocols import Movable, Status
from bluesky.run_engine import RunEngine
from bluesky.simulators import RunEngineSimulator
from bluesky.utils import Msg
Expand Down
1 change: 0 additions & 1 deletion tests/unit_tests/beamlines/i04/test_thawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ def test_thaw_and_stream_adds_murko_callback_and_produces_expected_messages(
RE: RunEngine,
):
patch_murko_instance = patch_murko_callback.return_value
from bluesky.protocols import Locatable
RE(
thaw_and_stream_to_redis(
10,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from datetime import datetime
from ophyd_async.fastcs.panda import HDFPanda
from unittest.mock import MagicMock, patch

import numpy as np
Expand All @@ -9,7 +8,7 @@
from bluesky.simulators import RunEngineSimulator, assert_message_and_return_remaining
from dodal.common.types import UpdatingPathProvider
from dodal.devices.fast_grid_scan import PandAGridScanParams
from ophyd_async.fastcs.panda import SeqTable, SeqTrigger
from ophyd_async.fastcs.panda import HDFPanda, SeqTable, SeqTrigger

from mx_bluesky.hyperion.device_setup_plans.setup_panda import (
MM_TO_ENCODER_COUNTS,
Expand All @@ -28,7 +27,7 @@ def run_simulating_setup_panda_functions(
plan: str,
panda: HDFPanda,
sim_run_engine: RunEngineSimulator,
mock_load_device=MagicMock
mock_load_device=MagicMock,
):
num_of_sets = 0
num_of_waits = 0
Expand Down Expand Up @@ -184,8 +183,7 @@ def test_setup_panda_correctly_configures_table(
)


def test_wait_between_setting_table_and_arming_panda(RE: RunEngine,
panda):
def test_wait_between_setting_table_and_arming_panda(RE: RunEngine, panda):
bps_wait_done = False

def handle_wait(*args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/hyperion/device_setup_plans/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from bluesky import plan_stubs as bps
from bluesky.utils import FailedStatus
from dodal.beamlines import i03
from ophyd_async.core import get_mock_put
from ophyd.status import Status
from ophyd_async.core import get_mock_put

from mx_bluesky.hyperion.device_setup_plans.utils import (
start_preparing_data_collection_then_do_plan,
Expand Down
11 changes: 7 additions & 4 deletions tests/unit_tests/hyperion/experiment_plans/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

import pytest
from bluesky.utils import Msg

from dodal.devices.aperturescatterguard import ApertureValue, ApertureScatterguard
from dodal.devices.aperturescatterguard import ApertureScatterguard, ApertureValue
from dodal.devices.backlight import Backlight
from dodal.devices.detector.detector_motion import DetectorMotion
from dodal.devices.fast_grid_scan import ZebraFastGridScan
Expand All @@ -17,7 +16,9 @@
from ophyd.sim import NullStatus
from ophyd_async.core import AsyncStatus, DeviceCollector, set_mock_value

from mx_bluesky.hyperion.experiment_plans.grid_detect_then_xray_centre_plan import GridDetectThenXRayCentreComposite
from mx_bluesky.hyperion.experiment_plans.grid_detect_then_xray_centre_plan import (
GridDetectThenXRayCentreComposite,
)
from mx_bluesky.hyperion.experiment_plans.robot_load_and_change_energy import (
RobotLoadAndEnergyChangeComposite,
)
Expand Down Expand Up @@ -224,7 +225,9 @@ def fake_read(obj, initial_positions, _):


@pytest.fixture
def simple_beamline(detector_motion, eiger, oav, smargon, synchrotron, test_config_files, dcm):
def simple_beamline(
detector_motion, eiger, oav, smargon, synchrotron, test_config_files, dcm
):
magic_mock = MagicMock(autospec=True)

with DeviceCollector(mock=True):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
from bluesky.run_engine import RunEngine
from bluesky.simulators import RunEngineSimulator, assert_message_and_return_remaining
from bluesky.utils import Msg
from dodal.devices.aperturescatterguard import ApertureScatterguard, ApertureValue
from dodal.devices.backlight import Backlight, BacklightPosition
from dodal.devices.aperturescatterguard import ApertureValue
from dodal.devices.backlight import BacklightPosition
from dodal.devices.detector.detector_motion import ShutterState
from dodal.devices.smargon import Smargon
from dodal.devices.synchrotron import SynchrotronMode
from mx_bluesky.hyperion.experiment_plans.grid_detect_then_xray_centre_plan import GridDetectThenXRayCentreComposite

from mx_bluesky.hyperion.experiment_plans.grid_detect_then_xray_centre_plan import (
GridDetectThenXRayCentreComposite,
)
from mx_bluesky.hyperion.experiment_plans.pin_centre_then_xray_centre_plan import (
create_parameters_for_grid_detection,
pin_centre_then_xray_centre_plan,
Expand Down Expand Up @@ -58,7 +60,9 @@ def test_when_pin_centre_xray_centre_called_then_plan_runs_correctly(
RE = RunEngine()
RE(
pin_centre_then_xray_centre_plan(
grid_detect_devices, test_pin_centre_then_xray_centre_params, test_config_files
grid_detect_devices,
test_pin_centre_then_xray_centre_params,
test_config_files,
)
)

Expand Down

0 comments on commit 3739ed4

Please sign in to comment.