Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #530

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repos:
- id: trailing-whitespace
exclude: "tests/cis_tests/.*"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
rev: v0.9.3
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
3 changes: 1 addition & 2 deletions src/snapred/backend/dao/state/RunNumber.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ def validateRunNumber(cls, value):
f"Run number {value} does not meet the minimum required value or does not have cached data available."
)
raise ValueError(
f"Run number {value} is below the minimum value or data does not exist."
"Please enter a valid run number."
f"Run number {value} is below the minimum value or data does not exist.Please enter a valid run number."
)

return value
Expand Down
2 changes: 1 addition & 1 deletion src/snapred/backend/error/StateValidationException.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self, exception: Exception):
doesFileExist, hasWritePermission = self._checkFileAndPermissions(filePath)

if filePath and doesFileExist and hasWritePermission:
self.message = f"The following error occurred:{exceptionStr}\n\n" "Please contact your IS or CIS."
self.message = f"The following error occurred:{exceptionStr}\n\nPlease contact your IS or CIS."
elif filePath and doesFileExist:
self.message = f"You do not have write permissions: {filePath}"
elif filePath:
Expand Down
2 changes: 1 addition & 1 deletion src/snapred/backend/service/CalibrationService.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def pixelCalibration(self, request: SimpleDiffCalRequest) -> PixelDiffCalServing
res.result = False
raise Exception(
(
f"WARNING: More than {threshold*100}% of pixels failed calibration. Please check your input "
f"WARNING: More than {threshold * 100}% of pixels failed calibration. Please check your input "
"data. If input data has poor statistics, you may get better results by disabling Cross "
"Correlation. You can also improve statistics by activating Lite mode if this is not "
"already activated."
Expand Down
3 changes: 1 addition & 2 deletions src/snapred/backend/service/ReductionService.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ def validateReduction(self, request: ReductionRequest):
# Case: No calibration but normalization exists
continueFlags |= ContinueWarning.Type.MISSING_DIFFRACTION_CALIBRATION
message = (
"Warning: diffraction calibration is missing."
"If you continue, default instrument geometry will be used."
"Warning: diffraction calibration is missing.If you continue, default instrument geometry will be used."
)
elif calibrationExists and not normalizationExists:
# Case: Calibration exists but normalization is missing
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/backend/dao/test_CalibrantSample.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ def test_setCalibrantSample(self):
ref = f"""
<type name="userShape">
<{self.geo.shape.lower()} id="sample-shape">
<centre-of-bottom-base x="0" y="{-round(self.geo.height*0.005,3)}" z="0"/>
<centre-of-bottom-base x="0" y="{-round(self.geo.height * 0.005, 3)}" z="0"/>
<axis x="0" y="1" z="0"/>
<height val="{round(self.geo.height*0.01,3)}"/>
<radius val="{round(self.geo.radius*0.01,3)}"/>
<height val="{round(self.geo.height * 0.01, 3)}"/>
<radius val="{round(self.geo.radius * 0.01, 3)}"/>
</{self.geo.shape.lower()}>
</type>
"""
Expand Down
16 changes: 8 additions & 8 deletions tests/unit/backend/dao/test_Geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ def test_settableInMantidJSON(self):
ref = f"""
<type name="userShape">
<{self.cylinder.shape.lower()} id="sample-shape">
<centre-of-bottom-base x="0" y="{-self.cylinder.height*0.005}" z="0"/>
<centre-of-bottom-base x="0" y="{-self.cylinder.height * 0.005}" z="0"/>
<axis x="0" y="1" z="0"/>
<height val="{self.cylinder.height*0.01}"/>
<radius val="{self.cylinder.radius*0.01}"/>
<height val="{self.cylinder.height * 0.01}"/>
<radius val="{self.cylinder.radius * 0.01}"/>
</{self.cylinder.shape.lower()}>
</type>
"""
Expand All @@ -111,7 +111,7 @@ def test_settableInMantidJSON(self):
<type name="userShape">
<{self.sphere.shape.lower()} id="sphere">
<center x="0" y="0" z="0"/>
<radius val="{self.sphere.radius*0.01}"/>
<radius val="{self.sphere.radius * 0.01}"/>
</{self.sphere.shape.lower()}>
</type>
"""
Expand All @@ -138,10 +138,10 @@ def test_settableInMantidDict(self):
ref = f"""
<type name="userShape">
<{self.cylinder.shape.lower()} id="sample-shape">
<centre-of-bottom-base x="0" y="{-self.cylinder.height*0.005}" z="0"/>
<centre-of-bottom-base x="0" y="{-self.cylinder.height * 0.005}" z="0"/>
<axis x="0" y="1" z="0"/>
<height val="{self.cylinder.height*0.01}"/>
<radius val="{self.cylinder.radius*0.01}"/>
<height val="{self.cylinder.height * 0.01}"/>
<radius val="{self.cylinder.radius * 0.01}"/>
</{self.cylinder.shape.lower()}>
</type>
"""
Expand All @@ -159,7 +159,7 @@ def test_settableInMantidDict(self):
<type name="userShape">
<{self.sphere.shape.lower()} id="sphere">
<center x="0" y="0" z="0"/>
<radius val="{self.sphere.radius*0.01}"/>
<radius val="{self.sphere.radius * 0.01}"/>
</{self.sphere.shape.lower()}>
</type>
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def makeFakeNeutronData(self, rawWsName: str, focusWSname: str) -> None:
OutputWorkspace=rawWsName,
# WorkspaceType="Histogram",
Function="User Defined",
UserDefinedFunction=f"name=Gaussian,Height=10,PeakCentre={midpoint},Sigma={midpoint/10}",
UserDefinedFunction=f"name=Gaussian,Height=10,PeakCentre={midpoint},Sigma={midpoint / 10}",
Xmin=overallDMin,
Xmax=overallDMax,
BinWidth=abs(dBin),
Expand Down Expand Up @@ -202,7 +202,7 @@ def test_failedValidation_inputGroupingIdsMismatch(self):
OutputWorkspace=self.fakeRawData,
# WorkspaceType="Histogram",
Function="User Defined",
UserDefinedFunction=f"name=Gaussian,Height=10,PeakCentre={midpoint},Sigma={midpoint/10}",
UserDefinedFunction=f"name=Gaussian,Height=10,PeakCentre={midpoint},Sigma={midpoint / 10}",
Xmin=overallDMin,
Xmax=overallDMax,
BinWidth=abs(dBin),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ def test_chop_ingredients(self):
assert groupID in algo.groupIDs, f"Group ID {groupID} not found in maskRegions"

expected_group_ids = [peakList.groupID for peakList in peaks]
assert (
algo.groupIDs == expected_group_ids
), f"Group IDs in workspace and peak list do not match: {algo.groupIDs} vs {expected_group_ids}"
assert algo.groupIDs == expected_group_ids, (
f"Group IDs in workspace and peak list do not match: {algo.groupIDs} vs {expected_group_ids}"
)

def test_incorrect_group_ids(self):
peaks = [
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/backend/recipe/test_ReductionRecipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,14 +747,14 @@ def test_execute_with_fully_masked_group(self, mockMtd):
recipe.logger().warning.assert_any_call(expected_warning_message_group2)

# Ensure the warning was called twice (once per group)
assert (
recipe.logger().warning.call_count == 2
), "Expected warning to be logged twice for the fully masked groups."
assert recipe.logger().warning.call_count == 2, (
"Expected warning to be logged twice for the fully masked groups."
)

# Ensure no algorithms were applied for the fully masked groups
assert (
recipe._applyRecipe.call_count == 2
), "Expected _applyRecipe to not be called for the fully masked groups."
assert recipe._applyRecipe.call_count == 2, (
"Expected _applyRecipe to not be called for the fully masked groups."
)

# Check the output result contains the mask workspace
assert result["outputs"][0] == "mask", "Expected the mask workspace to be included in the outputs."
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/meta/test_Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ def test_key_substitution():


def test_multi_level_substitution():
assert Config["test.data.home.write"] == f'~/{Config["test.config.home"]}/data/{Config["test.config.name"]}'
assert Config["test.data.home.read"] == f'{Config["test.config.home"]}/data/{Config["test.config.name"]}'
assert Config["test.data.home.write"] == f"~/{Config['test.config.home']}/data/{Config['test.config.name']}"
assert Config["test.data.home.read"] == f"{Config['test.config.home']}/data/{Config['test.config.name']}"


def test_fromMantidLoggingLevel():
Expand Down
Loading