Skip to content

Commit

Permalink
Update cubids.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed Jan 26, 2024
1 parent ca648ab commit 7c95c37
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions cubids/cubids.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,16 +414,13 @@ def apply_tsv_changes(self, summary_tsv, files_tsv, new_prefix, raise_on_error=T

full_cmd = "\n".join(merge_commands + move_ops)
if full_cmd:
# write full_cmd to a .sh file
# Open file for writing
fileObject = open(new_prefix + "_full_cmd.sh", "w")
fileObject.write("#!/bin/bash\n")
fileObject.write(full_cmd)
# Close the file
fileObject.close()

renames = new_prefix + "_full_cmd.sh"

# write full_cmd to a .sh file
with open(renames, "w") as fo:
fo.write("#!/bin/bash\n")
fo.write(full_cmd)

if self.use_datalad:
# first check if IntendedFor renames need to be saved
if not self.is_datalad_clean():
Expand Down Expand Up @@ -831,11 +828,10 @@ def _purge_associations(self, scans):

path_prefix = str(Path(self.path).parent)

fileObject = open(path_prefix + "/" + "_full_cmd.sh", "w")
fileObject.write("#!/bin/bash\n")
fileObject.write(full_cmd)
# Close the file
fileObject.close()
with open(path_prefix + "/" + "_full_cmd.sh", "w") as fo:
fo.write("#!/bin/bash\n")
fo.write(full_cmd)

if self.scans_txt:
cmt = f"Purged scans listed in {self.scans_txt} from dataset"
else:
Expand Down

0 comments on commit 7c95c37

Please sign in to comment.