Skip to content

Commit 5a74560

Browse files
committed
Improve python variable names to be more explicit
1 parent 0f8eef1 commit 5a74560

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/presenter/DrillPresenter.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,16 @@ def inc(value, i):
139139
if ":" in value:
140140
substrings = value.split(":")
141141
try:
142-
values = [int(e) for e in substrings]
142+
runs = [int(e) for e in substrings]
143143
except:
144144
return value
145-
if len(values) == 2:
145+
if len(runs) == 2:
146146
if i > 0:
147-
return str(values[1] + i) + ":" + str(values[1] + (values[1] - values[0]) + i)
147+
return str(runs[1] + i) + ":" + str(runs[1] + (runs[1] - runs[0]) + i)
148148
else:
149-
return str(values[0] - (values[1] - values[0]) + i) + ":" + str(values[0] + i)
150-
if len(values) == 3:
151-
return inc(str(values[0]) + ":" + str(values[1]), i) + ":" + str(values[2])
149+
return str(runs[0] - (runs[1] - runs[0]) + i) + ":" + str(runs[0] + i)
150+
if len(runs) == 3:
151+
return inc(str(runs[0]) + ":" + str(runs[1]), i) + ":" + str(runs[2])
152152
else:
153153
return value
154154

scripts/pychop/Instruments.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,10 @@ def getMeasuredFlux(self, Ei):
650650
"""Interpolates flux from a table of measured flux"""
651651
if not hasattr(self, "flux_interp"):
652652
raise AttributeError("This instrument does not have a table of measured flux")
653-
wavelength = [min(max(value, self.fmn), self.fmx) for value in np.sqrt(E2L / np.array(Ei if hasattr(Ei, "__len__") else [Ei]))]
654-
return self.flux_interp(wavelength[0])
653+
wavelengths = [
654+
min(max(wavelength, self.fmn), self.fmx) for wavelength in np.sqrt(E2L / np.array(Ei if hasattr(Ei, "__len__") else [Ei]))
655+
]
656+
return self.flux_interp(wavelengths[0])
655657

656658
@property
657659
def theta_m(self):

tools/CodeAnalysis/gcovr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -705,20 +705,20 @@ def print_xml_report(covdata): # noqa: C901
705705
class_lines += 1
706706
if hits > 0:
707707
class_hits += 1
708-
line = doc.createElement("line")
709-
line.setAttribute("number", str(line))
710-
line.setAttribute("hits", str(hits))
708+
line_element = doc.createElement("line")
709+
line_element.setAttribute("number", str(line))
710+
line_element.setAttribute("hits", str(hits))
711711
branches = data.branches.get(line)
712712
if branches is None:
713-
line.setAttribute("branch", "false")
713+
line_element.setAttribute("branch", "false")
714714
else:
715715
b_hits = 0
716716
for v in branches.values():
717717
if v > 0:
718718
b_hits += 1
719719
coverage = 100 * b_hits / len(branches)
720-
line.setAttribute("branch", "true")
721-
line.setAttribute("condition-coverage", "%i%% (%i/%i)" % (coverage, b_hits, len(branches)))
720+
line_element.setAttribute("branch", "true")
721+
line_element.setAttribute("condition-coverage", "%i%% (%i/%i)" % (coverage, b_hits, len(branches)))
722722
cond = doc.createElement("condition")
723723
cond.setAttribute("number", "0")
724724
cond.setAttribute("type", "jump")
@@ -727,9 +727,9 @@ def print_xml_report(covdata): # noqa: C901
727727
class_branches += float(len(branches))
728728
conditions = doc.createElement("conditions")
729729
conditions.appendChild(cond)
730-
line.appendChild(conditions)
730+
line_element.appendChild(conditions)
731731

732-
lines.appendChild(line)
732+
lines.appendChild(line_element)
733733

734734
className = fname.replace(".", "_")
735735
c.setAttribute("name", className)

0 commit comments

Comments
 (0)