diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 322a8429fd..8a360004dd 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -10,12 +10,12 @@ repos:
- --strict
- repo: https://github.com/python-poetry/poetry
- rev: 1.5.0
+ rev: 1.8.0
hooks:
- id: poetry-check
- repo: https://github.com/myint/autoflake
- rev: v1.6.0
+ rev: v2.3.1
hooks:
- id: autoflake
name: Autoflake
@@ -27,13 +27,15 @@ repos:
- --ignore-pass-after-docstring
- repo: https://github.com/psf/black
- rev: 22.8.0
+ rev: 24.8.0 # The following version (`24.10.0`) dropped support for Python 3.8.
hooks:
- id: black
name: Black
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.3.0
+ rev: v4.6.0
+ # The following version (pre-commit-hooks 5.0.0) requires pre-commit 3.2.0
+ # which does not support Python 3.8 (dropped in pre-commit 3.0.0).
hooks:
- id: trailing-whitespace
# Exclude files from trailing-whitespace checks until we get around fixing them.
diff --git a/deprecated/HardwareObjects/Camera.py b/deprecated/HardwareObjects/Camera.py
index d062b6e277..25f1a9c4dc 100644
--- a/deprecated/HardwareObjects/Camera.py
+++ b/deprecated/HardwareObjects/Camera.py
@@ -15,6 +15,7 @@
-->
"""
+
from mxcubecore import BaseHardwareObjects
from mxcubecore import CommandContainer
import gevent
diff --git a/deprecated/HardwareObjects/SpecMotorWSpecPositions.py b/deprecated/HardwareObjects/SpecMotorWSpecPositions.py
index 3614fbc868..763f510634 100644
--- a/deprecated/HardwareObjects/SpecMotorWSpecPositions.py
+++ b/deprecated/HardwareObjects/SpecMotorWSpecPositions.py
@@ -11,6 +11,7 @@
tolerance allowed between real motor position and defined position -->
"""
+
import logging
from mxcubecore.HardwareObjects import SpecMotor
diff --git a/deprecated/HardwareObjects/mockup/CameraMockup.py b/deprecated/HardwareObjects/mockup/CameraMockup.py
index fbeb17ae57..8ca6852157 100644
--- a/deprecated/HardwareObjects/mockup/CameraMockup.py
+++ b/deprecated/HardwareObjects/mockup/CameraMockup.py
@@ -1,5 +1,6 @@
"""Class for cameras connected to framegrabbers run by Taco Device Servers
"""
+
from mxcubecore import BaseHardwareObjects
import logging
import os
diff --git a/deprecated/HardwareObjects/mockup/VideoMockup.py b/deprecated/HardwareObjects/mockup/VideoMockup.py
index b1a3e57230..54fdb399cc 100755
--- a/deprecated/HardwareObjects/mockup/VideoMockup.py
+++ b/deprecated/HardwareObjects/mockup/VideoMockup.py
@@ -1,6 +1,7 @@
"""
Descript. :
"""
+
import os
import time
import gevent
diff --git a/mxcubecore/HardwareObjects/ALBA/XalocCalibration.py b/mxcubecore/HardwareObjects/ALBA/XalocCalibration.py
index 19bf3d143f..10aef0434e 100644
--- a/mxcubecore/HardwareObjects/ALBA/XalocCalibration.py
+++ b/mxcubecore/HardwareObjects/ALBA/XalocCalibration.py
@@ -1,6 +1,7 @@
"""
Class for reading images from Falcon camera OAV
"""
+
from mxcubecore import HardwareRepository as HWR
from mxcubecore import BaseHardwareObjects
diff --git a/mxcubecore/HardwareObjects/BlissActuator.py b/mxcubecore/HardwareObjects/BlissActuator.py
index 0110abb54b..fcaf3a2d5d 100644
--- a/mxcubecore/HardwareObjects/BlissActuator.py
+++ b/mxcubecore/HardwareObjects/BlissActuator.py
@@ -7,6 +7,7 @@
"""
+
import logging
from warnings import warn
diff --git a/mxcubecore/HardwareObjects/Camera.py b/mxcubecore/HardwareObjects/Camera.py
index 075e965dde..34e9ce03ef 100644
--- a/mxcubecore/HardwareObjects/Camera.py
+++ b/mxcubecore/HardwareObjects/Camera.py
@@ -15,6 +15,7 @@
-->
"""
+
from mxcubecore import BaseHardwareObjects
from mxcubecore import CommandContainer
import gevent
diff --git a/mxcubecore/HardwareObjects/CatsMaint.py b/mxcubecore/HardwareObjects/CatsMaint.py
index 9d1fdc3644..fe5c19d8a3 100644
--- a/mxcubecore/HardwareObjects/CatsMaint.py
+++ b/mxcubecore/HardwareObjects/CatsMaint.py
@@ -11,6 +11,7 @@
Vicente Rey - add support for ISARA Model
"""
+
import logging
from mxcubecore.TaskUtils import task
diff --git a/mxcubecore/HardwareObjects/DESY/P11BeamStop.py b/mxcubecore/HardwareObjects/DESY/P11BeamStop.py
index 0e73c67084..24e4c9ee13 100644
--- a/mxcubecore/HardwareObjects/DESY/P11BeamStop.py
+++ b/mxcubecore/HardwareObjects/DESY/P11BeamStop.py
@@ -74,9 +74,9 @@ def load_deltas(self):
# If a delta is not specified, fallback to a default delta value
self.deltas = {
- "bstopx": float(delta_bstopx)
- if delta_bstopx is not None
- else self.default_delta,
+ "bstopx": (
+ float(delta_bstopx) if delta_bstopx is not None else self.default_delta
+ ),
}
# Log the deltas for each motor
diff --git a/mxcubecore/HardwareObjects/DESY/P11Collimator.py b/mxcubecore/HardwareObjects/DESY/P11Collimator.py
index 7bc0a676b3..7a7bcf4460 100644
--- a/mxcubecore/HardwareObjects/DESY/P11Collimator.py
+++ b/mxcubecore/HardwareObjects/DESY/P11Collimator.py
@@ -79,12 +79,12 @@ def load_deltas(self):
# If a delta is not specified, fallback to a default delta value
self.deltas = {
- "collimatory": float(delta_y)
- if delta_y is not None
- else self.default_delta,
- "collimatorz": float(delta_z)
- if delta_z is not None
- else self.default_delta,
+ "collimatory": (
+ float(delta_y) if delta_y is not None else self.default_delta
+ ),
+ "collimatorz": (
+ float(delta_z) if delta_z is not None else self.default_delta
+ ),
}
# Log the deltas for each motor
diff --git a/mxcubecore/HardwareObjects/ESRF/BM14EnergyScan.py b/mxcubecore/HardwareObjects/ESRF/BM14EnergyScan.py
index af9c0a1f83..f4320964d5 100644
--- a/mxcubecore/HardwareObjects/ESRF/BM14EnergyScan.py
+++ b/mxcubecore/HardwareObjects/ESRF/BM14EnergyScan.py
@@ -28,9 +28,9 @@ def choose_attenuation(self):
"Cannot find appropriate attenuation"
)
raise RuntimeError("Cannot find appropriate attenuation")
- self.energy_scan_parameters[
- "transmissionFactor"
- ] = self.transmission.get_value()
+ self.energy_scan_parameters["transmissionFactor"] = (
+ self.transmission.get_value()
+ )
@task
def execute_energy_scan(self, energy_scan_parameters):
diff --git a/mxcubecore/HardwareObjects/ESRF/ESRFMD2SC3.py b/mxcubecore/HardwareObjects/ESRF/ESRFMD2SC3.py
index 12d388bd93..6c687f7e6b 100644
--- a/mxcubecore/HardwareObjects/ESRF/ESRFMD2SC3.py
+++ b/mxcubecore/HardwareObjects/ESRF/ESRFMD2SC3.py
@@ -1,5 +1,6 @@
"""ESRF SC3 Sample Changer Hardware Object
"""
+
from mxcubecore.TaskUtils import task
import SC3
import ESRF.ESRFSC3 as ESRFSC3
diff --git a/mxcubecore/HardwareObjects/ESRF/ESRFSC3.py b/mxcubecore/HardwareObjects/ESRF/ESRFSC3.py
index fc2bd37f52..424639fc65 100644
--- a/mxcubecore/HardwareObjects/ESRF/ESRFSC3.py
+++ b/mxcubecore/HardwareObjects/ESRF/ESRFSC3.py
@@ -1,5 +1,6 @@
"""ESRF SC3 Sample Changer Hardware Object
"""
+
import functools
import logging
from mxcubecore.TaskUtils import task, cleanup, error_cleanup
diff --git a/mxcubecore/HardwareObjects/ESRF/ID231EnergyScan.py b/mxcubecore/HardwareObjects/ESRF/ID231EnergyScan.py
index b31ec1036a..26218e13bb 100644
--- a/mxcubecore/HardwareObjects/ESRF/ID231EnergyScan.py
+++ b/mxcubecore/HardwareObjects/ESRF/ID231EnergyScan.py
@@ -27,9 +27,9 @@ def set_mca_roi(self, eroi_min, eroi_max):
@task
def choose_attenuation(self):
self.execute_command("chooseAttenuation")
- self.energy_scan_parameters[
- "transmissionFactor"
- ] = self.transmission.get_value()
+ self.energy_scan_parameters["transmissionFactor"] = (
+ self.transmission.get_value()
+ )
@task
def execute_energy_scan(self, energy_scan_parameters):
diff --git a/mxcubecore/HardwareObjects/ESRF/ID30BEnergyScan.py b/mxcubecore/HardwareObjects/ESRF/ID30BEnergyScan.py
index c04d788a7a..9ee711a236 100644
--- a/mxcubecore/HardwareObjects/ESRF/ID30BEnergyScan.py
+++ b/mxcubecore/HardwareObjects/ESRF/ID30BEnergyScan.py
@@ -45,9 +45,9 @@ def choose_attenuation(self):
eroi_max = self.energy_scan_parameters["eroi_max"]
self.ctrl.detcover.set_in()
self.ctrl.find_max_attenuation(ctime=2, roi=[eroi_min, eroi_max])
- self.energy_scan_parameters[
- "transmissionFactor"
- ] = self.transmission.get_value()
+ self.energy_scan_parameters["transmissionFactor"] = (
+ self.transmission.get_value()
+ )
@task
def execute_energy_scan(self, energy_scan_parameters):
diff --git a/mxcubecore/HardwareObjects/ESRF/ID30BXRFSpectrum.py b/mxcubecore/HardwareObjects/ESRF/ID30BXRFSpectrum.py
index b4725cd016..b956624aba 100644
--- a/mxcubecore/HardwareObjects/ESRF/ID30BXRFSpectrum.py
+++ b/mxcubecore/HardwareObjects/ESRF/ID30BXRFSpectrum.py
@@ -409,9 +409,9 @@ def _findAttenuation(self, ct):
print(ic)
if ic > min_cnt:
self.ctrl_hwobj.diffractometer.msclose()
- self.spectrumInfo[
- "beamTransmission"
- ] = HWR.beamline.transmission.get_value()
+ self.spectrumInfo["beamTransmission"] = (
+ HWR.beamline.transmission.get_value()
+ )
logging.getLogger("user_level_log").info(
"Transmission used for spectra: %g"
% self.spectrumInfo["beamTransmission"]
diff --git a/mxcubecore/HardwareObjects/ESRF/ID30SC3.py b/mxcubecore/HardwareObjects/ESRF/ID30SC3.py
index 96abc49d43..c88ccd7110 100644
--- a/mxcubecore/HardwareObjects/ESRF/ID30SC3.py
+++ b/mxcubecore/HardwareObjects/ESRF/ID30SC3.py
@@ -1,5 +1,6 @@
"""ESRF SC3 Sample Changer Hardware Object
"""
+
from mxcubecore.TaskUtils import task
import SC3
import ESRFSC3
diff --git a/mxcubecore/HardwareObjects/Gphl/CollectEmulator.py b/mxcubecore/HardwareObjects/Gphl/CollectEmulator.py
index 6e1ce9a2f8..3626b0ec00 100644
--- a/mxcubecore/HardwareObjects/Gphl/CollectEmulator.py
+++ b/mxcubecore/HardwareObjects/Gphl/CollectEmulator.py
@@ -229,7 +229,7 @@ def _get_simcal_input(self, data_collect_parameters, crystal_data):
template = template.replace(ss0, "?" * int(ss0[1:-1]))
name_template = os.path.join(
text_type(data_collect_parameters["fileinfo"]["directory"]),
- template
+ template,
# data_collect_parameters['fileinfo']['template']
)
# We still use the normal name template for compressed data
diff --git a/mxcubecore/HardwareObjects/Gphl/GphlWorkflowConnection.py b/mxcubecore/HardwareObjects/Gphl/GphlWorkflowConnection.py
index fc12ec4e57..793568a005 100644
--- a/mxcubecore/HardwareObjects/Gphl/GphlWorkflowConnection.py
+++ b/mxcubecore/HardwareObjects/Gphl/GphlWorkflowConnection.py
@@ -289,9 +289,9 @@ def start_workflow(self, workflow_queue, workflow_model_obj):
# Set the workflow root subdirectory parameter from the base image directory
image_root = os.path.abspath(HWR.beamline.session.get_base_image_directory())
if strategy_settings["wftype"] != "transcal":
- workflow_options[
- "appdir"
- ] = HWR.beamline.session.get_base_process_directory()
+ workflow_options["appdir"] = (
+ HWR.beamline.session.get_base_process_directory()
+ )
rootsubdir = path_template.directory[len(image_root) :]
if rootsubdir.startswith(os.path.sep):
rootsubdir = rootsubdir[1:]
@@ -1065,9 +1065,9 @@ def _CollectionDone_to_java(self, collectionDone):
)
scanIdMap = {}
for item in collectionDone.scanIdMap.items():
- scanIdMap[
- jvm.java.util.UUID.fromString(conversion.text_type(item[0]))
- ] = jvm.java.util.UUID.fromString(conversion.text_type(item[1]))
+ scanIdMap[jvm.java.util.UUID.fromString(conversion.text_type(item[0]))] = (
+ jvm.java.util.UUID.fromString(conversion.text_type(item[1]))
+ )
return jvm.astra.messagebus.messages.information.CollectionDoneImpl(
proposalId,
collectionDone.status,
diff --git a/mxcubecore/HardwareObjects/GrobSampleChanger.py b/mxcubecore/HardwareObjects/GrobSampleChanger.py
index d91df18876..6938468f84 100644
--- a/mxcubecore/HardwareObjects/GrobSampleChanger.py
+++ b/mxcubecore/HardwareObjects/GrobSampleChanger.py
@@ -1,5 +1,6 @@
"""Sample Changer Hardware Object
"""
+
import logging
from mxcubecore.BaseHardwareObjects import HardwareObject
import gevent
diff --git a/mxcubecore/HardwareObjects/ISPyBRestClient.py b/mxcubecore/HardwareObjects/ISPyBRestClient.py
index 1ea47ecb29..7b2bb43075 100644
--- a/mxcubecore/HardwareObjects/ISPyBRestClient.py
+++ b/mxcubecore/HardwareObjects/ISPyBRestClient.py
@@ -1,6 +1,7 @@
"""
A client for ISPyB Webservices.
"""
+
import logging
import json
import cgi
diff --git a/mxcubecore/HardwareObjects/LimaEigerDetector.py b/mxcubecore/HardwareObjects/LimaEigerDetector.py
index 189e0d53f8..442e175255 100644
--- a/mxcubecore/HardwareObjects/LimaEigerDetector.py
+++ b/mxcubecore/HardwareObjects/LimaEigerDetector.py
@@ -1,6 +1,7 @@
"""LimaEigerDetector Class
Lima Tango Device Server implementation of the Dectris Eiger2 Detector.
"""
+
import gevent
import time
import os
diff --git a/mxcubecore/HardwareObjects/MAXIV/BIOMAXKafka.py b/mxcubecore/HardwareObjects/MAXIV/BIOMAXKafka.py
index e65d9ff30e..4c410fbada 100644
--- a/mxcubecore/HardwareObjects/MAXIV/BIOMAXKafka.py
+++ b/mxcubecore/HardwareObjects/MAXIV/BIOMAXKafka.py
@@ -1,6 +1,7 @@
"""
A client for Biomax Kafka services.
"""
+
import logging
import time
import json
diff --git a/mxcubecore/HardwareObjects/MAXIV/MaxIVSession.py b/mxcubecore/HardwareObjects/MAXIV/MaxIVSession.py
index 2f8b9ea7eb..c6cdbed28a 100644
--- a/mxcubecore/HardwareObjects/MAXIV/MaxIVSession.py
+++ b/mxcubecore/HardwareObjects/MAXIV/MaxIVSession.py
@@ -3,6 +3,7 @@
Adapting from original Session.py to adapt the names of data directories
"""
+
import os
import time
import socket
diff --git a/mxcubecore/HardwareObjects/MiniDiff.py b/mxcubecore/HardwareObjects/MiniDiff.py
index 3ae5e7fe92..1b8a553802 100644
--- a/mxcubecore/HardwareObjects/MiniDiff.py
+++ b/mxcubecore/HardwareObjects/MiniDiff.py
@@ -993,9 +993,9 @@ def get_positions(self):
"sampx": float(self.sampleXMotor.get_value()),
"sampy": float(self.sampleYMotor.get_value()),
"kappa": float(self.kappaMotor.get_value()) if self.kappaMotor else None,
- "kappa_phi": float(self.kappaPhiMotor.get_value())
- if self.kappaPhiMotor
- else None,
+ "kappa_phi": (
+ float(self.kappaPhiMotor.get_value()) if self.kappaPhiMotor else None
+ ),
"zoom": float(self.zoomMotor.get_value()),
}
diff --git a/mxcubecore/HardwareObjects/MotorWPositions.py b/mxcubecore/HardwareObjects/MotorWPositions.py
index db5bf0ce28..6a0bc3f010 100644
--- a/mxcubecore/HardwareObjects/MotorWPositions.py
+++ b/mxcubecore/HardwareObjects/MotorWPositions.py
@@ -97,7 +97,7 @@ def get_predefined_positions_list(self):
def get_current_position_name(self, pos=None):
if pos is None:
pos = self.motor.get_value()
- for (position_name, position) in self.predefined_positions.items():
+ for position_name, position in self.predefined_positions.items():
if self.delta >= abs(pos - position):
return position_name
return ""
diff --git a/mxcubecore/HardwareObjects/PyISPyBClient.py b/mxcubecore/HardwareObjects/PyISPyBClient.py
index 954f231d11..648e71730b 100644
--- a/mxcubecore/HardwareObjects/PyISPyBClient.py
+++ b/mxcubecore/HardwareObjects/PyISPyBClient.py
@@ -1,6 +1,7 @@
"""
A client for PyISPyB Webservices.
"""
+
import os
import json
import logging
diff --git a/mxcubecore/HardwareObjects/QtGraphicsManager.py b/mxcubecore/HardwareObjects/QtGraphicsManager.py
index 3737fe312a..7c71c06779 100644
--- a/mxcubecore/HardwareObjects/QtGraphicsManager.py
+++ b/mxcubecore/HardwareObjects/QtGraphicsManager.py
@@ -976,9 +976,9 @@ def mouse_released(self, pos_x, pos_y):
# self._shapes.add_shape(self.graphics_grid_draw_item.get_display_name(),
# self.graphics_grid_draw_item
# )
- self.shape_dict[
- self.graphics_grid_draw_item.get_display_name()
- ] = self.graphics_grid_draw_item
+ self.shape_dict[self.graphics_grid_draw_item.get_display_name()] = (
+ self.graphics_grid_draw_item
+ )
elif self.in_beam_define_state:
self.stop_beam_define()
elif self.in_select_items_state:
diff --git a/mxcubecore/HardwareObjects/QueueManager.py b/mxcubecore/HardwareObjects/QueueManager.py
index 368b5384b4..bf4dc51dcc 100644
--- a/mxcubecore/HardwareObjects/QueueManager.py
+++ b/mxcubecore/HardwareObjects/QueueManager.py
@@ -7,6 +7,7 @@
container of the queue, note the inheritance from QueueEntryContainer. See the
documentation for the queue_entry module for more information.
"""
+
import logging
import gevent
import traceback
diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1EnergyScan.py b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1EnergyScan.py
index 1617bc6a43..e1165a6770 100644
--- a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1EnergyScan.py
+++ b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1EnergyScan.py
@@ -10,6 +10,7 @@
This has been modified to follow the AbstractEnergyScan method
"""
+
import logging
import os
import time
diff --git a/mxcubecore/HardwareObjects/SOLEIL/SOLEILCatsMaint.py b/mxcubecore/HardwareObjects/SOLEIL/SOLEILCatsMaint.py
index 4ada5bb2cb..39e9749cce 100644
--- a/mxcubecore/HardwareObjects/SOLEIL/SOLEILCatsMaint.py
+++ b/mxcubecore/HardwareObjects/SOLEIL/SOLEILCatsMaint.py
@@ -4,6 +4,7 @@
Functionality in addition to sample-transfer functionality: power control,
lid control, error-recovery commands, ...
"""
+
import logging
from mxcubecore.TaskUtils import task
from mxcubecore.BaseHardwareObjects import HardwareObject
diff --git a/mxcubecore/HardwareObjects/Session.py b/mxcubecore/HardwareObjects/Session.py
index dd80bc2d6f..4dec423be4 100644
--- a/mxcubecore/HardwareObjects/Session.py
+++ b/mxcubecore/HardwareObjects/Session.py
@@ -4,6 +4,7 @@
Contains information regarding the current session and methods to
access and manipulate this information.
"""
+
import os
import time
import socket
diff --git a/mxcubecore/HardwareObjects/SpecMotorWSpecPositions.py b/mxcubecore/HardwareObjects/SpecMotorWSpecPositions.py
index 3614fbc868..763f510634 100644
--- a/mxcubecore/HardwareObjects/SpecMotorWSpecPositions.py
+++ b/mxcubecore/HardwareObjects/SpecMotorWSpecPositions.py
@@ -11,6 +11,7 @@
tolerance allowed between real motor position and defined position -->
"""
+
import logging
from mxcubecore.HardwareObjects import SpecMotor
diff --git a/mxcubecore/HardwareObjects/TangoLimaVideo.py b/mxcubecore/HardwareObjects/TangoLimaVideo.py
index 15ee24c988..439212cf68 100755
--- a/mxcubecore/HardwareObjects/TangoLimaVideo.py
+++ b/mxcubecore/HardwareObjects/TangoLimaVideo.py
@@ -12,6 +12,7 @@
If video mode is not specified, BAYER_RG16 is used by default.
"""
+
import logging
import time
import struct
diff --git a/mxcubecore/HardwareObjects/TangoLimaVideoLoopback.py b/mxcubecore/HardwareObjects/TangoLimaVideoLoopback.py
index 9aafc29084..583c88196c 100644
--- a/mxcubecore/HardwareObjects/TangoLimaVideoLoopback.py
+++ b/mxcubecore/HardwareObjects/TangoLimaVideoLoopback.py
@@ -12,6 +12,7 @@
If video mode is not specified, BAYER_RG16 is used by default.
"""
+
import logging
import v4l2
import gipc
diff --git a/mxcubecore/HardwareObjects/VaporyVideo.py b/mxcubecore/HardwareObjects/VaporyVideo.py
index f9787221bf..d09445d4ff 100755
--- a/mxcubecore/HardwareObjects/VaporyVideo.py
+++ b/mxcubecore/HardwareObjects/VaporyVideo.py
@@ -19,7 +19,6 @@
[Included Hardware Objects]
"""
-
import time
import gevent
import vapory
diff --git a/mxcubecore/HardwareObjects/XRFSpectrum.py b/mxcubecore/HardwareObjects/XRFSpectrum.py
index de862b8fb5..046a126afb 100644
--- a/mxcubecore/HardwareObjects/XRFSpectrum.py
+++ b/mxcubecore/HardwareObjects/XRFSpectrum.py
@@ -226,9 +226,9 @@ def spectrumCommandFinished(self, result):
mcaData = self.mca_hwobj.read_data(save_data=True)
mcaCalib = self.mca_hwobj.get_calibration()
mcaConfig = {}
- self.spectrumInfo[
- "beamTransmission"
- ] = HWR.beamline.transmission.get_value()
+ self.spectrumInfo["beamTransmission"] = (
+ HWR.beamline.transmission.get_value()
+ )
self.spectrumInfo["energy"] = HWR.beamline.energy.get_value()
if HWR.beamline.flux:
self.spectrumInfo["flux"] = HWR.beamline.flux.get_value()
@@ -404,9 +404,9 @@ def _findAttenuation(self, ct):
print(ic)
if ic > min_cnt:
self.ctrl_hwobj.diffractometer.msclose()
- self.spectrumInfo[
- "beamTransmission"
- ] = HWR.beamline.transmission.get_value()
+ self.spectrumInfo["beamTransmission"] = (
+ HWR.beamline.transmission.get_value()
+ )
logging.getLogger("user_level_log").info(
"Transmission used for spectra: %g"
% self.spectrumInfo["beamTransmission"]
diff --git a/mxcubecore/HardwareObjects/abstract/AbstractMultiCollect.py b/mxcubecore/HardwareObjects/abstract/AbstractMultiCollect.py
index ce2ac41c30..378fd12970 100644
--- a/mxcubecore/HardwareObjects/abstract/AbstractMultiCollect.py
+++ b/mxcubecore/HardwareObjects/abstract/AbstractMultiCollect.py
@@ -445,9 +445,9 @@ def do_collect(self, owner, data_collect_parameters):
logging.getLogger("user_level_log").info(
"Getting synchrotron filling mode"
)
- data_collect_parameters[
- "synchrotronMode"
- ] = self.get_machine_fill_mode()
+ data_collect_parameters["synchrotronMode"] = (
+ self.get_machine_fill_mode()
+ )
data_collect_parameters["status"] = "failed"
logging.getLogger("user_level_log").info("Storing data collection in LIMS")
@@ -487,9 +487,9 @@ def do_collect(self, owner, data_collect_parameters):
if HWR.beamline.sample_changer is not None:
try:
- data_collect_parameters[
- "actualSampleBarcode"
- ] = HWR.beamline.sample_changer.get_loaded_sample().get_id()
+ data_collect_parameters["actualSampleBarcode"] = (
+ HWR.beamline.sample_changer.get_loaded_sample().get_id()
+ )
data_collect_parameters["actualContainerBarcode"] = (
HWR.beamline.sample_changer.get_loaded_sample()
.get_container()
@@ -573,9 +573,9 @@ def do_collect(self, owner, data_collect_parameters):
if HWR.beamline.lims:
try:
if self.current_lims_sample:
- self.current_lims_sample[
- "lastKnownCentringPosition"
- ] = positions_str
+ self.current_lims_sample["lastKnownCentringPosition"] = (
+ positions_str
+ )
logging.getLogger("user_level_log").info(
"Updating sample information in LIMS"
)
@@ -624,9 +624,9 @@ def do_collect(self, owner, data_collect_parameters):
except Exception:
pass
- data_collect_parameters[
- "xtalSnapshotFullPath%i" % snapshot_i
- ] = full_snapshot
+ data_collect_parameters["xtalSnapshotFullPath%i" % snapshot_i] = (
+ full_snapshot
+ )
snapshots.append(full_snapshot)
snapshot_i += 1
@@ -642,12 +642,12 @@ def do_collect(self, owner, data_collect_parameters):
"Updating data collection in LIMS"
)
if "kappa" in data_collect_parameters["actualCenteringPosition"]:
- data_collect_parameters["oscillation_sequence"][0][
- "kappaStart"
- ] = current_diffractometer_position["kappa"]
- data_collect_parameters["oscillation_sequence"][0][
- "phiStart"
- ] = current_diffractometer_position["kappa_phi"]
+ data_collect_parameters["oscillation_sequence"][0]["kappaStart"] = (
+ current_diffractometer_position["kappa"]
+ )
+ data_collect_parameters["oscillation_sequence"][0]["phiStart"] = (
+ current_diffractometer_position["kappa_phi"]
+ )
HWR.beamline.lims.update_data_collection(data_collect_parameters)
except Exception:
logging.getLogger("HWR").exception(
@@ -808,18 +808,18 @@ def do_collect(self, owner, data_collect_parameters):
data_collect_parameters["flux_end"] = data_collect_parameters[
"flux"
]
- data_collect_parameters[
- "wavelength"
- ] = HWR.beamline.energy.get_wavelength()
- data_collect_parameters[
- "detectorDistance"
- ] = HWR.beamline.detector.distance.get_value()
- data_collect_parameters[
- "resolution"
- ] = HWR.beamline.resolution.get_value()
- data_collect_parameters[
- "transmission"
- ] = HWR.beamline.transmission.get_value()
+ data_collect_parameters["wavelength"] = (
+ HWR.beamline.energy.get_wavelength()
+ )
+ data_collect_parameters["detectorDistance"] = (
+ HWR.beamline.detector.distance.get_value()
+ )
+ data_collect_parameters["resolution"] = (
+ HWR.beamline.resolution.get_value()
+ )
+ data_collect_parameters["transmission"] = (
+ HWR.beamline.transmission.get_value()
+ )
beam_centre_x, beam_centre_y = self.get_beam_centre()
data_collect_parameters["xBeam"] = beam_centre_x
data_collect_parameters["yBeam"] = beam_centre_y
@@ -831,9 +831,9 @@ def do_collect(self, owner, data_collect_parameters):
if key in und:
data_collect_parameters["undulatorGap%d" % (i)] = und[key]
i += 1
- data_collect_parameters[
- "resolutionAtCorner"
- ] = self.get_resolution_at_corner()
+ data_collect_parameters["resolutionAtCorner"] = (
+ self.get_resolution_at_corner()
+ )
beam_size_x, beam_size_y = self.get_beam_size()
data_collect_parameters["beamSizeAtSampleX"] = beam_size_x
data_collect_parameters["beamSizeAtSampleY"] = beam_size_y
@@ -971,9 +971,9 @@ def do_collect(self, owner, data_collect_parameters):
if archive_directory:
lims_image["jpegFileFullPath"] = jpeg_full_path
- lims_image[
- "jpegThumbnailFileFullPath"
- ] = jpeg_thumbnail_full_path
+ lims_image["jpegThumbnailFileFullPath"] = (
+ jpeg_thumbnail_full_path
+ )
try:
HWR.beamline.lims.store_image(lims_image)
@@ -1103,9 +1103,9 @@ def loop(self, owner, data_collect_parameters_list):
logging.getLogger("user_level_log").info(
"Data collection failed %s" % exc_value
)
- data_collect_parameters[
- "status"
- ] = "Data collection failed!" # Message to be stored in LIMS
+ data_collect_parameters["status"] = (
+ "Data collection failed!" # Message to be stored in LIMS
+ )
failed_msg = "Data collection failed!\n%s" % exc_value
self.emit(
"collectOscillationFailed",
diff --git a/mxcubecore/HardwareObjects/abstract/AbstractOnlineProcessing.py b/mxcubecore/HardwareObjects/abstract/AbstractOnlineProcessing.py
index 595368a034..ce061784c1 100644
--- a/mxcubecore/HardwareObjects/abstract/AbstractOnlineProcessing.py
+++ b/mxcubecore/HardwareObjects/abstract/AbstractOnlineProcessing.py
@@ -224,9 +224,9 @@ def prepare_processing(self):
if not acq_params.num_images_per_trigger:
self.params_dict["num_images_per_trigger"] = 1
else:
- self.params_dict[
- "num_images_per_trigger"
- ] = acq_params.num_images_per_trigger
+ self.params_dict["num_images_per_trigger"] = (
+ acq_params.num_images_per_trigger
+ )
self.params_dict["status"] = "Started"
self.params_dict["title"] = "%s_%d_#####.cbf (%d - %d)" % (
@@ -770,13 +770,13 @@ def align_processing_results(self, start_index, end_index):
center_x = ndimage.measurements.center_of_mass(
self.results_aligned["score"]
)[0]
- self.results_aligned[
- "center_mass"
- ] = HWR.beamline.diffractometer.get_point_from_line(
- centred_positions[0],
- centred_positions[1],
- center_x,
- self.params_dict["images_num"],
+ self.results_aligned["center_mass"] = (
+ HWR.beamline.diffractometer.get_point_from_line(
+ centred_positions[0],
+ centred_positions[1],
+ center_x,
+ self.params_dict["images_num"],
+ )
)
else:
self.results_aligned["center_mass"] = centred_positions[0]
diff --git a/mxcubecore/HardwareObjects/abstract/AbstractXRFSpectrum.py b/mxcubecore/HardwareObjects/abstract/AbstractXRFSpectrum.py
index 0ceab69ad9..b8c8d99304 100644
--- a/mxcubecore/HardwareObjects/abstract/AbstractXRFSpectrum.py
+++ b/mxcubecore/HardwareObjects/abstract/AbstractXRFSpectrum.py
@@ -204,9 +204,9 @@ def spectrum_command_finished(self):
"""Actions to do if spectrum acquired."""
self.spectrum_info_dict["endTime"] = time.strftime("%Y-%m-%d %H:%M:%S")
if HWR.beamline.transmission:
- self.spectrum_info_dict[
- "beamTransmission"
- ] = HWR.beamline.transmission.get_value()
+ self.spectrum_info_dict["beamTransmission"] = (
+ HWR.beamline.transmission.get_value()
+ )
if HWR.beamline.energy:
self.spectrum_info_dict["energy"] = HWR.beamline.energy.get_value()
if HWR.beamline.flux:
diff --git a/mxcubecore/HardwareObjects/mockup/CatsMaintMockup.py b/mxcubecore/HardwareObjects/mockup/CatsMaintMockup.py
index df613409c2..f85b50439b 100644
--- a/mxcubecore/HardwareObjects/mockup/CatsMaintMockup.py
+++ b/mxcubecore/HardwareObjects/mockup/CatsMaintMockup.py
@@ -1,6 +1,7 @@
"""
CATS maintenance mockup.
"""
+
import logging
from mxcubecore.TaskUtils import task
diff --git a/mxcubecore/HardwareObjects/mockup/EnergyScanMockup.py b/mxcubecore/HardwareObjects/mockup/EnergyScanMockup.py
index 2f57f60135..fadbbd6e87 100644
--- a/mxcubecore/HardwareObjects/mockup/EnergyScanMockup.py
+++ b/mxcubecore/HardwareObjects/mockup/EnergyScanMockup.py
@@ -198,9 +198,9 @@ def execute_energy_scan(self, energy_scan_parameters):
self.energy_scan_parameters["exposureTime"] = 0.01
print(self.cpos)
if HWR.beamline.transmission is not None:
- self.energy_scan_parameters[
- "transmissionFactor"
- ] = HWR.beamline.transmission.get_value()
+ self.energy_scan_parameters["transmissionFactor"] = (
+ HWR.beamline.transmission.get_value()
+ )
else:
self.energy_scan_parameters["transmissionFactor"] = None
size_hor = None
diff --git a/mxcubecore/HardwareObjects/mockup/ISPyBRestClientMockup.py b/mxcubecore/HardwareObjects/mockup/ISPyBRestClientMockup.py
index 16d93649ce..72bb047533 100644
--- a/mxcubecore/HardwareObjects/mockup/ISPyBRestClientMockup.py
+++ b/mxcubecore/HardwareObjects/mockup/ISPyBRestClientMockup.py
@@ -1,6 +1,7 @@
"""
A client for ISPyB Webservices.
"""
+
from __future__ import print_function
import logging
from datetime import datetime
diff --git a/mxcubecore/HardwareObjects/mockup/MachineInfoMockup.py b/mxcubecore/HardwareObjects/mockup/MachineInfoMockup.py
index 3f019fc053..152dd89afa 100644
--- a/mxcubecore/HardwareObjects/mockup/MachineInfoMockup.py
+++ b/mxcubecore/HardwareObjects/mockup/MachineInfoMockup.py
@@ -31,6 +31,7 @@
values['lifetime']
values['topup_remaining']
"""
+
import time
import gevent
diff --git a/mxcubecore/HardwareObjects/mockup/MicrodiffZoomMockup.py b/mxcubecore/HardwareObjects/mockup/MicrodiffZoomMockup.py
index 5e6c27274c..2333d6bdcf 100644
--- a/mxcubecore/HardwareObjects/mockup/MicrodiffZoomMockup.py
+++ b/mxcubecore/HardwareObjects/mockup/MicrodiffZoomMockup.py
@@ -8,6 +8,7 @@
EL6": 6}
"""
+
from enum import Enum
import gevent
diff --git a/mxcubecore/HardwareObjects/sample_centring.py b/mxcubecore/HardwareObjects/sample_centring.py
index 9610814deb..e900367170 100644
--- a/mxcubecore/HardwareObjects/sample_centring.py
+++ b/mxcubecore/HardwareObjects/sample_centring.py
@@ -356,12 +356,16 @@ def centre_plate(
{
sampx.motor: float(sampx.get_value() + sampx.direction * dx),
sampy.motor: float(sampy.get_value() + sampy.direction * dy),
- phiz.motor: float(phiz.get_value() + phiz.direction * d_vertical[0, 0])
- if phiz.__dict__.get("reference_position") is None
- else phiz.reference_position,
- phiy.motor: float(phiy.get_value() + phiy.direction * d_horizontal[0, 0])
- if phiy.__dict__.get("reference_position") is None
- else phiy.reference_position,
+ phiz.motor: (
+ float(phiz.get_value() + phiz.direction * d_vertical[0, 0])
+ if phiz.__dict__.get("reference_position") is None
+ else phiz.reference_position
+ ),
+ phiy.motor: (
+ float(phiy.get_value() + phiy.direction * d_horizontal[0, 0])
+ if phiy.__dict__.get("reference_position") is None
+ else phiy.reference_position
+ ),
}
)
@@ -477,12 +481,16 @@ def center(
{
sampx.motor: float(sampx.get_value() + sampx.direction * dx),
sampy.motor: float(sampy.get_value() + sampy.direction * dy),
- phiz.motor: float(phiz.get_value() + phiz.direction * d_vertical[0, 0])
- if phiz.__dict__.get("reference_position") is None
- else phiz.reference_position,
- phiy.motor: float(phiy.get_value() + phiy.direction * d_horizontal[0, 0])
- if phiy.__dict__.get("reference_position") is None
- else phiy.reference_position,
+ phiz.motor: (
+ float(phiz.get_value() + phiz.direction * d_vertical[0, 0])
+ if phiz.__dict__.get("reference_position") is None
+ else phiz.reference_position
+ ),
+ phiy.motor: (
+ float(phiy.get_value() + phiy.direction * d_horizontal[0, 0])
+ if phiy.__dict__.get("reference_position") is None
+ else phiy.reference_position
+ ),
}
)
diff --git a/mxcubecore/model/queue_model_objects.py b/mxcubecore/model/queue_model_objects.py
index 359c6e283a..fac0562481 100644
--- a/mxcubecore/model/queue_model_objects.py
+++ b/mxcubecore/model/queue_model_objects.py
@@ -793,9 +793,9 @@ def get_online_processing_results(self):
return self.online_processing_results
def set_snapshot(self, snapshot):
- self.acquisitions[
- 0
- ].acquisition_parameters.centred_position.snapshot_image = snapshot
+ self.acquisitions[0].acquisition_parameters.centred_position.snapshot_image = (
+ snapshot
+ )
def add_processing_msg(self, time, method, status, msg):
self.processing_msg_list.append((time, method, status, msg))
diff --git a/mxcubecore/queue_entry/advanced_connector.py b/mxcubecore/queue_entry/advanced_connector.py
index 15255b7f58..6c8bdeb7bf 100644
--- a/mxcubecore/queue_entry/advanced_connector.py
+++ b/mxcubecore/queue_entry/advanced_connector.py
@@ -68,9 +68,9 @@ def execute(self):
cpos_one,
cpos_two,
) = HWR.beamline.sample_view.create_auto_line()
- helical_model.acquisitions[
- 0
- ].acquisition_parameters.osc_start = cpos_one.phi
+ helical_model.acquisitions[0].acquisition_parameters.osc_start = (
+ cpos_one.phi
+ )
helical_model.acquisitions[
0
].acquisition_parameters.centred_position = cpos_one
diff --git a/mxcubecore/queue_entry/base_queue_entry.py b/mxcubecore/queue_entry/base_queue_entry.py
index cf57e98f62..e2d2e1f720 100644
--- a/mxcubecore/queue_entry/base_queue_entry.py
+++ b/mxcubecore/queue_entry/base_queue_entry.py
@@ -565,9 +565,9 @@ def execute_interleaved(self, ref_num_images, interleave_num_images):
acq_first_image,
acq_first_image + item["collect_num_images"] - 1,
)
- self.interleave_items[item["collect_index"]][
- "queue_entry"
- ].in_queue = item_index < (len(self.interleave_sw_list) - 1)
+ self.interleave_items[item["collect_index"]]["queue_entry"].in_queue = (
+ item_index < (len(self.interleave_sw_list) - 1)
+ )
msg = "Executing %s collection (subwedge %d:%d, " % (
method_type,