Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
(#1218) Make pyright happy
Browse files Browse the repository at this point in the history
  • Loading branch information
rtuck99 committed Apr 8, 2024
1 parent 0f08072 commit 5b83260
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/hyperion/external_interaction/nexus/nexus_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,6 @@ def create_beam_and_attenuator_parameters(
"""
return (
# TODO 1173 Get this data from events rather than ispyb_params
Beam(convert_eV_to_angstrom(energy_kev * 1000), flux),
Attenuator(transmission_fraction),
Beam(convert_eV_to_angstrom(energy_kev * 1000), flux), # pyright: ignore
Attenuator(transmission_fraction), # pyright: ignore
)
Original file line number Diff line number Diff line change
Expand Up @@ -335,18 +335,20 @@ def test_ispyb_deposition_in_rotation_plan(
test_rotation_params.hyperion_params.ispyb_params.beam_size_y = test_bs_y
test_rotation_params.hyperion_params.detector_params.exposure_time = test_exp_time
energy_ev = convert_angstrom_to_eV(test_wl)
fake_create_rotation_devices.dcm.energy_in_kev.user_readback.sim_put(
fake_create_rotation_devices.dcm.energy_in_kev.user_readback.sim_put( # pyright: ignore
energy_ev / 1000
)
fake_create_rotation_devices.undulator.current_gap.sim_put(1.12)
fake_create_rotation_devices.synchrotron.machine_status.synchrotron_mode.sim_put(
fake_create_rotation_devices.synchrotron.machine_status.synchrotron_mode.sim_put( # pyright: ignore
test_synchrotron_mode.value
)
fake_create_rotation_devices.synchrotron.top_up.start_countdown.sim_put(-1)
fake_create_rotation_devices.s4_slit_gaps.xgap.user_readback.sim_put(
fake_create_rotation_devices.synchrotron.top_up.start_countdown.sim_put( # pyright: ignore
-1
)
fake_create_rotation_devices.s4_slit_gaps.xgap.user_readback.sim_put( # pyright: ignore
test_slit_gap_horiz
)
fake_create_rotation_devices.s4_slit_gaps.ygap.user_readback.sim_put(
fake_create_rotation_devices.s4_slit_gaps.ygap.user_readback.sim_put( # pyright: ignore
test_slit_gap_vert
)
test_rotation_params.hyperion_params.detector_params.expected_energy_ev = energy_ev
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,16 @@ def test_read_hardware_for_ispyb_updates_from_ophyd_devices(
fake_fgs_composite.aperture_scatterguard,
)
)
# fmt: off
assert_event(
test_ispyb_callback.activity_gated_start.mock_calls[0],
test_ispyb_callback.activity_gated_start.mock_calls[0], # pyright: ignore
{
"plan_name": "standalone_read_hardware_for_ispyb",
"subplan_name": "run_gridscan_move_and_tidy",
},
)
assert_event(
test_ispyb_callback.activity_gated_event.mock_calls[0],
test_ispyb_callback.activity_gated_event.mock_calls[0], # pyright: ignore
{
"undulator_current_gap": undulator_test_value,
"synchrotron-synchrotron_mode": synchrotron_test_value.value,
Expand All @@ -249,13 +250,14 @@ def test_read_hardware_for_ispyb_updates_from_ophyd_devices(
},
)
assert_event(
test_ispyb_callback.activity_gated_event.mock_calls[1],
test_ispyb_callback.activity_gated_event.mock_calls[1], # pyright: ignore
{
"attenuator_actual_transmission": transmission_test_value,
"flux_flux_reading": flux_test_value,
"dcm_energy_in_kev": current_energy_kev_test_value,
},
)
# fmt: on

@patch(
"dodal.devices.aperturescatterguard.ApertureScatterguard._safe_move_within_datacollection_range",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,16 @@ def test_read_hardware_for_ispyb_updates_from_ophyd_devices(
fake_fgs_composite.aperture_scatterguard,
)
)

# fmt: off
assert_event(
test_ispyb_callback.activity_gated_start.mock_calls[0],
test_ispyb_callback.activity_gated_start.mock_calls[0], # pyright: ignore
{
"plan_name": "standalone_read_hardware_for_ispyb",
"subplan_name": "run_gridscan_move_and_tidy",
},
)
assert_event(
test_ispyb_callback.activity_gated_event.mock_calls[0],
test_ispyb_callback.activity_gated_event.mock_calls[0], # pyright: ignore
{
"undulator_current_gap": undulator_test_value,
"synchrotron-synchrotron_mode": synchrotron_test_value.value,
Expand All @@ -200,12 +200,13 @@ def test_read_hardware_for_ispyb_updates_from_ophyd_devices(
},
)
assert_event(
test_ispyb_callback.activity_gated_event.mock_calls[1],
test_ispyb_callback.activity_gated_event.mock_calls[1], # pyright: ignore
{
"attenuator_actual_transmission": transmission_test_value,
"flux_flux_reading": flux_test_value,
},
)
# fmt: on

@patch(
"dodal.devices.aperturescatterguard.ApertureScatterguard._safe_move_within_datacollection_range",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ def scan_data_info_for_update(scan_data_info_for_begin):

@pytest.fixture
def dummy_rotation_ispyb_with_experiment_type():
store_in_ispyb = StoreInIspyb(CONST.SIM.ISPYB_CONFIG, "Characterization")
store_in_ispyb = StoreInIspyb(
CONST.SIM.ISPYB_CONFIG, ExperimentType.CHARACTERIZATION
)
return store_in_ispyb


Expand Down

0 comments on commit 5b83260

Please sign in to comment.