Skip to content

Commit 99b307a

Browse files
pre-commit-ci[bot]peterfpetersonsf1919
authored
[pre-commit.ci] pre-commit autoupdate (#38594)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.8.6 → v0.9.1](astral-sh/ruff-pre-commit@v0.8.6...v0.9.1) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix whitespace that was already wrong * Remove additional whitespace found in local run of pre-commit --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Pete Peterson <[email protected]> Co-authored-by: sf1919 <[email protected]>
1 parent 6be0546 commit 99b307a

File tree

395 files changed

+1048
-1180
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

395 files changed

+1048
-1180
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ repos:
5959
)$
6060
6161
- repo: https://github.com/astral-sh/ruff-pre-commit
62-
rev: v0.8.6
62+
rev: v0.9.1
6363
# ruff must appear before black in the list of hooks
6464
hooks:
6565
- id: ruff

Framework/PythonInterface/mantid/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def _bin_dirs():
7070

7171
if _bindir is None:
7272
raise ImportError(
73-
"Broken installation! Unable to find Mantid.properties file.\n" "Directories searched: {}".format(", ".join(_bin_dirs()))
73+
"Broken installation! Unable to find Mantid.properties file.\nDirectories searched: {}".format(", ".join(_bin_dirs()))
7474
)
7575

7676
# Windows doesn't have rpath settings so make sure the C-extensions can find the rest of the

Framework/PythonInterface/mantid/plots/datafunctions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ def update_colorbar_scale(figure, image, scale, vmin, vmax):
12811281
if locator.tick_values(vmin=vmin, vmax=vmax).size == 0:
12821282
locator = LogLocator()
12831283
mantid.kernel.logger.warning(
1284-
"Minor ticks on colorbar scale cannot be shown " "as the range between min value and max value is too large"
1284+
"Minor ticks on colorbar scale cannot be shown as the range between min value and max value is too large"
12851285
)
12861286
colorbar.set_ticks(locator)
12871287

Framework/PythonInterface/mantid/plots/mantidaxes.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def check_axes_distribution_consistency(self):
335335
def artists_workspace_has_errors(self, artist):
336336
"""Check if the given artist's workspace has errors"""
337337
if artist not in self.get_tracked_artists():
338-
raise ValueError("Artist '{}' is not tracked and so does not have " "an associated workspace.".format(artist))
338+
raise ValueError("Artist '{}' is not tracked and so does not have an associated workspace.".format(artist))
339339
workspace, spec_num = self.get_artists_workspace_and_spec_num(artist)
340340
if artist.axes.creation_args[0].get("axis", None) == MantidAxType.BIN:
341341
if any([workspace.readE(i)[spec_num] != 0 for i in range(0, workspace.getNumberHistograms())]):
@@ -1210,7 +1210,7 @@ def set_waterfall(self, state, x_offset=None, y_offset=None, fill=False):
12101210
# that they can use the update_waterfall function to do this.
12111211
if x_offset != self.waterfall_x_offset or y_offset != self.waterfall_y_offset:
12121212
logger.information(
1213-
"If your plot is already a waterfall plot you can use update_waterfall(x, y) to" " change its offset values."
1213+
"If your plot is already a waterfall plot you can use update_waterfall(x, y) to change its offset values."
12141214
)
12151215
else:
12161216
# Nothing needs to be changed.
@@ -1222,7 +1222,7 @@ def set_waterfall(self, state, x_offset=None, y_offset=None, fill=False):
12221222
datafunctions.set_initial_dimensions(self)
12231223
else:
12241224
if bool(x_offset) or bool(y_offset) or fill:
1225-
raise RuntimeError("You have set waterfall to false but have given a non-zero value for the offset or " "set fill to true.")
1225+
raise RuntimeError("You have set waterfall to false but have given a non-zero value for the offset or set fill to true.")
12261226

12271227
if not self.is_waterfall():
12281228
# Nothing needs to be changed.

Framework/PythonInterface/mantid/plots/plotfunctions.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def raise_if_not_sequence(value, seq_name, element_type=None):
314314
"""
315315
accepted_types = (list, tuple, range)
316316
if type(value) not in accepted_types:
317-
raise ValueError("{} should be a list or tuple, " "instead found '{}'".format(seq_name, value.__class__.__name__))
317+
raise ValueError("{} should be a list or tuple, instead found '{}'".format(seq_name, value.__class__.__name__))
318318
if element_type is not None:
319319

320320
def raise_if_not_type(x):
@@ -443,10 +443,10 @@ def _unpack_grouped_workspaces(mixed_list: List):
443443
def _validate_plot_inputs(workspaces, spectrum_nums, wksp_indices, tiled=False, overplot=False):
444444
"""Raises a ValueError if any arguments have the incorrect types"""
445445
if spectrum_nums is not None and wksp_indices is not None:
446-
raise ValueError("Both spectrum_nums and wksp_indices supplied. " "Please supply only 1.")
446+
raise ValueError("Both spectrum_nums and wksp_indices supplied. Please supply only 1.")
447447

448448
if tiled and overplot:
449-
raise ValueError("Both tiled and overplot flags set to true. " "Please set only one to true.")
449+
raise ValueError("Both tiled and overplot flags set to true. Please set only one to true.")
450450

451451
raise_if_not_sequence(workspaces, "workspaces", MatrixWorkspace)
452452

@@ -514,7 +514,7 @@ def _do_single_plot_mdhisto_workspace(ax, workspaces, errors=False):
514514
num_dim += 1
515515
if num_dim != 1:
516516
raise RuntimeError(
517-
f"Workspace {str(ws)} is an IMDHistoWorkspace with number of non-integral dimension " f"equal to {num_dim} but not 1."
517+
f"Workspace {str(ws)} is an IMDHistoWorkspace with number of non-integral dimension equal to {num_dim} but not 1."
518518
)
519519

520520
# Plot

Framework/PythonInterface/mantid/plots/utility.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def zoom_axis(ax, coord, x_or_y, factor):
213213
:param float factor: The factor by which to zoom in, a factor less than 1 zooms out
214214
"""
215215
if x_or_y.lower() not in ["x", "y"]:
216-
raise ValueError("Can only zoom on axis 'x' or 'y'. Found '{}'." "".format(x_or_y))
216+
raise ValueError("Can only zoom on axis 'x' or 'y'. Found '{}'.".format(x_or_y))
217217
get_lims = getattr(ax, "get_{}lim".format(x_or_y.lower()))
218218
set_lims = getattr(ax, "set_{}lim".format(x_or_y.lower()))
219219

Framework/PythonInterface/mantid/simpleapi.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ def Load(*args, **kwargs):
163163
# then raise a more helpful error than what we would get from an algorithm
164164
if lhs[0] == 0 and "OutputWorkspace" not in kwargs:
165165
raise RuntimeError(
166-
"Unable to set output workspace name. Please either assign the output of "
167-
"Load to a variable or use the OutputWorkspace keyword."
166+
"Unable to set output workspace name. Please either assign the output of Load to a variable or use the OutputWorkspace keyword."
168167
)
169168

170169
lhs_args = _get_args_from_lhs(lhs, algm)
@@ -246,7 +245,7 @@ def handleSpecialProperty(name, value=None):
246245
# Check for any properties that aren't known and warn they will not be used
247246
for key in list(final_keywords.keys()):
248247
if key not in algm:
249-
logger.warning("You've passed a property (%s) to StartLiveData() " "that doesn't apply to this Instrument." % key)
248+
logger.warning("You've passed a property (%s) to StartLiveData() that doesn't apply to this Instrument." % key)
250249
del final_keywords[key]
251250

252251
set_properties(algm, **final_keywords)
@@ -450,7 +449,7 @@ def CutMD(*args, **kwargs): # noqa: C901
450449
# Ensure the output names we were given are valid
451450
if handling_multiple_workspaces:
452451
if not isinstance(out_names, list):
453-
raise RuntimeError("Multiple OutputWorkspaces must be given as a list when" " processing multiple InputWorkspaces.")
452+
raise RuntimeError("Multiple OutputWorkspaces must be given as a list when processing multiple InputWorkspaces.")
454453
else:
455454
# We wrap in a list for our convenience. The user must not pass us one though.
456455
if not isinstance(out_names, list):
@@ -1340,7 +1339,7 @@ def _update_sys_path(dirs):
13401339
logger.information("Path to plugins manifest is empty. The python plugins will not be loaded.")
13411340
elif not os.path.exists(plugins_manifest_path):
13421341
logger.warning(
1343-
"The path to the python plugins manifest is invalid. The built in python plugins will " "not be loaded into the simpleapi."
1342+
"The path to the python plugins manifest is invalid. The built in python plugins will not be loaded into the simpleapi."
13441343
)
13451344
else:
13461345
with open(plugins_manifest_path) as manifest:

Framework/PythonInterface/mantid/utils/dgs/_geometry.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def _qangle_validate_inputs(
154154

155155
if goniometer_constraints:
156156
if goniometer_range[1] < goniometer_range[0] or goniometer_range[0] < -180.0 or goniometer_range[1] > 180.0:
157-
raise ValueError("goniometer_range must be an increasing array, " "with both limits between -180 and 180 degrees")
157+
raise ValueError("goniometer_range must be an increasing array, with both limits between -180 and 180 degrees")
158158

159159
return (Ei, DeltaE, sign, UB)
160160

Framework/PythonInterface/plugins/algorithms/Abins2D.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def _get_properties(self):
285285

286286
self._instrument_kwargs.update({"chopper_frequency": chopper_frequency})
287287
elif self.getProperty("ChopperFrequency").value:
288-
logger.warning("The selected instrument does not use a chopper: " "chopper frequency will be ignored.")
288+
logger.warning("The selected instrument does not use a chopper: chopper frequency will be ignored.")
289289

290290
self.set_instrument()
291291

Framework/PythonInterface/plugins/algorithms/AlignComponents.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def PyInit(self):
233233
name="EulerConvention",
234234
defaultValue="YZX",
235235
validator=StringListValidator(eulerConventions),
236-
doc="Euler angles convention used when calculating and displaying angles," "eg XYZ corresponding to alpha beta gamma.",
236+
doc="Euler angles convention used when calculating and displaying angles, eg XYZ corresponding to alpha beta gamma.",
237237
)
238238

239239
# alpha rotation

Framework/PythonInterface/plugins/algorithms/BASISCrystalDiffraction.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def pyexec_setup(new_options):
105105

106106

107107
class BASISCrystalDiffraction(DataProcessorAlgorithm):
108-
_mask_file = "/SNS/BSS/shared/autoreduce/new_masks_08_12_2015/" "BASIS_Mask_default_diff.xml"
108+
_mask_file = "/SNS/BSS/shared/autoreduce/new_masks_08_12_2015/BASIS_Mask_default_diff.xml"
109109
_solid_angle_ws_ = "/SNS/BSS/shared/autoreduce/solid_angle_diff.nxs"
110110
_flux_ws_ = "/SNS/BSS/shared/autoreduce/int_flux.nxs"
111111
_wavelength_bands = {"311": [3.07, 3.60], "111": [6.05, 6.60]}
@@ -135,7 +135,7 @@ def version():
135135

136136
@staticmethod
137137
def summary():
138-
return "Multiple-file BASIS crystal reduction for diffraction " "detectors."
138+
return "Multiple-file BASIS crystal reduction for diffraction detectors."
139139

140140
@staticmethod
141141
def seeAlso():
@@ -219,7 +219,7 @@ def PyInit(self):
219219
#
220220
crystal_diffraction_title = "Single Crystal Diffraction"
221221
self.declareProperty(
222-
"PsiAngleLog", "SE50Rot", direction=Direction.Input, doc="log entry storing rotation of the sample" "around the vertical axis"
222+
"PsiAngleLog", "SE50Rot", direction=Direction.Input, doc="log entry storing rotation of the sample around the vertical axis"
223223
)
224224
self.declareProperty("PsiOffset", 0.0, direction=Direction.Input, doc="Add this quantity to PsiAngleLog")
225225
self.declareProperty(
@@ -233,23 +233,23 @@ def PyInit(self):
233233
# Reciprocal vector to be aligned with incoming beam
234234
self.declareProperty(
235235
FloatArrayProperty("VectorU", [1, 0, 0], array_length_three, direction=Direction.Input),
236-
doc="three item, comma-separated, HKL indexes" "of the diffracting plane",
236+
doc="three item, comma-separated, HKL indices of the diffracting plane",
237237
)
238238
# Reciprocal vector orthogonal to VectorU and in-plane with
239239
# incoming beam
240240
self.declareProperty(
241241
FloatArrayProperty("VectorV", [0, 1, 0], array_length_three, direction=Direction.Input),
242-
doc="three item, comma-separated, HKL indexes" "of the direction perpendicular to VectorV" "and the vertical axis",
242+
doc="three item, comma-separated, HKL indices of the direction perpendicular to VectorVand the vertical axis",
243243
)
244244
# Abscissa view
245245
self.declareProperty(
246246
FloatArrayProperty("Uproj", [1, 0, 0], array_length_three, direction=Direction.Input),
247-
doc="three item comma-separated Abscissa view" "of the diffraction pattern",
247+
doc="three item comma-separated Abscissa view of the diffraction pattern",
248248
)
249249
# Ordinate view
250250
self.declareProperty(
251251
FloatArrayProperty("Vproj", [0, 1, 0], array_length_three, direction=Direction.Input),
252-
doc="three item comma-separated Ordinate view" "of the diffraction pattern",
252+
doc="three item comma-separated Ordinate view of the diffraction pattern",
253253
)
254254
# Hidden axis
255255
self.declareProperty(FloatArrayProperty("Wproj", [0, 0, 1], array_length_three, direction=Direction.Input), doc="Hidden axis view")

Framework/PythonInterface/plugins/algorithms/BASISDiffraction.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def pyexec_setup(new_options):
9898

9999

100100
class BASISDiffraction(DataProcessorAlgorithm):
101-
_mask_file = "/SNS/BSS/shared/autoreduce/new_masks_08_12_2015/" "BASIS_Mask_default_diff.xml"
101+
_mask_file = "/SNS/BSS/shared/autoreduce/new_masks_08_12_2015/BASIS_Mask_default_diff.xml"
102102
_solid_angle_ws_ = "/SNS/BSS/shared/autoreduce/solid_angle_diff.nxs"
103103
_flux_ws_ = "/SNS/BSS/shared/autoreduce/int_flux.nxs"
104104

@@ -173,7 +173,7 @@ def PyInit(self):
173173
self.declareProperty("SingleCrystalDiffraction", False, direction=Direction.Input, doc="Calculate diffraction pattern?")
174174
crystal_diffraction_enabled = EnabledWhenProperty("SingleCrystalDiffraction", PropertyCriterion.IsNotDefault)
175175
self.declareProperty(
176-
"PsiAngleLog", "SE50Rot", direction=Direction.Input, doc="log entry storing rotation of the sample" "around the vertical axis"
176+
"PsiAngleLog", "SE50Rot", direction=Direction.Input, doc="log entry storing rotation of the sample around the vertical axis"
177177
)
178178
self.declareProperty("PsiOffset", 0.0, direction=Direction.Input, doc="Add this quantity to PsiAngleLog")
179179
self.declareProperty(
@@ -187,23 +187,23 @@ def PyInit(self):
187187
# Reciprocal vector to be aligned with incoming beam
188188
self.declareProperty(
189189
FloatArrayProperty("VectorU", [1, 0, 0], array_length_three, direction=Direction.Input),
190-
doc="three item, comma-separated, HKL indexes" "of the diffracting plane",
190+
doc="three item, comma-separated, HKL indices of the diffracting plane",
191191
)
192192
# Reciprocal vector orthogonal to VectorU and in-plane with
193193
# incoming beam
194194
self.declareProperty(
195195
FloatArrayProperty("VectorV", [0, 1, 0], array_length_three, direction=Direction.Input),
196-
doc="three item, comma-separated, HKL indexes" "of the direction perpendicular to VectorV" "and the vertical axis",
196+
doc="three item, comma-separated, HKL indices of the direction perpendicular to VectorVand the vertical axis",
197197
)
198198
# Abscissa view
199199
self.declareProperty(
200200
FloatArrayProperty("Uproj", [1, 0, 0], array_length_three, direction=Direction.Input),
201-
doc="three item comma-separated Abscissa view" "of the diffraction pattern",
201+
doc="three item comma-separated Abscissa view of the diffraction pattern",
202202
)
203203
# Ordinate view
204204
self.declareProperty(
205205
FloatArrayProperty("Vproj", [0, 1, 0], array_length_three, direction=Direction.Input),
206-
doc="three item comma-separated Ordinate view" "of the diffraction pattern",
206+
doc="three item comma-separated Ordinate view of the diffraction pattern",
207207
)
208208
# Hidden axis
209209
self.declareProperty(FloatArrayProperty("Wproj", [0, 0, 1], array_length_three, direction=Direction.Input), doc="Hidden axis view")

Framework/PythonInterface/plugins/algorithms/BASISPowderDiffraction.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def pyexec_setup(remove_temp, new_options):
164164

165165

166166
class BASISPowderDiffraction(DataProcessorAlgorithm):
167-
_mask_file = "/SNS/BSS/shared/autoreduce/new_masks_08_12_2015/" "BASIS_Mask_default_diff.xml"
167+
_mask_file = "/SNS/BSS/shared/autoreduce/new_masks_08_12_2015/BASIS_Mask_default_diff.xml"
168168
# Consider only events with these wavelengths
169169
_wavelength_bands = {"311": [3.07, 3.60], "111": [6.05, 6.60], "333": [2.02, 2.20]}
170170
_diff_bank_numbers = list(range(5, 14))

Framework/PythonInterface/plugins/algorithms/BilbySANSDataProcessor.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def PyInit(self):
9292
self.declareProperty(
9393
name="FitMethod",
9494
defaultValue="log",
95-
doc="Function to use to fit transmission; can be Linear," " Log, Polynomial (first letter shall be capital)",
95+
doc="Function to use to fit transmission; can be Linear, Log, Polynomial (first letter shall be capital)",
9696
)
9797

9898
self.declareProperty(
@@ -107,17 +107,17 @@ def PyInit(self):
107107

108108
self.declareProperty(
109109
FloatArrayProperty("BinningWavelength", direction=Direction.Input, validator=FloatArrayMandatoryValidator()),
110-
doc="Wavelength boundaries for reduction: a comma separated list of first bin boundary," " width, last bin boundary",
110+
doc="Wavelength boundaries for reduction: a comma separated list of first bin boundary, width, last bin boundary",
111111
)
112112

113113
self.declareProperty(
114114
FloatArrayProperty("BinningWavelengthTransm", direction=Direction.Input, validator=FloatArrayMandatoryValidator()),
115-
doc="Wavelengths boundaries for transmission binning: a comma separated list of first bin" " boundary, width, last bin",
115+
doc="Wavelengths boundaries for transmission binning: a comma separated list of first bin boundary, width, last bin",
116116
)
117117

118118
self.declareProperty(
119119
FloatArrayProperty("BinningQ", direction=Direction.Input, validator=FloatArrayMandatoryValidator()),
120-
doc="Output Q-boundaries: a comma separated list of first bin boundary," " width, last bin boundary",
120+
doc="Output Q-boundaries: a comma separated list of first bin boundary, width, last bin boundary",
121121
)
122122

123123
self.declareProperty(name="Timemode", defaultValue=True, doc="If data collected in ToF or monochromatic mode")
@@ -154,7 +154,7 @@ def PyInit(self):
154154

155155
self.declareProperty(
156156
MatrixWorkspaceProperty("OutputWorkspace", "", direction=Direction.Output),
157-
doc="Name of the workspace that contains the result of the calculation. " "Created automatically.",
157+
doc="Name of the workspace that contains the result of the calculation. Created automatically.",
158158
)
159159

160160
self.declareProperty(

Framework/PythonInterface/plugins/algorithms/CheckForSampleLogs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def PyInit(self):
3131
self.declareProperty(WorkspaceProperty("Workspace", "", Direction.Input), "The workspace to check.")
3232
self.declareProperty("LogNames", "", "Names of the logs to look for")
3333
self.declareProperty(
34-
"Result", "A string that will be empty if all the logs are found, " "otherwise will contain an error message", Direction.Output
34+
"Result", "A string that will be empty if all the logs are found, otherwise will contain an error message", Direction.Output
3535
)
3636
return
3737

Framework/PythonInterface/plugins/algorithms/CollectHB3AExperimentInfo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def PyInit(self):
8383
self.declareProperty(
8484
"GenerateVirtualInstrument",
8585
True,
86-
"If True, then the geometry of all the detectors will be written " "to DetectorTableWorkspace",
86+
"If True, then the geometry of all the detectors will be written to DetectorTableWorkspace",
8787
)
8888

8989
default_num_dets = 256 * 256

Framework/PythonInterface/plugins/algorithms/CompareSampleLogs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def PyInit(self):
5858
)
5959
self.declareProperty(
6060
"Result",
61-
"A string that will be empty if all the logs match, " "otherwise will contain a comma separated list of not matching logs",
61+
"A string that will be empty if all the logs match, otherwise will contain a comma separated list of not matching logs",
6262
Direction.Output,
6363
)
6464

Framework/PythonInterface/plugins/algorithms/ComputeIncoherentDOS.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,7 @@ def PyExec(self):
324324
def absoluteUnits(self, atoms):
325325
absunits = self.getProperty("StatesPerEnergy").value
326326
if absunits and len(atoms) != 1:
327-
self.log().warning(
328-
"Sample material information not set, or sample is not a pure element. " "Ignoring StatesPerEnergy property."
329-
)
327+
self.log().warning("Sample material information not set, or sample is not a pure element. Ignoring StatesPerEnergy property.")
330328
absunits = False
331329
return absunits
332330

0 commit comments

Comments
 (0)