def get_application_from_ID(appid: int): query = "SELECT * FROM application WHERE id = %s" info = (appid, ) application = Application() try: conn = get_connection() if conn: cursor = conn.cursor() cursor.execute(query, info) item = cursor.fetchone() if item: application.appid = item[0] application.name = item[1] application.type = item[2] application.image = item[3] application.min_memory = item[4] application.num_cores = item[5] application.comments = item[6] # print('Application: ', vars(application)) cursor.close() conn.close() except mysql.connector.Error as err: logging.error('Getting Application %s Info on Database Error: %s', appid, err) finally: return application
def list_applications(): query = "SELECT * FROM application" app_list = [] try: conn = get_connection() if conn: cursor = conn.cursor() cursor.execute(query) for item in cursor: app = Application() app.appid = item[0] app.name = item[1] app.type = item[2] app.image = item[3] app.min_memory = item[4] app.num_cores = item[5] app.comments = item[6] # print('Application: ', vars(app)) app_list.append(app) cursor.close() conn.close() except mysql.connector.Error as err: logging.error('Getting Application List on Database Error: %s', err) finally: if not app_list: logging.info('Not Find any Application on Database') return app_list
def applicationMenu(): application_list = database.list_applications() if application_list: print('\n' + 'Applications:') for app in application_list: print('ID: ', app.appid, ' Name: ', app.name) while True: application = Application() application.appid = int( input('Enter the Selected Application ID: ')) if application in application_list: return (application.appid) # break else: print('ID: ', application.appid, ' - Wrong Application ID!') else: print('No Applications Available!')
def getApplicationsList(): applications = [] with open(csv_path) as f: reader = csv.reader(f, delimiter=',') next(reader, None) for i, row in enumerate(reader): new_application = Application(SK_ID_CURR=row[0], TARGET=row[1], NAME_CONTRACT_TYPE=row[2], CODE_GENDER=row[3], FLAG_OWN_CAR=row[4], FLAG_OWN_REALTY=row[5]) applications.append(new_application) #if(i >= 600): # break return applications
def getApplication(application_id): with open(csv_path) as f: reader = csv.reader(f, delimiter=',') for row in reader: if row[0] == str(application_id): return Application(SK_ID_CURR=row[0], TARGET=row[1], NAME_CONTRACT_TYPE=row[2], CODE_GENDER=row[3], FLAG_OWN_CAR=row[4], FLAG_OWN_REALTY=row[5], CNT_CHILDREN=row[6], AMT_INCOME_TOTAL=row[7], AMT_CREDIT=row[8], AMT_ANNUITY=row[9], AMT_GOODS_PRICE=row[10], NAME_TYPE_SUITE=row[11], NAME_INCOME_TYPE=row[12], NAME_EDUCATION_TYPE=row[13], NAME_FAMILY_STATUS=row[14], NAME_HOUSING_TYPE=row[15], REGION_POPULATION_RELATIVE=row[16]) return False
def footnote_types(): ret = Application.get_footnote_types() return jsonify(ret)
def get_meursing_measures(additional_code_id, geographical_area_id): results = Application.get_meursing_measures(additional_code_id, geographical_area_id) return jsonify(results)
def certificate_types(): ret = Application.get_certificate_types() return jsonify(ret)
def additional_code_types(): ret = Application.get_additional_code_types() return jsonify(ret)
def measure_type_series(): ret = Application.get_measure_type_series() return jsonify(ret)
def get_meursing_code_list(): results = Application.get_meursing_code_list() return jsonify(results)
import sys from PyQt5.QtWidgets import QApplication from classes.application import Application app = QApplication(sys.argv) ventana = Application() ventana.show() sys.exit(app.exec())
# -*- coding: utf-8 -*- import tkinter as tk from classes.application import Application root = tk.Tk() app = Application(root) root.mainloop()
# ======================= # Finishing Application # ======================= # Stops Timer 1 app.timer1.end() print("\n[App] The elapsed time was: %f s" % app.timer1.elapsedTime) # Shows the Simulations Plots if app.args.enablePlots: plt.show() # Must be close to the end of code! # TODO: Identificar sessões abertas para serem fechadas # session.close() # del session print("[App] DONE") sys.exit() # ====== # Main # ====== if __name__ == '__main__': app = Application(enableProfilling=False) if enableProfilling: profile.run('main()', app.save_filename_path_profile) p = pstats.Stats(app.save_filename_path_profile) p.sort_stats('cumulative').print_stats(20) else: tf.app.run(main=main(app))