Skip to content

Commit 26b0eb6

Browse files
satraoesteban
andauthored
Apply suggestions from code review
Co-Authored-By: Oscar Esteban <code@oscaresteban.es>
1 parent e1c792b commit 26b0eb6

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

nipype/algorithms/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ def _run_interface(self, runtime):
822822
df = pd.DataFrame([input_dict])
823823

824824
if self._have_lock:
825-
self._lock = SoftFileLock(self.inputs.in_file + '.lock')
825+
self._lock = SoftFileLock('%s.lock' % self.inputs.in_file)
826826

827827
# Acquire lock
828828
self._lock.acquire()

nipype/external/cloghandler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def __init__(self,
158158
self.maxBytes = maxBytes
159159
self.backupCount = backupCount
160160
# Prevent multiple extensions on the lock file (Only handles the normal "*.log" case.)
161-
self.lock_file = filename + '.lock'
161+
self.lock_file = '%s.lock' % filename
162162
self.stream_lock = SoftFileLock(self.lock_file)
163163

164164
# For debug mode, swap out the "_degrade()" method with a more a verbose one.

nipype/utils/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def get_data(self, key):
209209
"""Read options file"""
210210
if not os.path.exists(self.data_file):
211211
return None
212-
with SoftFileLock(self.data_file + '.lock'):
212+
with SoftFileLock('%s.lock' % self.data_file):
213213
with open(self.data_file, 'rt') as file:
214214
datadict = load(file)
215215
if key in datadict:
@@ -220,14 +220,14 @@ def save_data(self, key, value):
220220
"""Store config flie"""
221221
datadict = {}
222222
if os.path.exists(self.data_file):
223-
with SoftFileLock(self.data_file + '.lock'):
223+
with SoftFileLock('%s.lock' % self.data_file):
224224
with open(self.data_file, 'rt') as file:
225225
datadict = load(file)
226226
else:
227227
dirname = os.path.dirname(self.data_file)
228228
if not os.path.exists(dirname):
229229
mkdir_p(dirname)
230-
with SoftFileLock(self.data_file + '.lock'):
230+
with SoftFileLock('%s.lock' % self.data_file):
231231
with open(self.data_file, 'wt') as file:
232232
datadict[key] = value
233233
dump(datadict, file)

0 commit comments

Comments
 (0)