From 90f526a373621796fcc16aefd1b9288dbce8e85a Mon Sep 17 00:00:00 2001 From: Kort Travis Date: Thu, 14 Nov 2024 11:44:38 -0500 Subject: [PATCH] ruff fixups --- src/snapred/backend/recipe/EffectiveInstrumentRecipe.py | 5 +---- src/snapred/ui/workflow/DiffCalWorkflow.py | 2 +- tests/unit/backend/recipe/test_EffectiveInstrumentRecipe.py | 4 ++-- tests/util/SculleryBoy.py | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/snapred/backend/recipe/EffectiveInstrumentRecipe.py b/src/snapred/backend/recipe/EffectiveInstrumentRecipe.py index 82cf99c05..16642d25c 100644 --- a/src/snapred/backend/recipe/EffectiveInstrumentRecipe.py +++ b/src/snapred/backend/recipe/EffectiveInstrumentRecipe.py @@ -11,9 +11,6 @@ logger = snapredLogger.getLogger(__name__) Pallet = Tuple[Ingredients, Dict[str, str]] - -def _to_degree(radian: float) -> float: - return radian * 180.0 / np.pi @Singleton class EffectiveInstrumentRecipe(Recipe[Ingredients]): @@ -33,7 +30,7 @@ def queueAlgos(self): self.mantidSnapper.EditInstrumentGeometry( f"Editing instrument geometry for grouping '{self.unmaskedPixelGroup.focusGroup.name}'", Workspace=self.inputWS, - # :( Anyone ever heard of SI units?! + # TODO: Mantid defect: allow SI units here! L2=np.rad2deg(self.unmaskedPixelGroup.L2), Polar=np.rad2deg(self.unmaskedPixelGroup.twoTheta), Azimuthal=np.rad2deg(self.unmaskedPixelGroup.azimuth), diff --git a/src/snapred/ui/workflow/DiffCalWorkflow.py b/src/snapred/ui/workflow/DiffCalWorkflow.py index 00e55f8f4..e492f98fb 100644 --- a/src/snapred/ui/workflow/DiffCalWorkflow.py +++ b/src/snapred/ui/workflow/DiffCalWorkflow.py @@ -381,7 +381,7 @@ def purgeBadPeaks(self, maxChiSq): self._tweakPeakView, "Too Few Peaks", "Purging would result in fewer than the required 2 peaks for calibration. " - "The current set of peaks will be retained.", + + "The current set of peaks will be retained.", QMessageBox.Ok, ) else: diff --git a/tests/unit/backend/recipe/test_EffectiveInstrumentRecipe.py b/tests/unit/backend/recipe/test_EffectiveInstrumentRecipe.py index c92922bfb..b8537d83e 100644 --- a/tests/unit/backend/recipe/test_EffectiveInstrumentRecipe.py +++ b/tests/unit/backend/recipe/test_EffectiveInstrumentRecipe.py @@ -16,7 +16,7 @@ class TestEffectiveInstrumentRecipe: sculleryBoy = SculleryBoy() @pytest.fixture(autouse=True) - def setup(self): + def _setup(self): self.ingredients = mock.Mock( spec=Ingredients, unmaskedPixelGroup=mock.Mock( @@ -115,7 +115,7 @@ def test_cater(self): groceriess = [{"inputWorkspace": mock.Mock()}, {"inputWorkspace": mock.Mock()}] - output = recipe.cater(zip(ingredientss, groceriess)) + recipe.cater(zip(ingredientss, groceriess)) assert mockSnapper.EditInstrumentGeometry.call_count == 2 mockSnapper.EditInstrumentGeometry.assert_any_call( diff --git a/tests/util/SculleryBoy.py b/tests/util/SculleryBoy.py index d525b264e..ec485379c 100644 --- a/tests/util/SculleryBoy.py +++ b/tests/util/SculleryBoy.py @@ -92,7 +92,7 @@ def prepDetectorPeaks(self, ingredients: FarmFreshIngredients, purgePeaks=False) except (TypeError, AttributeError): return [mock.Mock(spec_set=GroupPeakList)] - def prepReductionIngredients(self, ingredients: FarmFreshIngredients, combinedPixelMask: Optional[WorkspaceName] = None): # noqa ARG002 + def prepReductionIngredients(self, _ingredients: FarmFreshIngredients, _combinedPixelMask: Optional[WorkspaceName] = None): path = Resource.getPath("/inputs/calibration/ReductionIngredients.json") return parse_file_as(ReductionIngredients, path)