annotate test-data/tf2_test_runme.py @ 7:61381bad936d draft

Uploaded
author fubar
date Mon, 12 Jan 2015 05:01:29 -0500
parents c34063ab3735
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
1 ### bog standard argparse for 3 possible comma separated lists
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
2 ## followed by some silly reverse each row code provided as an example
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
3 ## you're supposed to replace it with your great code..
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
4 import sys
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
5 import argparse
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
6 import copy
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
7 argp=argparse.ArgumentParser()
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
8 argp.add_argument('--INNAMES',default=None)
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
9 argp.add_argument('--INPATHS',default=None)
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
10 argp.add_argument('--OUTPATH',default=None)
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
11 argp.add_argument('--additional_parameters',default=[],action="append")
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
12 argp.add_argument('otherargs', nargs=argparse.REMAINDER)
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
13 args = argp.parse_args()
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
14 fout = open(args.OUTPATH,'w')
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
15 sins = open(args.INPATHS.split(',')[0]).readlines()
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
16 for i,sin in enumerate(sins):
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
17 row = sin.strip().split('\t')
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
18 rrow = copy.copy(row)
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
19 lrow = len(row)
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
20 if (lrow > 1):
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
21 for j in range(lrow):
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
22 rrow[j] = row[lrow-j-1]
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
23 fout.write('\t'.join(rrow))
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
24 fout.write('\n')
c34063ab3735 Initial commit of code in iuc github repository
fubar
parents:
diff changeset
25 fout.close()