@@ -0,0 +1,1364 @@
+#!/usr/bin/env python3.5%0A%0Aimport sys%0Aimport re%0Aimport os%0Aimport csv%0A%0Afrom extract_toc import parseargs%0Afrom get_ratings import Ratings, Ratings2%0A%0Adef nvl(v1,v2):%0A  if v1:%0A    return v1%0A  else:%0A    return v2%0A%0Adef process_ratings_for_file(ratings, filename):%0A  header_columns = ratings.get_column_headers()%0A  headers = ratings.all_available_ratings%0A  ratings.process_file(filename)%0A  ratings.map_ratings()%0A  data = ratings.get_column_data()%0A  if (len(data) != len(header_columns)):%0A    print(%22**** Invalid data encountered!!!!%22)%0A  for i in range(0, len(data), 5):%0A    print(%22%25-30s %252s %25-2s %25-2s %25-2s %25-2s%22 %25 (headers%5Bint(i/5)%5D, nvl(data%5Bi%5D, %22_%22), nvl(data%5Bi+1%5D, %22_%22), nvl(data%5Bi+2%5D, %22_%22), nvl(data%5Bi+3%5D, %22_%22), nvl(data%5Bi+4%5D, %22_%22)))%0A  %0Adef main(args):%0A  argsmap = parseargs(args)%0A    %0A  files = argsmap.get('files')%0A  if (not files):%0A    sys.exit(0)%0A%0A  ratings_mapper_file = argsmap.get(%22rmap%22)%0A  if ratings_mapper_file:%0A    ratings_mapper_file = ratings_mapper_file%5B0%5D%0A  if not ratings_mapper_file:%0A    print(%22Ratings Mapper File file name must be entered using the --rmap option...%22)%0A    sys.exit(1)%0A%0A  ratings = Ratings(ratings_mapper_file)%0A  %0A  for filename in files:%0A    print(%22Processing file: %22 + filename)%0A    print(%22============================%22)%0A    process_ratings_for_file(ratings, filename)%0A%0Aif __name__ == '__main__':%0A  args = sys.argv%5B1:%5D%0A  main(args)%0A

Create test_ratings_2.py