def write_to_file(self, gen): """ Writes the results of the analysis to the file given at runtime. Gets the resulting data from a generator. :param gen: generator that yields data to be written :return: writes the data to the given file """ first_for_header = True for each in gen: if not first_for_header: writeCSV(self.args_dict['filename'], each, 'a', '\t') else: writeCSV(self.args_dict['filename'], each, 'wb', '\t') first_for_header = False gen.close()
def write_to_file(self, gen): # pragma: no cover """ Writes the results of the analysis to the file given at runtime. Gets the resulting data from a generator. :param gen: generator that yields data to be written :return: writes the data to the given file """ first_for_header = True for each in gen: if not first_for_header: writeCSV(self.args_dict['filename'], each, 'a', '\t') else: writeCSV(self.args_dict['filename'], each, 'wb', '\t') first_for_header = False gen.close()