From 0aa96b873a5f29b809fac7b19df841cf06c642c0 Mon Sep 17 00:00:00 2001 From: Callum Forrester Date: Fri, 9 Aug 2024 13:46:40 +0100 Subject: [PATCH] Fix pre-commit errors --- .vscode/tasks.json | 2 +- docs/_templates/autosummary/module.rst | 1 - docs/how-to/create-beamline.rst | 1 - docs/how-to/make-new-ophyd-async-device.rst | 2 +- docs/how-to/zocalo.rst | 2 +- docs/images/excalidraw-example.svg | 2 +- docs/reference/device-standards.rst | 2 +- docs/reference/standards.rst | 2 +- docs/tutorials/get_started.rst | 2 +- src/dodal/devices/aperturescatterguard.py | 4 ++-- src/dodal/devices/areadetector/adutils.py | 2 +- src/dodal/devices/oav/microns_for_zoom_levels.json | 2 +- tests/common/test_coordination.py | 2 +- tests/devices/unit_tests/test_OAVCentring.json | 2 +- .../unit_tests/test_aperture_scatterguard.py | 14 +++++++------- .../domain/beamlineParameters | 1 - .../lookup/BeamLineEnergy_DCM_Roll_converter.txt | 1 - tests/fake_zocalo/README.rst | 1 - .../test_data/test_beamline_dcm_roll_converter.txt | 2 +- tests/test_data/test_beamline_parameters.txt | 1 - tests/test_data/test_det_dist_converter.txt | 2 -- 21 files changed, 21 insertions(+), 29 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 1b21c0fb27..4ac17c12eb 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -21,4 +21,4 @@ "type": "shell" } ] -} \ No newline at end of file +} diff --git a/docs/_templates/autosummary/module.rst b/docs/_templates/autosummary/module.rst index 8330527f04..6799b19d5f 100644 --- a/docs/_templates/autosummary/module.rst +++ b/docs/_templates/autosummary/module.rst @@ -64,4 +64,3 @@ {%- endfor %} {% endif %} {% endblock %} - diff --git a/docs/how-to/create-beamline.rst b/docs/how-to/create-beamline.rst index 8c62e641ac..0832f25177 100644 --- a/docs/how-to/create-beamline.rst +++ b/docs/how-to/create-beamline.rst @@ -79,4 +79,3 @@ The following example creates a fictitious beamline ``w41``, with a simulated tw This test checks that the function returns a type that conforms to Bluesky protocols, that it always returns the same instance of the device and that the arguments passed into the Device class constructor are valid. - diff --git a/docs/how-to/make-new-ophyd-async-device.rst b/docs/how-to/make-new-ophyd-async-device.rst index a3bcb6287d..95e26a65d4 100644 --- a/docs/how-to/make-new-ophyd-async-device.rst +++ b/docs/how-to/make-new-ophyd-async-device.rst @@ -64,4 +64,4 @@ Additional Notes - ``with self.add_children_as_readables():`` Ensure this context manager is used appropriately in the device implementation to add child components as readable properties, but not Movables. -.. _ophyd-async: https://blueskyproject.io/ophyd-async/main/how-to/choose-interfaces-for-devices.html \ No newline at end of file +.. _ophyd-async: https://blueskyproject.io/ophyd-async/main/how-to/choose-interfaces-for-devices.html diff --git a/docs/how-to/zocalo.rst b/docs/how-to/zocalo.rst index c9cab27e69..489c9b3d8b 100644 --- a/docs/how-to/zocalo.rst +++ b/docs/how-to/zocalo.rst @@ -10,4 +10,4 @@ processing from data in ISPyB. Results are received using the ``ZocaloResults`` device, so that they can be read into a plan and used for decision-making. Currently the ``ZocaloResults`` device is only made to handle X-ray centring results. It subscribes to -a given zocalo RabbitMQ channel the first time that it is triggered. \ No newline at end of file +a given zocalo RabbitMQ channel the first time that it is triggered. diff --git a/docs/images/excalidraw-example.svg b/docs/images/excalidraw-example.svg index 9f8b3fd963..a4e980a5de 100644 --- a/docs/images/excalidraw-example.svg +++ b/docs/images/excalidraw-example.svg @@ -13,4 +13,4 @@ } - ThisThat \ No newline at end of file + ThisThat diff --git a/docs/reference/device-standards.rst b/docs/reference/device-standards.rst index e27bbd7fc4..3ed95d3723 100644 --- a/docs/reference/device-standards.rst +++ b/docs/reference/device-standards.rst @@ -98,4 +98,4 @@ Ophyd Devices best practices Ophyd-async directory contains a flowchart_ for a simplified decision tree about what interfaces should a given device implement. -.. _flowchart: https://blueskyproject.io/ophyd-async/main/how-to/choose-interfaces-for-devices.html \ No newline at end of file +.. _flowchart: https://blueskyproject.io/ophyd-async/main/how-to/choose-interfaces-for-devices.html diff --git a/docs/reference/standards.rst b/docs/reference/standards.rst index 5afa997e54..8fb9c43320 100644 --- a/docs/reference/standards.rst +++ b/docs/reference/standards.rst @@ -74,4 +74,4 @@ Docs follow the underlining convention:: .. seealso:: - How-to guide `../how-to/build-docs` \ No newline at end of file + How-to guide `../how-to/build-docs` diff --git a/docs/tutorials/get_started.rst b/docs/tutorials/get_started.rst index eac48ebaab..e8c69fa434 100644 --- a/docs/tutorials/get_started.rst +++ b/docs/tutorials/get_started.rst @@ -49,4 +49,4 @@ If you would like to only log to graylog/file exlusively there are helper functi .. _ophyd: https://nsls-ii.github.io/ophyd/ .. _bluesky: https://blueskyproject.io/bluesky/ -.. _graylog: https://graylog-log-target.diamond.ac.uk/search \ No newline at end of file +.. _graylog: https://graylog-log-target.diamond.ac.uk/search diff --git a/src/dodal/devices/aperturescatterguard.py b/src/dodal/devices/aperturescatterguard.py index 7b5aabfc2b..88a7f68e14 100644 --- a/src/dodal/devices/aperturescatterguard.py +++ b/src/dodal/devices/aperturescatterguard.py @@ -174,7 +174,7 @@ class SelectedAperture(SignalR): async def read(self, *args, **kwargs): assert isinstance(self.parent, ApertureScatterguard) assert self._backend - await self._backend.put(await self.parent._get_current_aperture_position()) + await self._backend.put(await self.parent.get_current_aperture_position()) return {self.name: await self._backend.get_reading()} async def describe(self) -> dict[str, DataKey]: @@ -224,7 +224,7 @@ async def _set_raw_unsafe(self, positions: ApertureFiveDimensionalLocation): self.scatterguard.y.set(scatterguard_y), ) - async def _get_current_aperture_position(self) -> SingleAperturePosition: + async def get_current_aperture_position(self) -> SingleAperturePosition: """ Returns the current aperture position using readback values for SMALL, MEDIUM, LARGE. ROBOT_LOAD position defined when diff --git a/src/dodal/devices/areadetector/adutils.py b/src/dodal/devices/areadetector/adutils.py index db68549603..c0ca8a0b22 100644 --- a/src/dodal/devices/areadetector/adutils.py +++ b/src/dodal/devices/areadetector/adutils.py @@ -31,7 +31,7 @@ def trigger(self): def _acq_done(*args, **kwargs): # TODO sort out if anything useful in here - self._status._finished() + self._status._finished() # noqa: SLF001 self._acquisition_signal.put(1, use_complete=True, callback=_acq_done) # Ensure that this mixin is part of valid Detector with generate_datum diff --git a/src/dodal/devices/oav/microns_for_zoom_levels.json b/src/dodal/devices/oav/microns_for_zoom_levels.json index dd01f5ac9f..3c10524881 100644 --- a/src/dodal/devices/oav/microns_for_zoom_levels.json +++ b/src/dodal/devices/oav/microns_for_zoom_levels.json @@ -52,4 +52,4 @@ "micronsPerXPixel": 0.227, "micronsPerYPixel": 0.314 } -} \ No newline at end of file +} diff --git a/tests/common/test_coordination.py b/tests/common/test_coordination.py index e42bacf652..67d8ed0771 100644 --- a/tests/common/test_coordination.py +++ b/tests/common/test_coordination.py @@ -16,7 +16,7 @@ def test_group_uid(group: str): def test_type_checking_ignores_inject(): - def example_function(x: Movable = inject("foo")) -> MsgGenerator: + def example_function(x: Movable = inject("foo")) -> MsgGenerator: # noqa: B008 yield from {} # These asserts are sanity checks diff --git a/tests/devices/unit_tests/test_OAVCentring.json b/tests/devices/unit_tests/test_OAVCentring.json index 2c2febac41..d4002b0eff 100644 --- a/tests/devices/unit_tests/test_OAVCentring.json +++ b/tests/devices/unit_tests/test_OAVCentring.json @@ -67,4 +67,4 @@ "CannyEdgeLowerThreshold": 5.0, "brightness": 90 } -} \ No newline at end of file +} diff --git a/tests/devices/unit_tests/test_aperture_scatterguard.py b/tests/devices/unit_tests/test_aperture_scatterguard.py index 29b4282963..2322ec3904 100644 --- a/tests/devices/unit_tests/test_aperture_scatterguard.py +++ b/tests/devices/unit_tests/test_aperture_scatterguard.py @@ -203,21 +203,21 @@ async def test_aperture_positions_large( ap_sg: ApertureScatterguard, aperture_positions: AperturePositions ): set_mock_value(ap_sg.aperture.large, 1) - assert await ap_sg._get_current_aperture_position() == aperture_positions.LARGE + assert await ap_sg.get_current_aperture_position() == aperture_positions.LARGE async def test_aperture_positions_medium( ap_sg: ApertureScatterguard, aperture_positions: AperturePositions ): set_mock_value(ap_sg.aperture.medium, 1) - assert await ap_sg._get_current_aperture_position() == aperture_positions.MEDIUM + assert await ap_sg.get_current_aperture_position() == aperture_positions.MEDIUM async def test_aperture_positions_small( ap_sg: ApertureScatterguard, aperture_positions: AperturePositions ): set_mock_value(ap_sg.aperture.small, 1) - assert await ap_sg._get_current_aperture_position() == aperture_positions.SMALL + assert await ap_sg.get_current_aperture_position() == aperture_positions.SMALL async def test_aperture_positions_robot_load( @@ -227,7 +227,7 @@ async def test_aperture_positions_robot_load( set_mock_value(ap_sg.aperture.medium, 0) set_mock_value(ap_sg.aperture.small, 0) await ap_sg.aperture.y.set(aperture_positions.ROBOT_LOAD.location.aperture_y) - assert await ap_sg._get_current_aperture_position() == aperture_positions.ROBOT_LOAD + assert await ap_sg.get_current_aperture_position() == aperture_positions.ROBOT_LOAD async def test_aperture_positions_robot_load_within_tolerance( @@ -239,7 +239,7 @@ async def test_aperture_positions_robot_load_within_tolerance( set_mock_value(ap_sg.aperture.medium, 0) set_mock_value(ap_sg.aperture.small, 0) await ap_sg.aperture.y.set(robot_load_ap_y + tolerance) - assert await ap_sg._get_current_aperture_position() == aperture_positions.ROBOT_LOAD + assert await ap_sg.get_current_aperture_position() == aperture_positions.ROBOT_LOAD async def test_aperture_positions_robot_load_outside_tolerance( @@ -252,7 +252,7 @@ async def test_aperture_positions_robot_load_outside_tolerance( set_mock_value(ap_sg.aperture.small, 0) await ap_sg.aperture.y.set(robot_load_ap_y + tolerance) with pytest.raises(InvalidApertureMove): - await ap_sg._get_current_aperture_position() + await ap_sg.get_current_aperture_position() async def test_aperture_positions_robot_load_unsafe( @@ -263,7 +263,7 @@ async def test_aperture_positions_robot_load_unsafe( set_mock_value(ap_sg.aperture.small, 0) await ap_sg.aperture.y.set(50.0) with pytest.raises(InvalidApertureMove): - await ap_sg._get_current_aperture_position() + await ap_sg.get_current_aperture_position() async def test_given_aperture_not_set_through_device_but_motors_in_position_when_device_read_then_position_returned( diff --git a/tests/devices/unit_tests/test_daq_configuration/domain/beamlineParameters b/tests/devices/unit_tests/test_daq_configuration/domain/beamlineParameters index df3951b8fc..0a783cd2f8 100644 --- a/tests/devices/unit_tests/test_daq_configuration/domain/beamlineParameters +++ b/tests/devices/unit_tests/test_daq_configuration/domain/beamlineParameters @@ -137,4 +137,3 @@ attenuation_optimisation_multiplier = 2 attenuation_optimisation_target_count = 2000 attenuation_optimisation_upper_limit = 50000 attenuation_optimisation_lower_limit = 20000 - diff --git a/tests/devices/unit_tests/test_daq_configuration/lookup/BeamLineEnergy_DCM_Roll_converter.txt b/tests/devices/unit_tests/test_daq_configuration/lookup/BeamLineEnergy_DCM_Roll_converter.txt index 329f29f099..9b5b52dcb7 100644 --- a/tests/devices/unit_tests/test_daq_configuration/lookup/BeamLineEnergy_DCM_Roll_converter.txt +++ b/tests/devices/unit_tests/test_daq_configuration/lookup/BeamLineEnergy_DCM_Roll_converter.txt @@ -4,4 +4,3 @@ Units Deg mrad 26.4095 -0.2799 6.3075 -0.2799 - diff --git a/tests/fake_zocalo/README.rst b/tests/fake_zocalo/README.rst index 31fb61d53e..05a137c6f0 100644 --- a/tests/fake_zocalo/README.rst +++ b/tests/fake_zocalo/README.rst @@ -10,4 +10,3 @@ fake_zocalo * Run `dls_start_fake_zocalo.sh` * For Hyperion to connect to this you will need to run `module load dials/latest` in the terminal you're runnign Hyperion in - diff --git a/tests/test_data/test_beamline_dcm_roll_converter.txt b/tests/test_data/test_beamline_dcm_roll_converter.txt index fbbb784863..0368da30bb 100644 --- a/tests/test_data/test_beamline_dcm_roll_converter.txt +++ b/tests/test_data/test_beamline_dcm_roll_converter.txt @@ -7,4 +7,4 @@ Units Deg mrad 2.0 1.0 4.0 2.0 5.0 4.0 -5.5 8.0 \ No newline at end of file +5.5 8.0 diff --git a/tests/test_data/test_beamline_parameters.txt b/tests/test_data/test_beamline_parameters.txt index 20e7eca27f..5247b15d3f 100644 --- a/tests/test_data/test_beamline_parameters.txt +++ b/tests/test_data/test_beamline_parameters.txt @@ -296,4 +296,3 @@ attenuation_optimisation_multiplier = 2 attenuation_optimisation_target_count = 2000 attenuation_optimisation_upper_limit = 50000 attenuation_optimisation_lower_limit = 20000 - diff --git a/tests/test_data/test_det_dist_converter.txt b/tests/test_data/test_det_dist_converter.txt index 7949377941..084853e432 100644 --- a/tests/test_data/test_det_dist_converter.txt +++ b/tests/test_data/test_det_dist_converter.txt @@ -5,5 +5,3 @@ Units mm mm mm 200 153.61 162.45 500 153.57 159.96 - -