def main(): path = "run" try: shutil.rmtree(path) except: print "aucun dossier run" if not os.path.exists(path): os.makedirs(path) # get the names of the pdf files filepathCorr,filepathEleves, listeEleves = interface(); # get the scores while displaying loading bar answersCorr,answersEleves,scores = loading(filepathCorr,filepathEleves) # prompt the names of the students names = promptNames(scores[0], listeEleves) # export results export.exportIndiv(scores[0], names) export.exportClasse(scores[1],scores[2]) # debug : export the answers given by the students (ABCD) in CSV #export.exportAnswersEleves(answersEleves, names) rename_images(names) root = tk.Tk() root.withdraw() tkMessageBox.showinfo("Terminé", "Export terminé : résultats dans moyennes_classe.csv et scores_individuels.csv") root.destroy()
def main_program(): root = tk.Tk() app = interface(root) # TODO: Set up file dialog to handle selecting filepath msg = Scraper.open_email( r'C:\Users\Couch\Desktop\TimesheetReader\test.msg') # Load Excel workbook path = app.browse_file_dialog() wb = openpyxl.load_workbook(path) sheet = wb.active # Amount of cells (Start - Break - Finish = 3) for each day (7); 3*7days = 21 MAX_CELL_COUNT = len(sheet['D5':'F11'] * 3) # Get list of times from email # TODO: Fix disgusting regex regex = r'\d?\d?\:?\d?\d?\s\w\.\w\.|-' times = Scraper.scrape_msg(msg, regex) # Create new list to copy times to # Append all elements as 0 to prefill data in Excel days = [] for i in range(0, MAX_CELL_COUNT): days.append(0) times_index = 0 for i in range(0, MAX_CELL_COUNT): if times_index < len(times): days[times_index] = str(times[times_index]) times_index += 1 # Format times days = Scraper.format_times(days) Interface.print_status( 'Copying times to spreadsheet: {0} at path: {1}'.format( str(sheet), path)) # write days data to cells i = 0 for rowOfCells in sheet['D5':'F11']: for cell in rowOfCells: cell.value = days[i] i += 1 print('\tRow: {0} copied!'.format(str(rowOfCells))) wb.save(path) Interface.print_status("Completed\n{0}".format('=' * 100)) root.mainloop()
def do_interface(self, line): """interface [name interface] [area] [cost]: to add a new interface on the program""" print "Add interface to OSPF" inter, area, cost = line.split() cost = int(cost) intadd = utils.getIPofInterface(inter) type = utils.getTypeofInterface(inter) netmask = utils.getNetMaskofInterface(inter) self.setInterface( interface(type, intadd, netmask, area, self.HelloInterval, self.RouterDeadInterval, self.IntTransDelay, self.RouterPriority, self.RouterID, self, cost), inter, self.RouterID, area)
from Interface import interface Bot = interface() Bot.menu() print('\nThank you to use the CovidBot!, see ya later!')
import os import chess import chess.engine import chess.pgn from Interface import interface import chess.svg import time engine = chess.engine.SimpleEngine.popen_uci("/usr/games/stockfish") cwd_addr = os.getcwd() game_file = open(cwd_addr + "/Database/MagnusCarlsen/2017/3/6.pgn", 'r') game = chess.pgn.read_game(game_file) board = game.board() moves = list(game.mainline_moves()) chess_interface = interface() chess_interface.update_board(board) for move in moves: time.sleep(2) board.push(move) chess_interface.update_board(board) print("\n") # def top_ten_moves(analysis_board, analysis_engine): # best_moves = [] # for legal_move in analysis_board.legal_moves: # analysis_board.push(legal_move) # print(analysis_board.turn) # info = analysis_engine.analyse(analysis_board, chess.engine.Limit(depth=10))
from cloudant import Cloudant from flask import Flask, render_template, request, jsonify, send_file from Interface import interface import atexit import os import json import csv app = Flask(__name__, static_url_path='') db_name = 'mydb' client = None db = None inter = interface() if 'VCAP_SERVICES' in os.environ: vcap = json.loads(os.getenv('VCAP_SERVICES')) print('Found VCAP_SERVICES') if 'cloudantNoSQLDB' in vcap: creds = vcap['cloudantNoSQLDB'][0]['credentials'] user = creds['username'] password = creds['password'] url = 'https://' + creds['host'] client = Cloudant(user, password, url=url, connect=True) db = client.create_database(db_name, throw_on_exists=False) elif "CLOUDANT_URL" in os.environ: client = Cloudant(os.environ['CLOUDANT_USERNAME'], os.environ['CLOUDANT_PASSWORD'], url=os.environ['CLOUDANT_URL'], connect=True) db = client.create_database(db_name, throw_on_exists=False)