Skip to content

Commit 365d9c5

Browse files
committed
resolving conflicts
2 parents 5cebe22 + 4cd2e42 commit 365d9c5

File tree

5 files changed

+39
-38
lines changed

5 files changed

+39
-38
lines changed

nipype/interfaces/ants/registration.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,7 @@ class RegistrationSynQuick(ANTSCommand):
15531553
>>> reg.inputs.moving_image = 'moving1.nii'
15541554
>>> reg.inputs.num_threads = 2
15551555
>>> reg.cmdline
1556-
'antsRegistrationSynQuick.sh -d 3 -f fixed1.nii -r 32 -m moving1.nii -n 2 -o transform -p d -s 26 -t s'
1556+
'antsRegistrationSyNQuick.sh -d 3 -f fixed1.nii -r 32 -m moving1.nii -n 2 -o transform -p d -s 26 -t s'
15571557
>>> reg.run() # doctest: +SKIP
15581558
15591559
example for multiple images
@@ -1564,19 +1564,19 @@ class RegistrationSynQuick(ANTSCommand):
15641564
>>> reg.inputs.moving_image = ['moving1.nii', 'moving2.nii']
15651565
>>> reg.inputs.num_threads = 2
15661566
>>> reg.cmdline
1567-
'antsRegistrationSynQuick.sh -d 3 -f fixed1.nii -f fixed2.nii -r 32 -m moving1.nii -m moving2.nii -n 2 -o transform -p d -s 26 -t s'
1567+
'antsRegistrationSyNQuick.sh -d 3 -f fixed1.nii -f fixed2.nii -r 32 -m moving1.nii -m moving2.nii \
1568+
-n 2 -o transform -p d -s 26 -t s'
15681569
>>> reg.run() # doctest: +SKIP
15691570
"""
15701571

1571-
1572-
_cmd = 'antsRegistrationSynQuick.sh'
1572+
_cmd = 'antsRegistrationSyNQuick.sh'
15731573
input_spec = RegistrationSynQuickInputSpec
15741574
output_spec = RegistrationSynQuickOutputSpec
15751575

15761576
def _num_threads_update(self):
15771577
"""
1578-
antsRegistrationSynQuick.sh ignores environment variables,
1579-
so override environment update frm ANTSCommand class
1578+
antsRegistrationSyNQuick.sh ignores environment variables,
1579+
so override environment update from ANTSCommand class
15801580
"""
15811581
pass
15821582

nipype/interfaces/base/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ def _list_outputs(self):
11331133
metadata = dict(name_source=lambda t: t is not None)
11341134
traits = self.inputs.traits(**metadata)
11351135
if traits:
1136-
outputs = self.output_spec().get()
1136+
outputs = self.output_spec().trait_get()
11371137
for name, trait_spec in list(traits.items()):
11381138
out_name = name
11391139
if trait_spec.output_name is not None:
@@ -1237,7 +1237,7 @@ class SEMLikeCommandLine(CommandLine):
12371237
"""
12381238

12391239
def _list_outputs(self):
1240-
outputs = self.output_spec().get()
1240+
outputs = self.output_spec().trait_get()
12411241
return self._outputs_from_inputs(outputs)
12421242

12431243
def _outputs_from_inputs(self, outputs):

nipype/interfaces/base/specs.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from builtins import str, bytes
1919
from packaging.version import Version
2020

21-
from ...utils.misc import is_container
2221
from ...utils.filemanip import md5, hash_infile, hash_timestamp, to_str
2322
from .traits_extension import (
2423
traits,
@@ -151,24 +150,26 @@ def _deprecated_warn(self, obj, name, old, new):
151150
'%s' % trait_spec.new_name: new
152151
})
153152

154-
def get(self, **kwargs):
153+
def trait_get(self, **kwargs):
155154
""" Returns traited class as a dict
156155
157156
Augments the trait get function to return a dictionary without
158157
notification handles
159158
"""
160-
out = super(BaseTraitedSpec, self).get(**kwargs)
159+
out = super(BaseTraitedSpec, self).trait_get(**kwargs)
161160
out = self._clean_container(out, Undefined)
162161
return out
163162

163+
get = trait_get
164+
164165
def get_traitsfree(self, **kwargs):
165166
""" Returns traited class as a dict
166167
167168
Augments the trait get function to return a dictionary without
168169
any traits. The dictionary does not contain any attributes that
169170
were Undefined
170171
"""
171-
out = super(BaseTraitedSpec, self).get(**kwargs)
172+
out = super(BaseTraitedSpec, self).trait_get(**kwargs)
172173
out = self._clean_container(out, skipundefined=True)
173174
return out
174175

@@ -183,8 +184,8 @@ def _clean_container(self, objekt, undefinedval=None, skipundefined=False):
183184
else:
184185
if not skipundefined:
185186
out[key] = undefinedval
186-
elif (isinstance(objekt, TraitListObject) or isinstance(objekt, list)
187-
or isinstance(objekt, tuple)):
187+
elif (isinstance(objekt, TraitListObject) or isinstance(objekt, list) or
188+
isinstance(objekt, tuple)):
188189
out = []
189190
for val in objekt:
190191
if isdefined(val):
@@ -236,13 +237,13 @@ def get_hashval(self, hash_method=None):
236237

237238
list_withhash = []
238239
list_nofilename = []
239-
for name, val in sorted(self.get().items()):
240+
for name, val in sorted(self.trait_get().items()):
240241
if not isdefined(val) or self.has_metadata(name, "nohash", True):
241242
# skip undefined traits and traits with nohash=True
242243
continue
243244

244-
hash_files = (not self.has_metadata(name, "hash_files", False)
245-
and not self.has_metadata(name, "name_source"))
245+
hash_files = (not self.has_metadata(name, "hash_files", False) and
246+
not self.has_metadata(name, "name_source"))
246247
list_nofilename.append((name,
247248
self._get_sorteddict(
248249
val,
@@ -286,8 +287,8 @@ def _get_sorteddict(self,
286287
else:
287288
out = None
288289
if isdefined(objekt):
289-
if (hash_files and isinstance(objekt, (str, bytes))
290-
and os.path.isfile(objekt)):
290+
if (hash_files and isinstance(objekt, (str, bytes)) and
291+
os.path.isfile(objekt)):
291292
if hash_method is None:
292293
hash_method = config.get('execution', 'hash_method')
293294

@@ -341,7 +342,7 @@ def __deepcopy__(self, memo):
341342
id_self = id(self)
342343
if id_self in memo:
343344
return memo[id_self]
344-
dup_dict = deepcopy(self.get(), memo)
345+
dup_dict = deepcopy(self.trait_get(), memo)
345346
# access all keys
346347
for key in self.copyable_trait_names():
347348
if key in self.__dict__.keys():

nipype/pipeline/engine/nodes.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,8 @@ def _get_inputs(self):
531531
else:
532532
output_name = info[1]
533533
try:
534-
output_value = results.outputs.get()[output_name]
535-
except TypeError:
534+
output_value = results.outputs.trait_get()[output_name]
535+
except AttributeError:
536536
output_value = results.outputs.dictcopy()[output_name]
537537
logger.debug('output: %s', output_name)
538538
try:
@@ -678,7 +678,7 @@ def _copyfiles_to_wd(self, execute=True, linksonly=False):
678678
makedirs(outdir, exist_ok=True)
679679

680680
for info in self._interface._get_filecopy_info():
681-
files = self.inputs.get().get(info['key'])
681+
files = self.inputs.trait_get().get(info['key'])
682682
if not isdefined(files) or not files:
683683
continue
684684

@@ -1084,7 +1084,7 @@ def inputs(self):
10841084
@property
10851085
def outputs(self):
10861086
if self._interface._outputs():
1087-
return Bunch(self._interface._outputs().get())
1087+
return Bunch(self._interface._outputs().trait_get())
10881088

10891089
def _make_nodes(self, cwd=None):
10901090
if cwd is None:
@@ -1109,7 +1109,7 @@ def _make_nodes(self, cwd=None):
11091109
name=nodename)
11101110
node.plugin_args = self.plugin_args
11111111
node.interface.inputs.trait_set(
1112-
**deepcopy(self._interface.inputs.get()))
1112+
**deepcopy(self._interface.inputs.trait_get()))
11131113
node.interface.resource_monitor = self._interface.resource_monitor
11141114
for field in self.iterfield:
11151115
if self.nested:
@@ -1153,7 +1153,7 @@ def _collate_results(self, nodes):
11531153
if not isdefined(values):
11541154
values = []
11551155
if nresult and nresult.outputs:
1156-
values.insert(i, nresult.outputs.get()[key])
1156+
values.insert(i, nresult.outputs.trait_get()[key])
11571157
else:
11581158
values.insert(i, None)
11591159
defined_vals = [isdefined(val) for val in values]
@@ -1201,7 +1201,7 @@ def num_subnodes(self):
12011201
return len(filename_to_list(getattr(self.inputs, self.iterfield[0])))
12021202

12031203
def _get_inputs(self):
1204-
old_inputs = self._inputs.get()
1204+
old_inputs = self._inputs.trait_get()
12051205
self._inputs = self._create_dynamic_traits(
12061206
self._interface.inputs, fields=self.iterfield)
12071207
self._inputs.trait_set(**old_inputs)

nipype/pipeline/engine/utils.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,15 @@ def write_report(node, report_type=None, is_mapnode=False):
142142
['Hierarchy : %s' % node.fullname,
143143
'Exec ID : %s' % node._id]),
144144
write_rst_header('Original Inputs', level=1),
145-
write_rst_dict(node.inputs.get()),
145+
write_rst_dict(node.inputs.trait_get()),
146146
]
147147
with open(report_file, 'wt') as fp:
148148
fp.write('\n'.join(lines))
149149
return
150150

151151
lines = [
152152
write_rst_header('Execution Inputs', level=1),
153-
write_rst_dict(node.inputs.get()),
153+
write_rst_dict(node.inputs.trait_get()),
154154
]
155155

156156
result = node.result # Locally cache result
@@ -166,7 +166,7 @@ def write_report(node, report_type=None, is_mapnode=False):
166166
if isinstance(outputs, Bunch):
167167
lines.append(write_rst_dict(outputs.dictcopy()))
168168
elif outputs:
169-
lines.append(write_rst_dict(outputs.get()))
169+
lines.append(write_rst_dict(outputs.trait_get()))
170170

171171
if is_mapnode:
172172
lines.append(write_rst_header('Subnode reports', level=1))
@@ -238,8 +238,8 @@ def save_resultfile(result, cwd, name):
238238
resultsfile = os.path.join(cwd, 'result_%s.pklz' % name)
239239
if result.outputs:
240240
try:
241-
outputs = result.outputs.get()
242-
except TypeError:
241+
outputs = result.outputs.trait_get()
242+
except AttributeError:
243243
outputs = result.outputs.dictcopy() # outputs was a bunch
244244
result.outputs.set(**modify_paths(outputs, relative=True, basedir=cwd))
245245

@@ -293,8 +293,8 @@ def load_resultfile(path, name):
293293
else:
294294
if result.outputs:
295295
try:
296-
outputs = result.outputs.get()
297-
except TypeError:
296+
outputs = result.outputs.trait_get()
297+
except AttributeError:
298298
outputs = result.outputs.dictcopy() # outputs == Bunch
299299
try:
300300
result.outputs.set(
@@ -1391,19 +1391,19 @@ def clean_working_directory(outputs,
13911391
"""
13921392
if not outputs:
13931393
return
1394-
outputs_to_keep = list(outputs.get().keys())
1394+
outputs_to_keep = list(outputs.trait_get().keys())
13951395
if needed_outputs and \
13961396
str2bool(config['execution']['remove_unnecessary_outputs']):
13971397
outputs_to_keep = needed_outputs
13981398
# build a list of needed files
13991399
output_files = []
1400-
outputdict = outputs.get()
1400+
outputdict = outputs.trait_get()
14011401
for output in outputs_to_keep:
14021402
output_files.extend(walk_outputs(outputdict[output]))
14031403
needed_files = [path for path, type in output_files if type == 'f']
14041404
if str2bool(config['execution']['keep_inputs']):
14051405
input_files = []
1406-
inputdict = inputs.get()
1406+
inputdict = inputs.trait_get()
14071407
input_files.extend(walk_outputs(inputdict))
14081408
needed_files += [path for path, type in input_files if type == 'f']
14091409
for extra in [
@@ -1435,7 +1435,7 @@ def clean_working_directory(outputs,
14351435
else:
14361436
if not str2bool(config['execution']['keep_inputs']):
14371437
input_files = []
1438-
inputdict = inputs.get()
1438+
inputdict = inputs.trait_get()
14391439
input_files.extend(walk_outputs(inputdict))
14401440
input_files = [path for path, type in input_files if type == 'f']
14411441
for f in walk_files(cwd):

0 commit comments

Comments
 (0)