<commit_before>
import sys
import os
import re
from optparse import OptionParser
import subprocess
import collections
import VV_outprocess
import VV_testsuite
import VV_largesuite

user = os.environ['USER']

#enable use input for filepaths from the command line
usage_string = "%prog [options]"
parser = OptionParser(usage=usage_string)
parser.add_option('-p', '--directory', action='store', type='string', dest='directory_path', \
                  metavar='PATH', help='path where this directory is located')
parser.add_option('-b', '--script', action='store', type='string', dest='script_path', \
                  metavar='PATH', help='path where the livv kit is located')
parser.add_option('-j', '--html', action='store', type='string', dest='html_path', \
                  metavar='PATH', help='path where the html directory is located')
parser.add_option('-l', '--link', action='store', type='string', dest='html_link', \
                  metavar='PATH', help='location of website for viewing set by user')
parser.add_option('-k', '--ncl', action='store', type='string', dest='ncl_path', \
                  metavar='PATH', help='path where the ncl directory is located')
parser.add_option('-r', '--bdata', action='store', type='string', dest='bench_data', \
                  metavar='FILE', help='file where the benchmark data files are stored')
parser.add_option('-d', '--data', action='store', type='string', dest='data_path', \
                  metavar='PATH', help='path where the solver data directory is located')
parser.add_option('-t', '--test', action='store', type='string', dest='test_suite', \
                  metavar='TEST', help='path to location of test suite')
parser.add_option('-i', '--timestamp', action='store', type='string', dest='time_stamp', \
                  metavar='FILE', help='the current time to record in the web output')
parser.add_option('-m', '--comment', action='store', type='string', dest='comment', \
                  metavar='FILE', help='information about the test case for user reference')
parser.add_option('-u', '--username', action='store', type='string', dest='username', \
                  metavar='FILE', help='username used to create subdirectory of web pages of output')
parser.add_option('-D', '--diagnostic', action='store', type='int', dest='diagnostic_flag', \
                  metavar='FLAG', help='flag to run dome30 diagnostic test')
parser.add_option('-E', '--evolving', action='store', type='int', dest='evolving_flag', \
                  metavar='FLAG', help='flag to run dome30 evolving test')
parser.add_option('-I', '--circular-shelf', action='store', type='int', dest='circular_flag', \
                  metavar='FLAG', help='flag to run circular shelf test')
parser.add_option('-O', '--confined-shelf', action='store', type='int', dest='confined_flag', \
                  metavar='FLAG', help='flag to run confined shelf test')
parser.add_option('-A', '--ismip-hom-A80', action='store', type='int', dest='ismip_hom_a80_flag', \
                  metavar='FLAG', help='flag to run ismip hom a 80km test')
parser.add_option('-B', '--ismip-hom-A20', action='store', type='int', dest='ismip_hom_a20_flag', \
                  metavar='FLAG', help='flag to run ismip hom a 20km test')
parser.add_option('-C', '--ismip-hom-C', action='store', type='int', dest='ismip_hom_c_flag', \
                  metavar='FLAG', help='flag to run ismip hom c test')
parser.add_option('-G', '--gis10km', action='store', type='int', dest='gis_10km_flag', \
                  metavar='FLAG', help='flag to run gis10km test')
parser.add_option('-F', '--dome500', action='store', type='int', dest='dome500_flag', \
                  metavar='FLAG', help='flag to run dome500 test')
parser.add_option('-H', '--gis5km', action='store', type='int', dest='gis_5km_flag', \
                  metavar='FLAG', help='flag to run gis5km test')
#parser.add_option('-a', '--ant_prod', action='store_true', dest='ant_prod', \
#                  help='include flag to run the ANT production analysis')

#parse the command line options and arguments and store in lists
(options, args) = parser.parse_args()

if (options.time_stamp):
	time_stamp = options.time_stamp 
else:
	print "no time given for website"
	time_stamp = " "

if (options.comment):
	comment = options.comment
else:
	print "no comments about test case given"
	comment = " "

if (options.username):

	print 'placing HTML files in the ' + options.username + ' subdirectory (check permissions)'
 	target_html = options.html_path
else:
	print 'no username specified, placing HTML files in the main html directory'
	target_html = options.html_path 

#remove html files previously used in specified subdirectory

try:
	os.remove(target_html + '/livv_kit_main.html')
except OSError as o:
      	if o.errno == 2:
		print "recreating livv_kit_main.html in " + options.username + " subdirectory"
	else:
		raise
try:
       	os.remove(target_html + '/test_suite.html')
except OSError as o:
	if o.errno == 2:
		print "recreating test suite in " + options.username + " subdirectory"
	else:
		raise
try:
       	os.remove(target_html + '/large_test_suite.html')
except OSError as o:
	if o.errno == 2:
		print "recreating large test suite in " + options.username + " subdirectory"
	else:
		raise
try:
        os.remove('plot_details.out')
except OSError as o:
        if o.errno == 2:
                print "clearing plot_details.out"
        else:
                raise

#transferring cover picture to www file

if (options.ncl_path + '/alaska_pic.png'):
        alaskapic = "cp -f " + options.ncl_path + "/alaska_pic.png" + " " + target_html + "/"
        try:
                output = subprocess.call(alaskapic, shell=True)
        except:
                print "error moving cover picture"
                raise


#create all the test suite diagnostics pages
if options.test_suite:

        test_file = open(target_html + '/test_suite.html', 'w')
        descript_file = open(target_html + '/test_descript.html', 'w')
# diagnostic dome case
        dome30d_file = open(target_html + '/dome30d_details.html', 'w')
        dome30d_case = open(target_html + '/dome30d_case.html', 'w')
        dome30d_plot = open(target_html + '/dome30d_plot.html', 'w')
        dome30d_xml  = open(target_html + '/dome30d_xml.html', 'w')
# evolving dome case
        dome30e_file = open(target_html + '/dome30e_details.html', 'w')
        dome30e_case = open(target_html + '/dome30e_case.html', 'w')
        dome30e_plot = open(target_html + '/dome30e_plot.html', 'w')
        dome30e_xml  = open(target_html + '/dome30e_xml.html', 'w')

        circ_case = open(target_html + '/circ_case.html', 'w')
        circ_plot = open(target_html + '/circ_plot.html', 'w')
        circ_xml  = open(target_html + '/circ_xml.html', 'w')
# confined shelf case
        conf_file = open(target_html + '/conf_details.html', 'w')<commit_msg>Added some missing lines for the circ. shelf test case.<commit_after>
import sys
import os
import re
from optparse import OptionParser
import subprocess
import collections
import VV_outprocess
import VV_testsuite
import VV_largesuite

user = os.environ['USER']

#enable use input for filepaths from the command line
usage_string = "%prog [options]"
parser = OptionParser(usage=usage_string)
parser.add_option('-p', '--directory', action='store', type='string', dest='directory_path', \
                  metavar='PATH', help='path where this directory is located')
parser.add_option('-b', '--script', action='store', type='string', dest='script_path', \
                  metavar='PATH', help='path where the livv kit is located')
parser.add_option('-j', '--html', action='store', type='string', dest='html_path', \
                  metavar='PATH', help='path where the html directory is located')
parser.add_option('-l', '--link', action='store', type='string', dest='html_link', \
                  metavar='PATH', help='location of website for viewing set by user')
parser.add_option('-k', '--ncl', action='store', type='string', dest='ncl_path', \
                  metavar='PATH', help='path where the ncl directory is located')
parser.add_option('-r', '--bdata', action='store', type='string', dest='bench_data', \
                  metavar='FILE', help='file where the benchmark data files are stored')
parser.add_option('-d', '--data', action='store', type='string', dest='data_path', \
                  metavar='PATH', help='path where the solver data directory is located')
parser.add_option('-t', '--test', action='store', type='string', dest='test_suite', \
                  metavar='TEST', help='path to location of test suite')
parser.add_option('-i', '--timestamp', action='store', type='string', dest='time_stamp', \
                  metavar='FILE', help='the current time to record in the web output')
parser.add_option('-m', '--comment', action='store', type='string', dest='comment', \
                  metavar='FILE', help='information about the test case for user reference')
parser.add_option('-u', '--username', action='store', type='string', dest='username', \
                  metavar='FILE', help='username used to create subdirectory of web pages of output')
parser.add_option('-D', '--diagnostic', action='store', type='int', dest='diagnostic_flag', \
                  metavar='FLAG', help='flag to run dome30 diagnostic test')
parser.add_option('-E', '--evolving', action='store', type='int', dest='evolving_flag', \
                  metavar='FLAG', help='flag to run dome30 evolving test')
parser.add_option('-I', '--circular-shelf', action='store', type='int', dest='circular_flag', \
                  metavar='FLAG', help='flag to run circular shelf test')
parser.add_option('-O', '--confined-shelf', action='store', type='int', dest='confined_flag', \
                  metavar='FLAG', help='flag to run confined shelf test')
parser.add_option('-A', '--ismip-hom-A80', action='store', type='int', dest='ismip_hom_a80_flag', \
                  metavar='FLAG', help='flag to run ismip hom a 80km test')
parser.add_option('-B', '--ismip-hom-A20', action='store', type='int', dest='ismip_hom_a20_flag', \
                  metavar='FLAG', help='flag to run ismip hom a 20km test')
parser.add_option('-C', '--ismip-hom-C', action='store', type='int', dest='ismip_hom_c_flag', \
                  metavar='FLAG', help='flag to run ismip hom c test')
parser.add_option('-G', '--gis10km', action='store', type='int', dest='gis_10km_flag', \
                  metavar='FLAG', help='flag to run gis10km test')
parser.add_option('-F', '--dome500', action='store', type='int', dest='dome500_flag', \
                  metavar='FLAG', help='flag to run dome500 test')
parser.add_option('-H', '--gis5km', action='store', type='int', dest='gis_5km_flag', \
                  metavar='FLAG', help='flag to run gis5km test')
#parser.add_option('-a', '--ant_prod', action='store_true', dest='ant_prod', \
#                  help='include flag to run the ANT production analysis')

#parse the command line options and arguments and store in lists
(options, args) = parser.parse_args()

if (options.time_stamp):
	time_stamp = options.time_stamp 
else:
	print "no time given for website"
	time_stamp = " "

if (options.comment):
	comment = options.comment
else:
	print "no comments about test case given"
	comment = " "

if (options.username):

	print 'placing HTML files in the ' + options.username + ' subdirectory (check permissions)'
 	target_html = options.html_path
else:
	print 'no username specified, placing HTML files in the main html directory'
	target_html = options.html_path 

#remove html files previously used in specified subdirectory

try:
	os.remove(target_html + '/livv_kit_main.html')
except OSError as o:
      	if o.errno == 2:
		print "recreating livv_kit_main.html in " + options.username + " subdirectory"
	else:
		raise
try:
       	os.remove(target_html + '/test_suite.html')
except OSError as o:
	if o.errno == 2:
		print "recreating test suite in " + options.username + " subdirectory"
	else:
		raise
try:
       	os.remove(target_html + '/large_test_suite.html')
except OSError as o:
	if o.errno == 2:
		print "recreating large test suite in " + options.username + " subdirectory"
	else:
		raise
try:
        os.remove('plot_details.out')
except OSError as o:
        if o.errno == 2:
                print "clearing plot_details.out"
        else:
                raise

#transferring cover picture to www file

if (options.ncl_path + '/alaska_pic.png'):
        alaskapic = "cp -f " + options.ncl_path + "/alaska_pic.png" + " " + target_html + "/"
        try:
                output = subprocess.call(alaskapic, shell=True)
        except:
                print "error moving cover picture"
                raise


#create all the test suite diagnostics pages
if options.test_suite:

        test_file = open(target_html + '/test_suite.html', 'w')
        descript_file = open(target_html + '/test_descript.html', 'w')
# diagnostic dome case
        dome30d_file = open(target_html + '/dome30d_details.html', 'w')
        dome30d_case = open(target_html + '/dome30d_case.html', 'w')
        dome30d_plot = open(target_html + '/dome30d_plot.html', 'w')
        dome30d_xml  = open(target_html + '/dome30d_xml.html', 'w')
# evolving dome case
        dome30e_file = open(target_html + '/dome30e_details.html', 'w')
        dome30e_case = open(target_html + '/dome30e_case.html', 'w')
        dome30e_plot = open(target_html + '/dome30e_plot.html', 'w')
        dome30e_xml  = open(target_html + '/dome30e_xml.html', 'w')
# circular shelf case
        circ_file = open(target_html + '/circ_details.html', 'w')
        circ_case = open(target_html + '/circ_case.html', 'w')
        circ_plot = open(target_html + '/circ_plot.html', 'w')
        circ_xml  = open(target_html + '/circ_xml.html', 'w')
# confined shelf case
        conf_file = open(target_html + '/conf_details.html', 'w')
{'fraction_non_alphanumeric': 0.15329461532946154, 'fraction_numerical': 0.0100380010038001, 'mean_word_length': 3.418118466898955, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 12}, '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': '711029', 'n_tokens_mistral': 4569, 'n_tokens_neox': 4373, 'n_words': 1151}