Skip to content

Commit 60eae9c

Browse files
committed
RF: by default dump json with indent=2
1 parent 7d2c526 commit 60eae9c

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

heudiconv/bids.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def populate_aggregated_jsons(path):
171171
act = "Generating"
172172
lgr.debug("%s %s", act, task_file)
173173
fields.update(placeholders)
174-
save_json(task_file, fields, indent=2, sort_keys=True, pretty=True)
174+
save_json(task_file, fields, sort_keys=True, pretty=True)
175175

176176

177177
def tuneup_bids_json_files(json_files):
@@ -193,7 +193,7 @@ def tuneup_bids_json_files(json_files):
193193
# Let's hope no word 'Date' comes within a study name or smth like
194194
# that
195195
raise ValueError("There must be no dates in .json sidecar")
196-
save_json(jsonfile, json_, indent=2)
196+
save_json(jsonfile, json_)
197197

198198
# Load the beast
199199
seqtype = op.basename(op.dirname(jsonfile))
@@ -223,7 +223,7 @@ def tuneup_bids_json_files(json_files):
223223
was_readonly = is_readonly(json_phasediffname)
224224
if was_readonly:
225225
set_readonly(json_phasediffname, False)
226-
save_json(json_phasediffname, json_, indent=2)
226+
save_json(json_phasediffname, json_)
227227
if was_readonly:
228228
set_readonly(json_phasediffname)
229229

@@ -259,8 +259,7 @@ def add_participant_record(studydir, subject, age, sex):
259259
("Description", "(TODO: adjust - by default everyone is in "
260260
"control group)")])),
261261
]),
262-
sort_keys=False,
263-
indent=2)
262+
sort_keys=False)
264263
# Add a new participant
265264
with open(participants_tsv, 'a') as f:
266265
f.write(
@@ -373,8 +372,7 @@ def add_rows_to_scans_keys_file(fn, newrows):
373372
("LongName", "Random string"),
374373
("Description", "md5 hash of UIDs")])),
375374
]),
376-
sort_keys=False,
377-
indent=2)
375+
sort_keys=False)
378376

379377
header = ['filename', 'acq_time', 'operator', 'randstr']
380378
# prepare all the data rows

heudiconv/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def assure_no_file_exists(path):
188188
os.unlink(path)
189189

190190

191-
def save_json(filename, data, indent=4, sort_keys=True, pretty=False):
191+
def save_json(filename, data, indent=2, sort_keys=True, pretty=False):
192192
"""Save data to a json file
193193
194194
Parameters

0 commit comments

Comments
 (0)