in csv-gremlin/csv-gremlin.py [0:0]
def process_edges(self,reader):
count = 0
rows_processed = 0
self.mode = self.EDGE
batch = 'g'
errors = False
if not '~label' in reader.fieldnames:
self.print_error('For edges, the header row must include a ~label column')
errors = True
if not '~from' in reader.fieldnames or not '~to' in reader.fieldnames:
self.print_error('For edges, the header row must include both ~from and ~to columns')
errors = True
if errors:
sys.exit(1)
for row in reader:
self.current_row += 1
batch += self.process_edge_row(row)
count += 1
if count == self.edge_batch_size:
count = 0
if batch != 'g':
self.print_normal(batch)
batch = 'g'
rows_processed += 1
if rows_processed == self.row_limit:
break
if batch != 'g':
self.print_normal(batch)