Skip to content

Commit

Permalink
Fix merge issues: 'fsl_checkfirst_function' to 'dev'
Browse files Browse the repository at this point in the history
Also solves issues of inconsistent return statements reported by newer versions of pylint, reverting 8bb9eb9 merged in #1211.
  • Loading branch information
Lestropie committed Dec 20, 2017
1 parent baf43d2 commit 58bb181
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/mrtrix3/_5ttgen/fsl.py
Expand Up @@ -35,7 +35,7 @@ def getInputs(): #pylint: disable=unused-variable

def execute(): #pylint: disable=unused-variable
import math, os
from mrtrix3 import app, file, fsl, image, path, run #pylint: disable=redefined-builtin
from mrtrix3 import app, fsl, image, run

if app.isWindows():
app.error('\'fsl\' algorithm of 5ttgen script cannot be run on Windows: FSL not available on Windows')
Expand Down
1 change: 0 additions & 1 deletion lib/mrtrix3/app.py
Expand Up @@ -867,7 +867,6 @@ def done(self):
import sys
global verbosity
global clearLine, colourConsole, colourClear, colourExec
self.counter = self.target
self.iscomplete = True
self.value = 100
if self.isatty:
Expand Down
3 changes: 2 additions & 1 deletion lib/mrtrix3/fsl.py
Expand Up @@ -89,7 +89,7 @@ def exeName(name): #pylint: disable=unused-variable
# FSL commands will generate based on the suffix() function, the FSL binaries themselves
# ignore the FSLOUTPUTTYPE environment variable. Therefore, the safest approach is:
# Whenever receiving an output image from an FSL command, explicitly search for the path
def findImage(name): #pylint: disable=unused-variable,inconsistent-return-statements
def findImage(name): #pylint: disable=unused-variable
import os
from mrtrix3 import app
prefix = os.path.join(os.path.dirname(name), os.path.basename(name).split('.')[0])
Expand All @@ -101,6 +101,7 @@ def findImage(name): #pylint: disable=unused-variable,inconsistent-return-statem
app.debug('Expected image at \"' + prefix + suffix() + '\", but found at \"' + prefix + suf + '\"')
return prefix + suf
app.error('Unable to find FSL output file for path \"' + name + '\"')
return ''



Expand Down
11 changes: 6 additions & 5 deletions lib/mrtrix3/run.py
Expand Up @@ -23,7 +23,7 @@ def setContinue(filename): #pylint: disable=unused-variable



def command(cmd, exitOnError=True): #pylint: disable=unused-variable,inconsistent-return-statements
def command(cmd, exitOnError=True): #pylint: disable=unused-variable

import inspect, itertools, shlex, signal, string, subprocess, sys, tempfile
from distutils.spawn import find_executable
Expand All @@ -41,7 +41,7 @@ def command(cmd, exitOnError=True): #pylint: disable=unused-variable,inconsisten
if app.verbosity:
sys.stderr.write(app.colourExec + 'Skipping command:' + app.colourClear + ' ' + cmd + '\n')
sys.stderr.flush()
return
return ('', '')

# This splits the command string based on the piping character '|', such that each
# individual executable (along with its arguments) appears as its own list
Expand Down Expand Up @@ -235,7 +235,7 @@ def command(cmd, exitOnError=True): #pylint: disable=unused-variable,inconsisten



def function(fn, *args): #pylint: disable=unused-variable,inconsistent-return-statements
def function(fn, *args): #pylint: disable=unused-variable

import inspect, sys
from mrtrix3 import app
Expand All @@ -248,7 +248,7 @@ def function(fn, *args): #pylint: disable=unused-variable,inconsistent-return-st
if app.verbosity:
sys.stderr.write(app.colourExec + 'Skipping function:' + app.colourClear + ' ' + fnstring + '\n')
sys.stderr.flush()
return
return None

if app.verbosity:
sys.stderr.write(app.colourExec + 'Function:' + app.colourClear + ' ' + fnstring + '\n')
Expand Down Expand Up @@ -327,7 +327,7 @@ def exeName(item):
# or a non-MRtrix3 command with the same name as an MRtrix3 command
# (e.g. C:\Windows\system32\mrinfo.exe; On Windows, subprocess uses CreateProcess(),
# which checks system32\ before PATH)
def versionMatch(item): #pylint: disable=inconsistent-return-statements
def versionMatch(item):
from distutils.spawn import find_executable
from mrtrix3 import app
global _mrtrix_bin_path, _mrtrix_exe_list
Expand All @@ -347,6 +347,7 @@ def versionMatch(item): #pylint: disable=inconsistent-return-statements
return exe_path_sys

app.error('Unable to find executable for MRtrix3 command ' + item)
return ''



Expand Down

0 comments on commit 58bb181

Please sign in to comment.