예제 #1
0
 def play(self, board, event):
     xy = (event.x, event.y)
     hex_closest = app.App().closest_hex(xy)
     while (not app.App().click_posnew(hex_closest)
            in app.App().possible_move()):
         print("Action is not valid, try another one:")
     app.App().draw_white(self.can, board, self.size)
예제 #2
0
    def play(self, board, depth, alpha, beta):
        for i in range(
                len(board.possible_moves)
        ):  # .child(position,possible_moves): #i put the board as position and children are the possible moves
            new_child = board.child(board, board.possible_moves[i], board)
        score_eval, hex_closest = app.App().MinMax(new_child, depth - 1, alpha,
                                                   beta, False)

        app.App().draw_black(self.can, hex_closest, self.size)
예제 #3
0
 def __init__(self):
     """
     create a new game
     """
     Tk.__init__(self)
     self.board = app.App().create_hexes_board(app.App().initGrid(
         20, 20, 18))
     self.firsthand = player.Human(player.FIRST_HAND)
     self.lasthand = player.Bot(player.LAST_HAND)
     self.can = Tk.Canvas(self, width=650, height=550, bg="#60ace6")
     self.size = 18
def main():
    u = util.Util()
    a = app.App()
    creds_b64 = a.get_creds("creds.json")
    plaintext_sudo_password = u.b64_decrypt(creds_b64["sudo_password"])
    plaintext_ssh_user = u.b64_decrypt(creds_b64["ssh_user"])
    plaintext_ssh_password = u.b64_decrypt(creds_b64["ssh_password"])
    all_cmds = a.get_array_cmd("cmds.json", plaintext_sudo_password)

    # File with IPs
    serv_lst = "srv.txt"

    # Open IP file
    with open(serv_lst, "r") as f:
        text = f.readlines()

    # for-loop for IP list
    for lineHost in text:
        lineHost = lineHost.replace("\n", "")

        # Connect SSH
        print("[+]Connecting Addr::" + lineHost)

        for c_cmd in all_cmds:
            ret = conn_ssh(lineHost, plaintext_ssh_user,
                           plaintext_ssh_password, c_cmd)

            with open("log.log", "a", encoding="utf-8") as fp:
                all_output = ret["stdout"] + ret["stderr"]
                fp.write(all_output)
                fp.close()

        print("SOC Output Results")
예제 #5
0
파일: gui.py 프로젝트: ryant18/CourseAdder
    def __init__(self):
        super(QWidget, self).__init__()
        self.app = backend.App()
        self.setWindowTitle("Course Adder")
        self.setMinimumSize(QSize(640, 480))
        self.termyears = cc.gettermyears()

        self.termyearcombobox = QComboBox()
        self.checkingtoggle = QPushButton("Start Check")
        self.delaylineedit = QLineEdit()
        self.crntable = QTableWidget()
        self.crntableinput = QLineEdit()

        self.termdelaybottomleft = QVBoxLayout()
        self.bottomrow = QHBoxLayout()
        self.mainlayout = QVBoxLayout()

        self.setupbuttons()
        self.setuplayout()
        self.linkbuttons()

        self.changetermyear(self.termyearcombobox.currentText())

        mainwidget = QWidget()
        mainwidget.setLayout(self.mainlayout)
        self.setCentralWidget(mainwidget)
예제 #6
0
    def __init__(self, id, eui64=None):

        # store params
        self.id = id

        # admin
        self.dataLock = threading.RLock()

        # singletons (quicker access, instead of recreating every time)
        self.log = SimEngine.SimLog.SimLog().log
        self.engine = SimEngine.SimEngine.SimEngine()
        self.settings = SimEngine.SimSettings.SimSettings()

        # stack state
        self.dagRoot = False
        self._init_eui64(eui64)
        self.ipv6_prefix = None

        # stack
        self.app = app.App(self)
        self.secjoin = secjoin.SecJoin(self)
        self.rpl = rpl.Rpl(self)
        self.sixlowpan = sixlowpan.Sixlowpan(self)
        self.trae = trae.TRAE(self)
        self.sf = sf.SchedulingFunction(self)
        self.sixp = sixp.SixP(self)
        self.tsch = tsch.Tsch(self)
        self.radio = radio.Radio(self)
        self.batt = batt.Batt(self)
예제 #7
0
    def login_pressed(self):

        employee_num = gv.name_var.get()
        password = gv.passw_var.get()

        # Check to see if the user exists
        if not globe.ud.user_exists(employee_num):
            messagebox.showwarning("Doesn't Exist",
                                   "Employee Number Doesn't Exist!")

        # Create a warning if either field is blank
        if employee_num == "" or password == "":
            messagebox.showwarning(
                "WARNING",
                "Employee Number or Password fields cannot be empty!")
        else:
            check = globe.ud.verify_user(employee_num, password)

            if check == 'None':
                messagebox.showwarning("No Password!",
                                       "Please Reset Your Password")
            elif check:
                # messagebox.showinfo("Success!", "Successfully Logged In")
                self.controller.destroy()
                app.App()
            else:
                messagebox.showwarning(
                    "Error", "Employee Number or Password are Incorrect")

        try:
            # Clear entry boxes
            gv.user_entry.delete(0, 'end')
            gv.password_entry.delete(0, 'end')
        except:
            print("Error but all is well ;)")
예제 #8
0
def task4():
    item = "Công nghệ kỹ thuật"
    print("Task " + item + " assigned to thread: " + threading.current_thread().name)
    newURL = mapping[item]
    print(newURL)
    _app = app.App(newURL, item)
    _app.getIdeasFromAllPage()
예제 #9
0
def task6():
    item = "Công tác tuyên truyền"
    print("Task " + item + " assigned to thread: " + threading.current_thread().name)
    newURL = mapping[item]
    print(newURL)
    _app = app.App(newURL, item)
    _app.getIdeasFromAllPage()
예제 #10
0
 def fire(self):
     """
     The function name is self explenatory
     """
     # Spawn a projectile
     app.App().get_current_scene().add_game_object(
         P(self._rect.center, self._rotation, speed=gv.PROJECTILE_SPEED))
예제 #11
0
def task11():
    item = "Hiện đại hóa nền hành chính"
    print("Task " + item + " assigned to thread: " + threading.current_thread().name)
    newURL = mapping[item]
    print(newURL)

    _app = app.App(newURL, item)
    _app.getIdeasFromAllPage()
예제 #12
0
def task9():
    item = "Giáo dục - Đào tạo"
    print("Task " + item + " assigned to thread: " + threading.current_thread().name)
    newURL = mapping[item]
    print(newURL)

    _app = app.App(newURL, item)
    _app.getIdeasFromAllPage()
예제 #13
0
def task15():
    item = "Nông - Lâm - Ngư nghiệp"
    print("Task " + item + " assigned to thread: " + threading.current_thread().name)
    newURL = mapping[item]
    print(newURL)

    _app = app.App(newURL, item)
    _app.getIdeasFromAllPage()
예제 #14
0
def task19():
    item = "Thể chế và thủ tục hành chính"
    print("Task " + item + " assigned to thread: " + threading.current_thread().name)
    newURL = mapping[item]
    print(newURL)

    _app = app.App(newURL, item)
    _app.getIdeasFromAllPage()
예제 #15
0
def task10():
    item = "Giao thông vận tải"
    print("Task " + item + " assigned to thread: " + threading.current_thread().name)
    newURL = mapping[item]
    print(newURL)

    _app = app.App(newURL, item)
    _app.getIdeasFromAllPage()
예제 #16
0
def task12():
    item = "Hoạt động đơn vị sự nghiệp công lập"
    print("Task " + item + " assigned to thread: " + threading.current_thread().name)
    newURL = mapping[item]
    print(newURL)

    _app = app.App(newURL, item)
    _app.getIdeasFromAllPage()
예제 #17
0
def task28():
    item = "Ý tưởng khác"
    print("Task " + item + " assigned to thread: " + threading.current_thread().name)
    newURL = mapping[item]
    print(newURL)

    _app = app.App(newURL, item)
    _app.getIdeasFromAllPage()
예제 #18
0
def task7():
    item = "Du lịch - giải trí"
    print("Task " + item + " assigned to thread: " + threading.current_thread().name)
    newURL = mapping[item]
    print(newURL)

    _app = app.App(newURL, item)
    _app.getIdeasFromAllPage()
예제 #19
0
def task26():
    item = "Xã hội cộng đồng"
    print("Task " + item + " assigned to thread: " + threading.current_thread().name)
    newURL = mapping[item]
    print(newURL)

    _app = app.App(newURL, item)
    _app.getIdeasFromAllPage()
예제 #20
0
def task23():
    item = "Ứng dụng công nghệ thông tin"
    print("Task " + item + " assigned to thread: " + threading.current_thread().name)
    newURL = mapping[item]
    print(newURL)

    _app = app.App(newURL, item)
    _app.getIdeasFromAllPage()
예제 #21
0
def run():
    print "Launching 3DPrinterOS"
    with open(pid_file_path, "w") as f:
        f.write(str(os.getpid()))
    while app.reboot_flag:
        app_instance = app.App()
        config.Config.instance().set_app_pointer(app_instance)
        app_instance.start_main_loop()
        del(app_instance)
예제 #22
0
def read_apps(filename):
	read_apps = []
	lines = asset_reader.read_file(filename)
	for line in lines.splitlines():
		split_line = [i.strip() for i in line.split("-")]
		if len(split_line) < 2:
			split_line.extend(split_line)
		read_apps.append(app.App(split_line[0], split_line[1]))
	return read_apps
예제 #23
0
def runserver():
    model.create_all()
    if not settings['debug']:
        options.options.log_file_prefix = settings['logfile_path']
    options.parse_command_line()
    application = app.App(settings)
    http_server = httpserver.HTTPServer(application)
    http_server.listen(settings['port'])
    ioloop.IOLoop.instance().start()  #Start IO Loop.
예제 #24
0
def get_config():
    a = app.App()
    utils = util.Util()
    config = a.get_creds("config.json")
    ip = config["ip"]
    esxi_dns_hostname = dns_resolver(ip)
    usr = utils.b64_decrypt(config["usr"])
    pwd = utils.b64_decrypt(config["passwd"])

    return {"server_ip":  ip, "server_dns_name": esxi_dns_hostname, "user_name": usr, "user_password": pwd}
예제 #25
0
def main():
  psg = passenger.Passenger("name", "email", 26, "address", "phone", "nif", "docID")

  client = app.App(psg)
  
  date = datetime.datetime.now()

  response = client.buy_tickets("from_city", "to_city", date, "HH:MM")

  print(json.dumps(response, indent=2))
예제 #26
0
 def test_unique(self):
     # arrange
     db = Mock(Database)
     MockApp = app.App(db)
     TestDrink = d.Drink("Test Type","Test Name","Test Details","Test Price")
     test_list = [TestDrink, TestDrink]
     expected = ["Test Name"]
     # act
     actual = MockApp.unique(test_list,"Test Type")
     # assert
     self.assertEqual(expected,actual)
예제 #27
0
def test_app():
    user = app.App()
    user.login('foo')
    assert user.access_page('foo') == 'approved'
    current = time.time()
    print(current)

    app.time.time = lambda: current + 9
    assert user.access_page('foo') == 'approved'

    app.time.time = lambda: current + 11
    assert user.access_page('foo') == 'expired'
예제 #28
0
    def test_drink_type_soft(self, got_input):
        # arrange
        db = Mock(Database)
        MockApp = app.App(db)
        got_input.side_effect = ["S"]
        expected = "Soft"

        # act
        actual = MockApp.drink_type()

        # assert
        self.assertEqual(expected,actual)
예제 #29
0
def test_app(monkeypatch):
    user = app.App()
    user.login('foo')
    assert user.access_page('foo') == 'approved'
    current = time.time()
    print(current)

    monkeypatch.setattr(app.time, 'time', lambda: current + 9)
    assert user.access_page('foo') == 'approved'

    monkeypatch.setattr(app.time, 'time', lambda: current + 11)
    assert user.access_page('foo') == 'expired'
예제 #30
0
def main():
    root = Tk()

    windowWidth = root.winfo_reqwidth()
    windowHeight = root.winfo_reqheight()

    positionRight = int(root.winfo_screenwidth() / 2.5 - windowWidth / 2)
    positionDown = int(root.winfo_screenheight() / 3.5 - windowHeight / 2)

    root.geometry("+{}+{}".format(positionRight, positionDown))

    app.App(root)
    root.mainloop()