Exemplo n.º 1
0
 def main_menu(self):
     """first menu et creation of database in second choice"""
     print(self.green_line)
     print(colored("1. Utiliser application", "yellow",))
     print(colored("2. Supression/Création de la database", "magenta"))
     print(colored("0. Quitter l'application ", "red"))
     print(self.green_line)
     choice_main = input(colored("\n ---> ", "green"))
     try:
         choice_main = int(choice_main)
     except ValueError:
         choice_main = -1
     if choice_main == 1:
         self.api_menu()
     elif choice_main == 2:
         database()
         data = Database()
         request = Request()
         request.create_database(data)
         self.main_menu()
     elif choice_main == 0:
         self.bye()
     else:
         print(self.touch_error)
         self.main_menu()
Exemplo n.º 2
0
 def __init__(self, maxInstanceIdx, secondTimeout):
     super().__init__(maxInstanceIdx, secondTimeout, name="NeuralAI")
     self._theoremName = ""
     self._theorem = ""
     # get Rule States
     self._trueRuleStates = []
     ruleStates = DarkLogic.getRuleStates()
     for ruleState in ruleStates:
         self._trueRuleStates.append(makeTrueState(ruleState))
     self._inputSize = (len(self._trueRuleStates) + 1) * NeuralAI.NbOperators * 19
     self._storeNodes = []
     self._db = Database(NeuralAI.DbName)
     self._gamesSinceLastLearning = 0
     if file_io.file_exists(NeuralAI.ModelFile):
         print("load DeepAI brain model")
         self._model = keras.models.load_model(NeuralAI.ModelFile)
     else:
         # create model
         print("create new DeepAI brain model")
         self._model = createModel(len(self._trueRuleStates) + 1)
         compileModel(self._model, NeuralAI.INIT_LR)
         self._model.save(NeuralAI.ModelFile)
     self._model = extractTestModel(self._model)
     self._modelMutex = Lock()
     self._elo = 1076  # 1418
Exemplo n.º 3
0
 def __init__(self):
     """set up attributes"""
     self.green_line = colored("-----------------------------------------", "green")
     self.red_line = colored("-----------------------------------------", "red")
     self.touch_error = colored("Pour faire une sélection. Tapez son numéro", "red")
     self.database = Database()
     self.list_product = []
     self.cat = 0
     self.sub = 0
Exemplo n.º 4
0
 def execOpenWindow(self):
     dialog = QtGui.QDialog()
     dialog.ui = Ui_Dialog_Open()
     dialog.ui.setupUi(dialog)
     dialog.setAttribute(QtCore.Qt.WA_DeleteOnClose)
     dialog.exec_()
     if dialog.ui.accepted():
         db_name = dialog.ui.getNameToOpen()
         self.db = Database(db_name)
         self.uploadTable()
         self.uploadLabels()
         self.rows_added = 0
Exemplo n.º 5
0
def parser():
    DarkLogic.init(0)
    db = Database("Test/dbtest.csv")
    dbStates = db.getDatas()
    print("Total number of theorems in database: " + str(len(dbStates)))
    for dbState in dbStates.values():
        thCreated = DarkLogic.makeTheorem(dbState.theoremName(),
                                          dbState.theoremContent())
        assert thCreated, "Theorem name: " + dbState.theoremName() + ", " \
                             "content: " + dbState.theoremContent() + " has not been created"
        dlContent = DarkLogic.toStrTheorem()
        assert dlContent == dbState.theoremContent(), "Bad parsing! content in darklogic is '"\
            + dlContent + "', but original was " + dbState.theoremContent()
Exemplo n.º 6
0
 def execNewWindow(self):
     dialog = QtGui.QDialog()
     dialog.ui = Ui_Dialog_New()
     dialog.ui.setupUi(dialog)
     dialog.setAttribute(QtCore.Qt.WA_DeleteOnClose)
     dialog.exec_()
     if dialog.ui.accepted():
         db_name, value_init = dialog.ui.getDbNameAndValue()
         self.db = Database(db_name)
         self.db.set_salary(value_init)
         self.uploadTable()
         self.salary = self.db.get_salary()
         self.addCosts()
         self.uploadLabels()
         self.rows_added = 0
Exemplo n.º 7
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(462, 715)
        style = "QMainWindow {background-color:" \
                " QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #616161," \
                " stop: 0.5 #505050, stop: 0.6 #434343, stop:1 #656565);}"
        MainWindow.setStyleSheet(style)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.initToolBar(MainWindow)
        self.db = Database()
        self.initCalendar()
        self.initTableWidget()
        self.initInputs()
        self.initButtons()
        self.initLabels()
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        QtCore.QObject.connect(self.calendarWidget,
                               QtCore.SIGNAL(_fromUtf8("clicked(QDate)")),
                               self.dateTimeEdit.setDate)
        QtCore.QObject.connect(self.buttonBox,
                               QtCore.SIGNAL(_fromUtf8("accepted()")),
                               self.buttonAccepted)
        QtCore.QObject.connect(self.buttonBox,
                               QtCore.SIGNAL(_fromUtf8("accepted()")),
                               self.tableWidget.scrollToBottom)
        QtCore.QObject.connect(self.buttonBox,
                               QtCore.SIGNAL(_fromUtf8("rejected()")),
                               self.buttonRejected)
        QtCore.QObject.connect(self.actionNew,
                               QtCore.SIGNAL(_fromUtf8("triggered()")),
                               self.action_new)
        QtCore.QObject.connect(self.actionOpen,
                               QtCore.SIGNAL(_fromUtf8("triggered()")),
                               self.action_open)
        QtCore.QObject.connect(self.actionSave,
                               QtCore.SIGNAL(_fromUtf8("triggered()")),
                               self.save_changes)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Exemplo n.º 8
0
import sqlite3
import traceback
import sys
import os
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib import style
from decimal import Decimal

from Database.database import Database
from ParseData.parsedata import Parse

conn = sqlite3.connect("test.db")
print('opened successfully')
database = Database()
parse = Parse()
parse1 = Parse()

while (1):
    print(
        '\n1. Create table\n2. Insert data\n3. Display\n4. Drop Table\n5. Parse\n6. Store the data\n7. Plot Graph\n8. Exit\n'
    )
    ch = int(input("Enter ur choice: "))
    if (ch == 1):
        database.create_table(conn)
    elif (ch == 2):
        database.insert_into_table(conn)
    elif (ch == 3):
        database.display_data(conn)
    elif (ch == 4):
        database.drop_table(conn)