Skip to content

Commit

Permalink
Update pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
fabcor-maxiv committed Oct 18, 2024
1 parent d9668ef commit 0ba770e
Show file tree
Hide file tree
Showing 50 changed files with 157 additions and 122 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,13 +27,13 @@ repos:
- --ignore-pass-after-docstring

- repo: https://github.com/psf/black
rev: 22.8.0
rev: 24.10.0
hooks:
- id: black
name: Black

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
# Exclude files from trailing-whitespace checks until we get around fixing them.
Expand Down
1 change: 1 addition & 0 deletions deprecated/HardwareObjects/Camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
</calibration> -->
</object>
"""

from mxcubecore import BaseHardwareObjects
from mxcubecore import CommandContainer
import gevent
Expand Down
1 change: 1 addition & 0 deletions deprecated/HardwareObjects/SpecMotorWSpecPositions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<delta>tolerance allowed between real motor position and defined position</delta> -->
</object>
"""

import logging

from mxcubecore.HardwareObjects import SpecMotor
Expand Down
1 change: 1 addition & 0 deletions deprecated/HardwareObjects/mockup/CameraMockup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Class for cameras connected to framegrabbers run by Taco Device Servers
"""

from mxcubecore import BaseHardwareObjects
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions deprecated/HardwareObjects/mockup/VideoMockup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Descript. :
"""

import os
import time
import gevent
Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/ALBA/XalocCalibration.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Class for reading images from Falcon camera OAV
"""

from mxcubecore import HardwareRepository as HWR
from mxcubecore import BaseHardwareObjects

Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/BlissActuator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<object href="/bliss" role="controller"/>
</object>
"""

import logging
from warnings import warn

Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/Camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
</calibration> -->
</object>
"""

from mxcubecore import BaseHardwareObjects
from mxcubecore import CommandContainer
import gevent
Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/CatsMaint.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Vicente Rey - add support for ISARA Model
"""

import logging

from mxcubecore.TaskUtils import task
Expand Down
6 changes: 3 additions & 3 deletions mxcubecore/HardwareObjects/DESY/P11BeamStop.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions mxcubecore/HardwareObjects/DESY/P11Collimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions mxcubecore/HardwareObjects/ESRF/BM14EnergyScan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/ESRF/ESRFMD2SC3.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""ESRF SC3 Sample Changer Hardware Object
"""

from mxcubecore.TaskUtils import task
import SC3
import ESRF.ESRFSC3 as ESRFSC3
Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/ESRF/ESRFSC3.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""ESRF SC3 Sample Changer Hardware Object
"""

import functools
import logging
from mxcubecore.TaskUtils import task, cleanup, error_cleanup
Expand Down
6 changes: 3 additions & 3 deletions mxcubecore/HardwareObjects/ESRF/ID231EnergyScan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions mxcubecore/HardwareObjects/ESRF/ID30BEnergyScan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions mxcubecore/HardwareObjects/ESRF/ID30BXRFSpectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/ESRF/ID30SC3.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""ESRF SC3 Sample Changer Hardware Object
"""

from mxcubecore.TaskUtils import task
import SC3
import ESRFSC3
Expand Down
2 changes: 1 addition & 1 deletion mxcubecore/HardwareObjects/Gphl/CollectEmulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions mxcubecore/HardwareObjects/Gphl/GphlWorkflowConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:]
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/GrobSampleChanger.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Sample Changer Hardware Object
"""

import logging
from mxcubecore.BaseHardwareObjects import HardwareObject
import gevent
Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/ISPyBRestClient.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
A client for ISPyB Webservices.
"""

import logging
import json
import cgi
Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/LimaEigerDetector.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""LimaEigerDetector Class
Lima Tango Device Server implementation of the Dectris Eiger2 Detector.
"""

import gevent
import time
import os
Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/MAXIV/BIOMAXKafka.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
A client for Biomax Kafka services.
"""

import logging
import time
import json
Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/MAXIV/MaxIVSession.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Adapting from original Session.py to adapt the names of data directories
"""

import os
import time
import socket
Expand Down
6 changes: 3 additions & 3 deletions mxcubecore/HardwareObjects/MiniDiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}

Expand Down
2 changes: 1 addition & 1 deletion mxcubecore/HardwareObjects/MotorWPositions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/PyISPyBClient.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
A client for PyISPyB Webservices.
"""

import os
import json
import logging
Expand Down
6 changes: 3 additions & 3 deletions mxcubecore/HardwareObjects/QtGraphicsManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/QueueManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/SOLEIL/PX1/PX1EnergyScan.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
This has been modified to follow the AbstractEnergyScan method
"""

import logging
import os
import time
Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/SOLEIL/SOLEILCatsMaint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/Session.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Contains information regarding the current session and methods to
access and manipulate this information.
"""

import os
import time
import socket
Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/SpecMotorWSpecPositions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<delta>tolerance allowed between real motor position and defined position</delta> -->
</object>
"""

import logging

from mxcubecore.HardwareObjects import SpecMotor
Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/TangoLimaVideo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
If video mode is not specified, BAYER_RG16 is used by default.
"""

import logging
import time
import struct
Expand Down
1 change: 1 addition & 0 deletions mxcubecore/HardwareObjects/TangoLimaVideoLoopback.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
If video mode is not specified, BAYER_RG16 is used by default.
"""

import logging
import v4l2
import gipc
Expand Down
1 change: 0 additions & 1 deletion mxcubecore/HardwareObjects/VaporyVideo.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
[Included Hardware Objects]
"""


import time
import gevent
import vapory
Expand Down
Loading

0 comments on commit 0ba770e

Please sign in to comment.