Skip to content

Commit

Permalink
FIX/STY: Undefined variable and other flake8 checks
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Oct 4, 2021
1 parent 7f8d58e commit 5fe2c33
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions fmriprep/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _bids_filter(value, parser):
if Path(value).exists():
try:
return loads(Path(value).read_text(), object_hook=_filter_pybids_none_any)
except JSONDecodeError as e:
except JSONDecodeError:
raise parser.error(f"JSON syntax error in: <{value}>.")
else:
raise parser.error(f"Path does not exist: <{value}>.")
Expand All @@ -77,11 +77,10 @@ def _slice_time_ref(value, parser):
except ValueError:
raise parser.error("Slice time reference must be number, 'start', or 'middle'. "
f"Received {value}.")
if not 0 <= val <= 1:
if not 0 <= value <= 1:
raise parser.error(f"Slice time reference must be in range 0-1. Received {value}.")
return value


verstr = f"fMRIPrep v{config.environment.version}"
currentv = Version(config.environment.version)
is_release = not any(
Expand Down Expand Up @@ -627,7 +626,6 @@ def parse_args(args=None, namespace=None):
parser = _build_parser()
opts = parser.parse_args(args, namespace)


if opts.config_file:
skip = {} if opts.reports_only else {"execution": ("run_uuid",)}
config.load(opts.config_file, skip=skip)
Expand Down
4 changes: 2 additions & 2 deletions fmriprep/cli/tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ def test_bids_filter_file(tmp_path, capsys):

parser = _build_parser()

with pytest.raises(SystemExit) as error:
with pytest.raises(SystemExit):
parser.parse_args(args)

err = capsys.readouterr().err
assert "Path does not exist:" in err

bff.write_text('{"invalid json": }')

with pytest.raises(SystemExit) as error:
with pytest.raises(SystemExit):
parser.parse_args(args)

err = capsys.readouterr().err
Expand Down

0 comments on commit 5fe2c33

Please sign in to comment.