Skip to content

ENH: Modify Directory and File traits to get along with pathlib #2959

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 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
8124823
ENH: Modify ``Directory`` and ``File`` traits to get along with pathlib
oesteban Jul 16, 2019
7aee40d
fix(traits): update ``ImageFile`` trait to match new ``File``
oesteban Jul 16, 2019
a2c53fb
fix(traits): set ``usedefault`` metadata to ``True``
oesteban Jul 16, 2019
a8f55bb
fix(traits): ``resolve`` meta was forced to ``True`` for ``File``
oesteban Jul 16, 2019
5f99d93
fix(traits): ``resolve`` of ``ImageFiles``, ``ImageFileSPM`` adapted …
oesteban Jul 16, 2019
addadb3
fix(traits): ensuring backwards compatibility of new traits
oesteban Jul 16, 2019
72f7fed
fix(interfaces): minor amends to SPM and AFNI interfaces
oesteban Jul 16, 2019
c8457e6
maint(specs): make specs
oesteban Jul 16, 2019
281f516
fix(traits): restore old ``usedefault`` behavior of ``File``s
oesteban Jul 16, 2019
6dbd76d
fix(interfaces): revise test that should pass
oesteban Jul 16, 2019
98d8308
fix(deps): add pathlib2 to requirements.txt
oesteban Jul 16, 2019
4b6e390
fix(specs): update specs
oesteban Jul 16, 2019
1134a6b
fix(dipy): resolve issues with dipy versions
oesteban Jul 16, 2019
005f87e
fix(io): repair ``io.S3DataGrabber`` which was not expecting path-lik…
oesteban Jul 16, 2019
d0f4bf5
fix(py<3.6): workaround for ``Path.resolve(strict=value)``
oesteban Jul 16, 2019
eeb53d0
fix(pathlib2): Import pathlib2 if python < 3.
oesteban Jul 16, 2019
398697a
fix(python2): make deepcopy to work with python2
oesteban Jul 16, 2019
08ddc9f
fix(python3): roll patch back to ``DynamicTraitedSpec.__deepcopy__``
oesteban Jul 16, 2019
8069604
fix(py>2,<3.6): fixed workaround for ``Path.resolve(strict=False)``
oesteban Jul 16, 2019
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(traits): resolve of ImageFiles, ImageFileSPM adapted …
…to new ``ImageFile``
  • Loading branch information
oesteban committed Jul 16, 2019
commit 5f99d935a649e872d30c13c190ec9a1ab4e26ce4
2 changes: 1 addition & 1 deletion nipype/interfaces/base/traits_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def __init__(self, default_value=NoDefaultSpecified, exists=False,

super(ImageFile, self).__init__(
default_value=default_value, exists=exists, extensions=extensions,
pathlike=pathlike, resolve=True, **metadata)
pathlike=pathlike, resolve=resolve, **metadata)


def isdefined(object):
Expand Down
20 changes: 6 additions & 14 deletions nipype/interfaces/spm/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from ..base import (BaseInterface, traits, isdefined, InputMultiPath,
BaseInterfaceInputSpec, Directory, Undefined, ImageFile,
PackageInfo)
from ..base.traits_extension import NoDefaultSpecified
from ..matlab import MatlabCommand
from ...external.due import due, Doi, BibTeX

Expand Down Expand Up @@ -601,15 +602,8 @@ class ImageFileSPM(ImageFile):
Defines an ImageFile trait specific to SPM interfaces.
"""

def __init__(self,
value='',
filter=None,
auto_set=False,
entries=0,
exists=False,
types=['nifti1', 'nifti2'],
allow_compressed=False,
**metadata):
def __init__(self, default_value=NoDefaultSpecified, exists=False,
pathlike=False, resolve=False, **metadata):
""" Trait handles neuroimaging files.

Parameters
Expand All @@ -619,8 +613,6 @@ def __init__(self,
compressed : boolean
Indicates whether the file format can compressed
"""
self.types = types
self.allow_compressed = allow_compressed
super(ImageFileSPM,
self).__init__(value, filter, auto_set, entries, exists, types,
allow_compressed, **metadata)
super(ImageFileSPM, self).__init__(
default_value=default_value, exists=exists, types=['nifti1', 'nifti2'],
pathlike=pathlike, resolve=resolve, **metadata)