Ejemplo n.º 1
0
import datetime
import json
import unittest

from flask import Response
from flask.testing import FlaskClient
from werkzeug.datastructures import MultiDict

import main
import models
import alarm
from util import date_format, parse_date

main = main.Main()  # type: main.Main
app = None  # type: FlaskClient
root_password = ""  # type: str


class FlaskrTestCase(unittest.TestCase):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.main = main
        self.prefix = "/api/"
        self.headers = {}

    @classmethod
    def setUpClass(cls):
        main.startup.register(cls.inject_setup, after="setup_flask")
        main.setup()

    @staticmethod
Ejemplo n.º 2
0
 def moveBackButton(self):
     backMove = main.Main(self.kang3)
Ejemplo n.º 3
0
 def exit(self):
     self.master.destroy()
     wnd = Tk()
     main.Main(wnd, self.user)
     wnd.mainloop()
 def voltar(self):
       self.origem = main.Main()
       self.origem.show()
       self.hide()
Ejemplo n.º 5
0
'''
Network call handler of slave server
'''

from socket import *
import thread
from config.networkParams import *
from config.host import *
from config.messageHeads import *
import src.util.network as network
import main

Slave = main.Main()


def handler(sc, address):
    messageLength = int(sc.recv(MESSAGE_LENGTH_DIGITS))
    networkMessage = sc.recv(messageLength)
    messageHead = networkMessage[0:MESSAGE_HEAD_LENGTH]
    message = networkMessage[(MESSAGE_HEAD_LENGTH + 1):]  # +1 for delimiter

    if messageHead == SERVERINFO:
        Slave.saveServerInfo(message)
    elif messageHead == GRAPH:
        Slave.saveGraph(message)
    elif messageHead == PUSHTASK:
        main.pushTaskToQueue(message)
    elif messageHead == STARTPROCESSING:
        Slave.startProcessing(message)
    elif messageHead == REQUESTTASK:
        response = main.grantTask()
Ejemplo n.º 6
0
#-*-coding:utf-8 -*
"""Start game module.
"""
import main

main_instance = main.Main()
main.Main.main_loop(main_instance)
Ejemplo n.º 7
0
Archivo: run.py Proyecto: xhalo32/advpy
import pygame as p
import main
try:
    Main = main.Main()
except Exception as e:
    print e

p.quit()
quit()
Ejemplo n.º 8
0
 def back(self):
     self.root.destroy()
     obj2 = main.Main(self.id)
 def backtoMenu(self):
     self.main = main.Main()
     self.close()
     self.main.show()
Ejemplo n.º 10
0
#!/usr/local/bin python
#-*-coding: utf-8-*-

import main

if __name__ == "__main__":
    app = main.Main()
dRules.append(([39,"(((ODD-(SLK-LWKR))-SOP)-((2-LnOps)/(EDD+0.000000001)))"]))
dRules.append(([40,"(EDD-SLK)"]))
dRules.append(([41,"(COVERT+((CR+LRnOps)+LnOps))"]))
dRules.append(([42,"((LWKR+(ODD*LWKR))-CR)"]))
dRules.append(([43,"((LRnOps-5)*(TWORK-CRODD))"]))
dRules.append(([44,"(((LRnOps*LWKR)+LWKR)-(LRnOps*3))"]))
dRules.append(([45,"(COVERT+LWKR)"]))
#dRules.append(([46,[['p', '>=', '<=', 0.1492920314793783, 0.5372425029577081], ['P', '>=', '<=', 0.7890511162535462, 0.8103150519791776], ['DD', '>=', '<=', 0.19950276508811393, 0.9853641035461449], ['SLK', '>=', '<=', 0.026207393103757082, 0.7806427081636532], ['ODD', '>=', '<=', 0.730541969310404, 0.8763295941625742], ['MODD', '>=', '<=', 0.48236703521042945, 0.9778957139724684], ['CR', '>=', '<=', 0.5372185466628898, 0.5525007685067986], ['CRODD', '>=', '<=', 0.3300837952944974, 0.9637210105016534], ['r', '>=', '<=', 0.07776853833784492, 0.9536836104425819], ['Re', '>=', '<=', 0.9080021385717109, 0.9627626144967514]]]))
#dRules.append(([47,[['p', '>=', '<=', 0.03959908110902488, 0.8533300343204756], ['P', '>=', '<=', 0.6090148798466155, 0.9734972497762693], ['DD', '>=', '<=', 0.4547006175568997, 0.9999817065202286], ['SLK', '>=', '<=', 0.0385444245682669, 0.7454507993359859], ['ODD', '>=', '<=', 0.5714172032489221, 0.7679781743058114], ['MODD', '>=', '<=', 0.03427843279898202, 0.06862845190067124], ['CR', '>=', '<=', 0.8023107448249706, 0.9129361799982805], ['CRODD', '>=', '<=', 0.012296029311915535, 0.9742450226927384], ['r', '>=', '<=', 0.06139364749804366, 0.6794797625805099], ['Re', '>=', '<=', 0.6572884906118508, 0.9958967670231302]]]))
#dRules.append(([48,[['p', '>=', '<=', 0.03748562951968537, 0.8668761783822811], ['P', '>=', '<=', 0.6223959242325784, 0.7478533557420791], ['DD', '>=', '<=', 0.35826833150541326, 0.6647525125408326], ['SLK', '>=', '<=', 0.19836852738939204, 0.5670055729651062], ['ODD', '>=', '<=', 0.4179281677930182, 0.991120457365827], ['MODD', '>=', '<=', 0.2020868414154574, 0.20389770157249287], ['CR', '>=', '<=', 0.44805289817407845, 0.46711819238686403], ['CRODD', '>=', '<=', 0.04387727601102942, 0.2576724453369088], ['r', '>=', '<=', 0.09516982007156316, 0.8989220843814594], ['Re', '>=', '<=', 0.7504030748700469, 0.9345413572838476]]]))
#dRules.append(([49,[['p', '>=', '<=', 0.8891385397573303, 0.9114937626509478], ['P', '>=', '<=', 0.05646648943349508, 0.6181147429409936], ['DD', '>=', '<=', 0.012983938887154767, 0.885880001632062], ['SLK', '>=', '<=', 0.4954043636240605, 0.5059053371504542], ['ODD', '>=', '<=', 0.8194279156322981, 0.9857005125377866], ['MODD', '>=', '<=', 0.28858432550310864, 0.3415172068421404], ['CR', '>=', '<=', 0.01334251165260858, 0.2192148050234024], ['CRODD', '>=', '<=', 0.22887903034061718, 0.8609496758108991], ['r', '>=', '<=', 0.0714705620521705, 0.08165149330231325], ['Re', '>=', '<=', 0.6483256893410173, 0.6980648591654219]]]))
#dRules.append(([50,[['p', '>=', '<=', 0.0016159433048523741, 0.39109696684333073], ['P', '>=', '<=', 0.04547847133186489, 0.8631235481199213], ['DD', '>=', '<=', 0.032958379286433526, 0.9115890717611816], ['SLK', '>=', '<=', 0.7459265950964766, 0.971719016802487], ['ODD', '>=', '<=', 0.3617502016155838, 0.9921039118349707], ['MODD', '>=', '<=', 0.038126610120929216, 0.9096129678528586], ['CR', '>=', '<=', 0.07583829057419722, 0.6463703709715055], ['CRODD', '>=', '<=', 0.6910279634896039, 0.9635642131617106], ['r', '>=', '<=', 0.24631919332546792, 0.9029608235817116], ['Re', '>=', '<=', 0.10363183165689271, 0.989484199733598]]]))
#dRules.append(([51,[['p', '>=', '<=', 0.754258112877482, 0.8198312899627556], ['P', '>=', '<=', 0.7616424569434627, 0.8554555421648808], ['DD', '>=', '<=', 0.02378709022658987, 0.5004319934405663], ['SLK', '>=', '<=', 0.02354086946206657, 0.08798736082290248], ['ODD', '>=', '<=', 0.6922622965126132, 0.9408292674445303], ['MODD', '>=', '<=', 0.6465179539795005, 0.6780762608541698], ['CR', '>=', '<=', 0.9076481030043017, 0.9860149741543399], ['CRODD', '>=', '<=', 0.790194311385072, 0.7993330473752364], ['r', '>=', '<=', 0.09477099211143036, 0.7916870175358866], ['Re', '>=', '<=', 0.12604125760070606, 0.46372372089010816]]]))
#dRules.append(([52,[['p', '>=', '<=', 0.2803927744716045, 0.2966006110051702], ['P', '>=', '<=', 0.5661403454728134, 0.6307543574755925], ['DD', '>=', '<=', 0.12236756222612888, 0.7861958680216814], ['SLK', '>=', '<=', 0.27374350964091265, 0.3055614741061723], ['ODD', '>=', '<=', 0.4019123405118602, 0.9744103947615455], ['MODD', '>=', '<=', 0.21847113753248948, 0.21923946505179603], ['CR', '>=', '<=', 0.4294402556038993, 0.4762049521948897], ['CRODD', '>=', '<=', 0.6857840352524301, 0.9134925276972691], ['r', '>=', '<=', 0.1550810776106576, 0.197367238896218], ['Re', '>=', '<=', 0.19464376347511692, 0.2201422925076647]]]))

'''

Resultfilez = open("sumofresult.txt", "a")
result = M.Main(dRules, 0)
absd = 11
#nonDominated.append([result[1],result[2],result[3]])
#print d,mal[0],mal[1][0],mal[1][1]
#print nonDominated
#nDominated=NDS.sorting(nonDominated)
for k in result:
    Resultfilez.write(str(k[0]) + "\t")
    Resultfilez.write(str(k[1]) + "\t")
    Resultfilez.write(str(k[2]) + "\t")
    Resultfilez.write(str(k[3]) + "\n")
    nonDominated.append([k[1], k[2], k[3]])
nDominated = NDS.sorting(nonDominated)
Ejemplo n.º 12
0
 def move(self):
     startMove = main.Main(self.start)
    def setUp(self):
        path = (os.environ['BORG'] + '/Brain/data/hog_test/maintest/')

        self.main = main.Main(path)