<commit_before>#!/usr/bin/env python

import argparse
import string
import Image, ImageOps
import logging
import urllib
import csv
import time
import calendar
from datetime import datetime
from urlparse import urlparse


# Main ########################################################################
if __name__ == '__main__':
  parser = argparse.ArgumentParser()
  parser.add_argument('csv_read', help='file csv sorgente')
  parser.add_argument('dataPresentazione', help='n colonna', type=int)
  parser.add_argument('dataApprovazione', help='n colonna', type=int)
  parser.add_argument('tsv_write', help='path del tsv da produrre')
  args = parser.parse_args()
  
  with open(args.csv_read, 'rb') as csvfile:
    reader = csv.reader(csvfile)
    header = next(reader)
    
    age = []
        
    for row in reader:
        t0 = datetime.strptime(row[args.dataPresentazione], '%Y-%m-%d')
        t1 = datetime.strptime(row[args.dataApprovazione], '%Y-%m-%d')
        
        diff = t1 - t0
        age.append(diff.days)
        
    maxAge = float(max(age))
    
  with open(args.csv_read, 'rb') as csvfile:
    reader = csv.reader(csvfile)
    c = csv.writer(open(args.tsv_write, 'wb'),delimiter='\t')
    header = next(reader)
    
    printheader = []
    printheader.append(header[0])
    printheader.append('age')<commit_msg>un po' di refactoring python<commit_after>#!/usr/bin/env python

import argparse
import string
import Image, ImageOps
import logging
import urllib
import csv
import time
import calendar
from datetime import datetime
from urlparse import urlparse


# Main ########################################################################
if __name__ == '__main__':
  parser = argparse.ArgumentParser()
  parser.add_argument('csv_read', help='file csv sorgente')
  parser.add_argument('dataPresentazione', help='n colonna', type=int)
  parser.add_argument('dataApprovazione', help='n colonna', type=int)
  parser.add_argument('tsv_write', help='path del tsv da produrre')
  args = parser.parse_args()
  
  with open(args.csv_read, 'rb') as csvfile:
    reader = csv.reader(csvfile)
    header = next(reader)
    
    age = []
        
    for row in reader:
        t0 = datetime.strptime(row[args.dataPresentazione], '%Y-%m-%d')
        t1 = datetime.strptime(row[args.dataApprovazione], '%Y-%m-%d')
        
        diff = t1 - t0
        age.append(diff.days)
        
    maxAge = float(max(age))
    print('max age: '+str(maxAge))
    
  with open(args.csv_read, 'rb') as csvfile:
    reader = csv.reader(csvfile)
    c = csv.writer(open(args.tsv_write, 'wb'),delimiter='\t')
    header = next(reader)
    
    printheader = []
    printheader.append(header[0])
    printheader.append('age')
{'fraction_non_alphanumeric': 0.17683823529411766, 'fraction_numerical': 0.003676470588235294, 'mean_word_length': 3.740418118466899, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '623699', 'n_tokens_mistral': 893, 'n_tokens_neox': 864, 'n_words': 194}