Skip to content

Commit

Permalink
STYLE: Fix missing whitespace after keyword
Browse files Browse the repository at this point in the history
* Missing whitespace after keyword
  See https://www.flake8rules.com/rules/E275.html
  • Loading branch information
jamesobutler authored and jcfr committed Oct 11, 2022
1 parent 6627cbe commit 415aee6
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def parse_nhdr(path):

with open(path) as f:
magic = f.readline().strip()
assert(magic == "NRRD0005")
assert magic == "NRRD0005"

while True:
line = f.readline()
Expand All @@ -40,13 +40,13 @@ def parse_nhdr(path):

# careful about precedence -- ":=" must match first
key, val = (x.strip() for x in re.split(":=|=|:", line))
assert(key not in kvdict)
assert key not in kvdict
kvdict[key] = val

if key.startswith(dwmri_grad_keybase):
_gn = int(key[len(dwmri_grad_keybase):None])
# monotonic keys
assert(_gn == grad_count) # offset
assert _gn == grad_count # offset
grad_count += 1

bvalue = float(kvdict[dwmri_bval_key])
Expand Down Expand Up @@ -94,7 +94,7 @@ def test_nrrd_dwi_load(first_file, second_file=None):
##################################
# 1) check the number of gradients

assert(len(parsed_nrrd.gradients) == slicer_numgrads)
assert len(parsed_nrrd.gradients) == slicer_numgrads

##################################
# 2) check the node b values and gradients are correct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ def check_exit_code(slicer_executable, testing_enabled=True, debug=False):
args.append('--exit-after-startup')
(returnCode, stdout, stderr) = run(slicer_executable, args)

assert(os.path.isfile(test_output_file))
assert os.path.isfile(test_output_file)

if testing_enabled:
assert(returnCode == EXIT_FAILURE)
assert returnCode == EXIT_FAILURE
else:
assert(returnCode == EXIT_SUCCESS)
assert returnCode == EXIT_SUCCESS

finally:
if not debug:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@
# Test startupCompleted with main window
args = list(common_args)
(returnCode, stdout, stderr) = runSlicerAndExit(slicer_executable, args)
assert(os.path.isfile(test_output_file))
assert os.path.isfile(test_output_file)
os.remove(test_output_file)
assert(returnCode == EXIT_SUCCESS)
assert returnCode == EXIT_SUCCESS
print("Test startupCompleted with main window - passed\n")

# Test startupCompleted without main window
args = list(common_args)
args.extend(['--no-main-window'])
(returnCode, stdout, stderr) = runSlicerAndExit(slicer_executable, args)
assert(os.path.isfile(test_output_file))
assert(returnCode == EXIT_SUCCESS)
assert os.path.isfile(test_output_file)
assert returnCode == EXIT_SUCCESS
print("Test startupCompleted without main window - passed\n")

finally:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ def run(self):
nose = [4.61944, 114.526, -33.2143]
controlPointIndex = fidNode.AddControlPoint(eye1)
slicer.nodeEvents = self.nodeEvents
assert(len(self.nodeEvents) == 1)
assert(self.nodeEvents[0] == slicer.vtkMRMLMarkupsNode.PointPositionDefinedEvent)
assert len(self.nodeEvents) == 1
assert self.nodeEvents[0] == slicer.vtkMRMLMarkupsNode.PointPositionDefinedEvent
fidNode.SetNthControlPointLabel(controlPointIndex, "eye-1")
controlPointIndex = fidNode.AddControlPoint(eye2)
fidNode.SetNthControlPointLabel(controlPointIndex, "eye-2")
Expand Down
2 changes: 1 addition & 1 deletion Modules/Scripted/DICOMLib/DICOMPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def hashFiles(self, files):
for f in files:
# Unicode-objects must be encoded before hashing
m.update(f.encode('UTF-8', 'ignore'))
return(m.digest())
return m.digest()

def getCachedLoadables(self, files):
""" Helper method to access the results of a previous
Expand Down
4 changes: 2 additions & 2 deletions Modules/Scripted/DICOMPlugins/DICOMScalarVolumePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def loadFilesWithArchetype(self, files, name):
for f in files:
fileList.InsertNextValue(f)
volumesLogic = slicer.modules.volumes.logic()
return(volumesLogic.AddArchetypeScalarVolume(files[0], name, 0, fileList))
return volumesLogic.AddArchetypeScalarVolume(files[0], name, 0, fileList)

def loadFilesWithSeriesReader(self, imageIOName, files, name, grayscale=True):
""" Explicitly use the named imageIO to perform the loading
Expand Down Expand Up @@ -416,7 +416,7 @@ def loadFilesWithSeriesReader(self, imageIOName, files, name, grayscale=True):
slicer.modules.DICOMInstance.reader = reader
slicer.modules.DICOMInstance.imageChangeInformation = imageChangeInformation

return(volumeNode)
return volumeNode

def setVolumeNodeProperties(self, volumeNode, loadable):
"""After the scalar volume has been loaded, populate the node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def isValidInputOutputData(inputVolumeNode, outputVolumeNode, conversionMethod,
# SINGLE_COMPONENT: Check that input has enough components for the given componentToExtract
if conversionMethod == VectorToScalarVolumeLogic.SINGLE_COMPONENT:
# componentToExtract is an index with valid values in the range: [0, numberOfComponents-1]
if not(0 <= componentToExtract < numberOfComponents):
if not 0 <= componentToExtract < numberOfComponents:
msg = 'componentToExtract %d is invalid. Image has only %d components.' % (componentToExtract, numberOfComponents)
logging.debug("isValidInputOutputData failed: %s" % msg)
return False, msg
Expand Down

0 comments on commit 415aee6

Please sign in to comment.