Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.

brainprep.interfaces.utils.anonfile

brainprep.interfaces.utils.anonfile(input_file, derivatives_dir, rawdata_dir)[source]

Anonymize a text file using sed.

The function constructs a list of sed substitution expressions based on the user-provided directory to anonumize and additional system-derived identifiers (hostname, IP address, username). The resulting command performs in-place anonymization of the input file.

Parameters:
input_fileFile

Path to the file to anonymize.

derivatives_dirDirectory | None

Derivatives directory.

rawdata_dirDirectory | None

Raw data directory.

Returns:
commandlist[str]

The sed command-line used for anonization.

output_fileFile

Path to the anonymized file.