Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[MAINT] Outsource checks of inputs from interface #2799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 25 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7cb2038
[MAINT] Outsource checks of inputs from interface
oesteban Nov 25, 2018
a15c6fb
remove forgotten print
oesteban Nov 25, 2018
a3600d9
fix mutually-exclusive check
oesteban Nov 25, 2018
c095d65
fix bug trying to append a spec.xor that is None
oesteban Nov 25, 2018
61d553c
fix precedence
oesteban Nov 25, 2018
1ade70c
outsource ``_check_version_requirements``
oesteban Nov 25, 2018
94c0823
fix multiple xor check
oesteban Nov 25, 2018
fddec69
fix check_requires for non-mandatory requires
oesteban Nov 25, 2018
34cb9c9
fix massaging xored inputs
oesteban Nov 25, 2018
523475e
Merge remote-tracking branch 'upstream/master' into maint/outsource-c…
oesteban Nov 25, 2018
41a48bd
fix test_extra_Registration
oesteban Nov 25, 2018
8f8ceb1
fixed fsl.utils doctests
oesteban Nov 25, 2018
d0c6ab8
cmdline returns ``None`` instead of raising if error on inputs
oesteban Nov 25, 2018
1b948cf
fix one more use-case
oesteban Nov 25, 2018
1a558a4
fixed tests
oesteban Nov 25, 2018
b08b5ad
fix errors checking xor
oesteban Nov 25, 2018
44a724d
fix fs.preprocess test
oesteban Nov 25, 2018
f7b5650
fix fsl.tests.test_preprocess
oesteban Nov 26, 2018
294850b
fix fsl.tests.test_preprocess
oesteban Nov 26, 2018
13ac0b9
Merge branch 'maint/outsource-checks' of github.com:oesteban/nipype i…
oesteban Nov 26, 2018
89da56a
install caplog fixture
oesteban Nov 26, 2018
fff59eb
pin pytest>=3.4 for reliable caplog fixture
oesteban Nov 26, 2018
ce41579
Merge branch 'master' into maint/outsource-checks
oesteban Nov 27, 2018
7967b08
Merge remote-tracking branch 'upstream/master' into maint/outsource-c…
oesteban Nov 28, 2018
2d5fd05
Merge branch 'maint/outsource-checks' of github.com:oesteban/nipype i…
oesteban Nov 28, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix one more use-case
  • Loading branch information
oesteban committed Nov 25, 2018
commit 1b948cfedf02202b0e2d2b8ffff2c1bd1fd48883
17 changes: 10 additions & 7 deletions 17 nipype/interfaces/base/specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,15 @@ def check_mandatory_inputs(inputs, raise_exc=True):
value = getattr(inputs, name)
# Mandatory field is defined, check xor'ed inputs
xor = spec.xor or []
has_xor = bool(xor)
has_value = isdefined(value)

# Simplest case: no xor metadata and not defined
if not has_xor and not has_value:
if raise_exc:
raise MandatoryInputError(inputs, name)
return False

xor = list(xor) if isinstance(xor, (list, tuple)) \
else [xor]
xor = list(set([name] + xor))
Expand All @@ -437,14 +446,8 @@ def check_mandatory_inputs(inputs, raise_exc=True):
inputs, name, values_defined=cxor)
return False

# Simplest case: no xor metadata and not defined
if cxor is True and not isdefined(value):
if raise_exc:
raise MandatoryInputError(inputs, name)
return False

# Check whether mandatory inputs require others
if not check_requires(inputs, spec.requires):
if has_value and not check_requires(inputs, spec.requires):
if raise_exc:
raise RequiredInputError(inputs, name)
return False
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.