MCPcopy Create free account
hub / github.com/wireservice/csvkit / main

Method main

csvkit/utilities/csvcut.py:39–56  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

37 help='After cutting, delete rows which are completely empty.')
38
39 def main(self):
40 if self.args.names_only:
41 self.print_column_names()
42 return
43
44 if self.additional_input_expected():
45 sys.stderr.write('No input file or piped data provided. Waiting for standard input:\n')
46
47 rows, column_names, column_ids = self.get_rows_and_column_names_and_column_ids(**self.reader_kwargs)
48
49 output = agate.csv.writer(self.output_file, **self.writer_kwargs)
50 output.writerow([column_names[column_id] for column_id in column_ids])
51
52 for row in rows:
53 out_row = [row[column_id] if column_id < len(row) else None for column_id in column_ids]
54
55 if not self.args.delete_empty or any(out_row):
56 output.writerow(out_row)
57
58
59def launch_new_instance():

Callers

nothing calls this directly

Tested by

no test coverage detected