def main(): if (args.init): from init import start start() if (args.setup): from config import start start() if (args.start): from APP.app import main Thread(target=main).start() if (args.start == "--traffic" or args.start == "traffic"): from savetodb import startsave from tcpcreds import start while True: try: startsave() start() except KeyboardInterrupt: print("User Interrupted :(") sys.exit(-1) elif (args.start == '--default' or args.start == 'default'): from savetodb import startsave while True: try: startsave() except KeyboardInterrupt: print("User Interrupted :(") sys.exit(-1)
def run(): """ Initalise game, setup reset loop if user(s) want to restart ask for user name(s) """ while True: restart = start() if restart == False: break else: continue
import init config = init.get_config("al") def parse(op_file, d, index_line): student_info = ",".join(index_line.split(init.input_sep)[0:8]) if 'errMsge' in d: init.write_to_file(student_info + " - Student Not Found \n", op_file) return s = "" for s_info in [ 'Name', 'Subject Stream', 'Syllabus', 'District Rank', 'Island Rank', 'Z-Score' ]: s = s + "," + init.find(d['studentInfo'], s_info) init.write_to_file( student_info + "," + s[1:] + "," + ",".join( init.fill_marks(config[4], d['subjectResults'], index_line.split(init.input_sep)[7], 5)) + "\n", op_file) init.start(config[1], config[2], config[3] + ",".join(config[4]) + "\n", config[0], init.input_sep, parse, 7)
__builtins__["PlannerError"] = PlannerError else: __builtins__.PlannerError = PlannerError try: #import gevent import sys if type(__builtins__) == types.DictType: __builtins__["SYS_ARGV"] = set(sys.argv) else: __builtins__.SYS_ARGV = set(sys.argv) print 'sys.argv==', sys.argv writePID() import init #这个import的上面不能有其他import,主要是防止间接import了traceback init.start(sys.argv) except Exception: try: import os import sys import platform import traceback #print traceback #看是否正确地导入了修改后的traceback sText = traceback.format_exc() sys.stderr.write(sText) import u import log log.closeAll() except Exception:
"HISTORY OF MODERN WORLD,HOME ECONOMICS,COMMUNICATION & MEDIA STUDIES,BUSINESS STATISTICS,BUSINESS STUDIES," \ "ACCOUNTING,BUDDHISM,HINDUISM,CHRISTIANITY,ISLAM,BUDDHIST CIVILIZATION,HINDU CIVILIZATION,ISLAMIC CIVILIZATION," \ "GREEK & ROMAN CIVILIZATION,CHRISTIAN CIVILIZATION,ART,DANCING (INDIGENOUS),DANCING (BHARATHA),ORIENTAL MUSIC," \ "CARNATIC MUSIC,WESTERN MUSIC,DRAMA & THEATRE (SINHALA),DRAMA & THEATRE (TAMIL),DRAMA & THEATRE (ENGLISH)," \ "ENGINEERING TECHNOLOGY,BIO SYSTEMS TECHNOLOGY,SCIENCE FOR TECHNOLOGY,SINHALA,TAMIL,ENGLISH,PALI,SANSKRIT," \ "ARABIC,FRENCH,GERMAN,RUSSIAN,HINDI,CHINESE,JAPANESE,COMMON GENERAL TEST".split(",") def get_subject_wise_data(table): tds = table.getElementsByTagName("td") mark_array = [""] * len(subjects) for i in range(0, tds.length - 1, 2): mark_array[init.get_index(subjects,init.strip(tds[i].firstChild.nodeValue))] = \ init.strip(tds[i+1].firstChild.nodeValue) return ",".join(mark_array) def get_subject_stream(table): tds = table.getElementsByTagName("td") return tds[tds.length - 1].firstChild.nodeValue.lstrip().rstrip() def parse(content, index_line, f): tables = xml.dom.minidom.parseString(content).getElementsByTagName("table") init.write_to_file( index_line.lstrip().rstrip() + "," + get_subject_stream(tables[0]) + "," + get_subject_wise_data(tables[1]) + "\n", f) init.start(config[1], config[2], header + ",".join(subjects) + "\n", config[0], input_sep, parse)
import init import val_gui as gui from PyQt5 import QtCore, QtGui, QtWidgets if __name__ == "__main__": import sys app = QtWidgets.QApplication(sys.argv) MainWindow = QtWidgets.QMainWindow() ui = gui.Ui_MainWindow() ui.setupUi(MainWindow) ui = init.start(ui) MainWindow.show() sys.exit(app.exec_())
else: try: os.stat(path + '/version.py') except OSError: print( 'BOOT: Error, proceeding with factory default version...') path = env.root else: print('BOOT: OK, valid version {} found and loading...'.format( pythings_version)) sys.path.insert(0, path) else: path = env.root except Exception as e: print('BOOT: Error, proceeding with factory defaults: ', e.__class.__.__name__, str(e)) path = env.root # Execute Pythings framework (from right path inserted above) try: import init gc.collect() init.start() except Exception as e: import handle_main_error handle_main_error.handle(e) # TODO: Fallback on factory version? finally: del env
def main(): init.start()
import re import init import xml.dom.minidom config = init.get_config("gv") url = config[0] input_file = config[1] output_file = config[2] input_sep = "\t" def parse(content, index_line, f): doc = xml.dom.minidom.parseString(content) lines = content.split("\n") matching_lines = [] for line in lines: m = re.search("(.*rightre\">)(.*)", line) if m: matching_lines.append(m.group(2)) init.write_to_file( ",".join(index_line.split(input_sep)[0:4]) + "," + matching_lines[2] + "," + matching_lines[4] + "," + matching_lines[5] + "\n", f) init.start(input_file, output_file, "CensusNo,School,Gender,IndexNo,Name,Mark,Qualification" + "\n", url, input_sep, parse)
import init config = init.get_config("gv") def parse(op_file, d, index_line): if 'errMsge' in d: init.write_to_file(index_line + " - Student Not Found \n", op_file) return init.write_to_file( index_line + "," + d['name'] + "," + init.find(d['studentInfo'], "District / Medium Cut off Mark") + "," + d['subjectResults'][0]['subjectResult'] + "\n", op_file) def q_fn(url, index_no): return url + "/" + index_no init.start(config[1], config[2], config[3] + ",".join(config[4]) + "\n", config[0], init.input_sep, parse, 6, query_forming_fn=q_fn)