From 15074eb4426164c6e8dd1081ff669038f9d07012 Mon Sep 17 00:00:00 2001
From: David Fairbrother <DavidFair@users.noreply.github.com>
Date: Thu, 18 May 2017 17:24:57 +0100
Subject: [PATCH] Re #19500 Added PR suggestions

---
 scripts/Diffraction/isis_powder/abstract_inst.py          | 7 +++++++
 scripts/Diffraction/isis_powder/gem.py                    | 3 ++-
 scripts/Diffraction/isis_powder/pearl.py                  | 3 ++-
 scripts/Diffraction/isis_powder/polaris.py                | 3 ++-
 scripts/Diffraction/isis_powder/routines/common_output.py | 6 +++---
 scripts/test/ISISPowderCommonTest.py                      | 2 +-
 6 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/scripts/Diffraction/isis_powder/abstract_inst.py b/scripts/Diffraction/isis_powder/abstract_inst.py
index b79f1764e79..e4631eb8dfa 100644
--- a/scripts/Diffraction/isis_powder/abstract_inst.py
+++ b/scripts/Diffraction/isis_powder/abstract_inst.py
@@ -226,6 +226,13 @@ class AbstractInst(object):
 
     # Steps applicable to all instruments
 
+    @staticmethod
+    def _generate_run_details_fingerprint(*args):
+        out_key = ""
+        for arg in args:
+            out_key += str(arg)
+        return out_key
+
     def _generate_out_file_paths(self, run_details):
         """
         Generates the various output paths and file names to be used during saving or as workspace names
diff --git a/scripts/Diffraction/isis_powder/gem.py b/scripts/Diffraction/isis_powder/gem.py
index 553b1b0e9f4..56ded044d80 100644
--- a/scripts/Diffraction/isis_powder/gem.py
+++ b/scripts/Diffraction/isis_powder/gem.py
@@ -29,7 +29,8 @@ class Gem(AbstractInst):
                                      do_absorb_corrections=self._inst_settings.do_absorb_corrections)
 
     def _get_run_details(self, run_number_string):
-        run_number_string_key = run_number_string + str(self._inst_settings.file_extension)
+        run_number_string_key = self._generate_run_details_fingerprint(run_number_string,
+                                                                       self._inst_settings.file_extension)
         if run_number_string_key in self._cached_run_details:
             return self._cached_run_details[run_number_string_key]
 
diff --git a/scripts/Diffraction/isis_powder/pearl.py b/scripts/Diffraction/isis_powder/pearl.py
index 947b7144b34..c70774104fc 100644
--- a/scripts/Diffraction/isis_powder/pearl.py
+++ b/scripts/Diffraction/isis_powder/pearl.py
@@ -44,7 +44,8 @@ class Pearl(AbstractInst):
                                      do_absorb_corrections=self._inst_settings.absorb_corrections)
 
     def _get_run_details(self, run_number_string):
-        run_number_string_key = run_number_string + str(self._inst_settings.file_extension)
+        run_number_string_key = self._generate_run_details_fingerprint(run_number_string,
+                                                                       self._inst_settings.file_extension)
         if run_number_string_key in self._cached_run_details:
             return self._cached_run_details[run_number_string_key]
 
diff --git a/scripts/Diffraction/isis_powder/polaris.py b/scripts/Diffraction/isis_powder/polaris.py
index b365c8ac351..7c3d58281ba 100644
--- a/scripts/Diffraction/isis_powder/polaris.py
+++ b/scripts/Diffraction/isis_powder/polaris.py
@@ -89,7 +89,8 @@ class Polaris(AbstractInst):
         return self._inst_settings.focused_bin_widths
 
     def _get_run_details(self, run_number_string):
-        run_number_string_key = run_number_string + str(self._inst_settings.file_extension)
+        run_number_string_key = self._generate_run_details_fingerprint(run_number_string,
+                                                                       self._inst_settings.file_extension)
         if run_number_string_key in self._run_details_cached_obj:
             return self._run_details_cached_obj[run_number_string_key]
 
diff --git a/scripts/Diffraction/isis_powder/routines/common_output.py b/scripts/Diffraction/isis_powder/routines/common_output.py
index 02a4fbe5f54..9a47c636080 100644
--- a/scripts/Diffraction/isis_powder/routines/common_output.py
+++ b/scripts/Diffraction/isis_powder/routines/common_output.py
@@ -18,9 +18,9 @@ def split_into_tof_d_spacing_groups(run_details, processed_spectra):
     tof_output = []
     run_number = str(run_details.output_run_string)
     ext = run_details.file_extension if run_details.file_extension else ""
-    for name_index, ws in enumerate(processed_spectra):
-        d_spacing_out_name = run_number + ext + "-ResultD-" + str(name_index + 1)
-        tof_out_name = run_number + ext + "-ResultTOF-" + str(name_index + 1)
+    for name_index, ws in enumerate(processed_spectra, start=1):
+        d_spacing_out_name = run_number + ext + "-ResultD-" + str(name_index)
+        tof_out_name = run_number + ext + "-ResultTOF-" + str(name_index)
 
         d_spacing_output.append(mantid.ConvertUnits(InputWorkspace=ws, OutputWorkspace=d_spacing_out_name,
                                                     Target="dSpacing"))
diff --git a/scripts/test/ISISPowderCommonTest.py b/scripts/test/ISISPowderCommonTest.py
index 68ece3c1035..c1ad2cea4e3 100644
--- a/scripts/test/ISISPowderCommonTest.py
+++ b/scripts/test/ISISPowderCommonTest.py
@@ -474,7 +474,7 @@ class ISISPowderCommonTest(unittest.TestCase):
         returned_ws = common.subtract_summed_runs(ws_to_correct=no_scale_ws, instrument=ISISPowderMockInst(),
                                                   empty_sample_ws_string=sample_empty_number)
         y_values = returned_ws.readY(0)
-        for i in range(0, returned_ws.blocksize()):
+        for i in range(returned_ws.blocksize()):
             self.assertAlmostEqual(y_values[i], 0)
 
         # Check what happens when we specify scale as a half
-- 
GitLab