当前位置: 首页>>代码示例>>Python>>正文


Python lib.Waldo类代码示例

本文整理汇总了Python中waldo.lib.Waldo的典型用法代码示例。如果您正苦于以下问题:Python Waldo类的具体用法?Python Waldo怎么用?Python Waldo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Waldo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: callback

def callback():
        myGame = int(client.getGame())
        msg_to_send = e.get()
        ready = client.send_cmd(-3, False)
        #if ready:
                #print full[myGame] + " is ready to play!"

	if(msg_to_send != ''):
                e.delete(0,END)
                listbox.yview(END)

		if(msg_to_send[0] != '/'):
			client.send_msg(name + ": " + msg_to_send)

		else:
                        #print msg_to_send[1:]
			result = switch(msg_to_send[1:])
                        #print "My game is " + str(myGame)

			if(result != myGame):
				if(result == -3):
					Waldo.stop(); #does this even work? i don't think so!
				else:
					client.send_cmd(myGame, False)
					if(myGame >= 0):
						client.send_msg(name + " no longer wishes to play " + full[myGame] + ". Sissy.")
					if(result >= 0):
						client.send_cmd(result, True)
						client.send_msg(name + " would like to play " + full[result] + "!")
                                                #client.setGame(result)
                        client.setGame(result)
			myGame = result;
开发者ID:harrison8989,项目名称:Waldo,代码行数:32,代码来源:client.py

示例2: spawn_acceptor

def spawn_acceptor():
    '''
    Starts the TCP accept thread and spins as connections are brought up.
    '''
    Waldo.tcp_accept(InnerPong, HOST, PORT_INNER, throw_func)
    while True:
        pass
开发者ID:bmistree,项目名称:Waldo,代码行数:7,代码来源:network_exception_nested_sequence_test.py

示例3: run_test

def run_test():
    accept_stoppable = Waldo.tcp_accept(
        SideA, SIDEA_HOST, SIDEA_PORT,
        connected_callback=sidea_connected)
    
    sideb = Waldo.tcp_connect(
        SideB,SIDEA_HOST,SIDEA_PORT)

    sidea = sidea_wait_queue.get()

    sidea.do_nothing()
    sideb.do_nothing()

    sidea.stop()
    time.sleep(1)

    # ensure that stop fires on single host.
    try:
        sidea.do_nothing()
        return False
    except Waldo.StoppedException as inst:
        pass

    # ensure that the other side also sees the stop.
    try:
        sideb.do_nothing()
        return False
    except Waldo.StoppedException as inst:
        pass

    return True
开发者ID:harrison8989,项目名称:Waldo,代码行数:31,代码来源:two_side_stop.py

示例4: run_test

def run_test():
    accept_stoppable = Waldo.tcp_accept(
        SideA, SIDEA_HOST, SIDEA_PORT,
        connected_callback=sidea_connected)
    
    sideb = Waldo.tcp_connect(
        SideB,SIDEA_HOST,SIDEA_PORT)

    sidea = sidea_wait_queue.get()

    sidea.add_stop_listener(sidea_stop_listener)
    sideb.add_stop_listener(sideb_stop_listener_1)
    sideb.add_stop_listener(sideb_stop_listener_2)
    listener_id = sideb.add_stop_listener(sideb_stop_listener_2)
    sideb.remove_stop_listener(listener_id)
    sideb.remove_stop_listener(listener_id)
    
    sidea.do_nothing()
    sideb.do_nothing()
    sidea.stop()
    time.sleep(1)

    if sidea_stop_counter != 1:
        return False
    
    if sideb_stop_counter != 3:
        return False

    return True
开发者ID:bmistree,项目名称:Waldo,代码行数:29,代码来源:two_side_stop_callbacks.py

示例5: run_chatter_a

def run_chatter_a():
  # runs in accept mode
  global quit
  Waldo.tcp_accept(ChatterA, HOSTNAME, PORT, display_msg,
      connected_callback=listen_for_user_input)
  while True:
    if quit:
      break
    time.sleep(SLEEP_TIME)
开发者ID:JayThomason,项目名称:waldo-tests,代码行数:9,代码来源:chatter.py

示例6: run_test

def run_test():
    """
    Tests whether Waldo can propagate an application exception back through an
    endpoint call.

    Returns true if the test passes and false otherwise.
    """
    thrower = Waldo.no_partner_create(SingleSide, None)
    catcher = Waldo.no_partner_create(SingleSide, thrower)
    return catcher.test_catch()
开发者ID:bmistree,项目名称:Waldo,代码行数:10,代码来源:application_exception_endpoint_call_test.py

示例7: run_server

def run_server():
  '''
  Runs the multi-connection chat server.
  '''
  global server
  server = Waldo.no_partner_create(Server, display_msg)
  print server
  Waldo.tcp_accept(ClientHandler, HOSTNAME, PORT, server, display_msg)
  while True:
    time.sleep(SLEEP_TIME)
开发者ID:JayThomason,项目名称:waldo-tests,代码行数:10,代码来源:chatter.py

示例8: run_test

def run_test():
    '''
    Tests Waldo's ability to detect an application exception on the partner
    endpoint mid-sequence and propagate that exception back to the root endpoint
    for handling.
    
    Returns true if the exception is caught and handled, and false otherwise.
    '''
    Waldo.tcp_accept(Pong,HOST,PORT)
    connector = Waldo.tcp_connect(Ping,HOST,PORT)
    return connector.testPropagateException()
开发者ID:bmistree,项目名称:Waldo,代码行数:11,代码来源:application_exception_sequence_propagate_test.py

示例9: run_test

def run_test():
    Waldo.tcp_accept(Pt2, HOST, PORT, connected_callback=pt2_connected)
    pt1 = Waldo.tcp_connect(Pt1, HOST, PORT,createList);

    pt2 = pt2_wait_queue.get()
    returned_list = pt1.start_seq()
    time.sleep(1)
    list_to_return.append('wo')
    if returned_list != list_to_return:
        return False

    return True
开发者ID:bmistree,项目名称:Waldo,代码行数:12,代码来源:foreign_func_in_sequence.py

示例10: run_test

def run_test():
    '''
    Tests Waldo's ability to propagate an ApplicationException back through an
    endpoint call on the remote partner in a sequence. The exception should be
    passed back to the root endpoint which initiates the sequence.
    
    Returns true if the exception is caught and handled, and false otherwise.
    '''
    thrower = Waldo.no_partner_create(Pong,None)
    catcher_partner = Waldo.tcp_accept(Pong,HOST,PORT,thrower)
    catcher = Waldo.tcp_connect(Ping,HOST,PORT)
    return catcher.testExceptionPropagation()
开发者ID:bmistree,项目名称:Waldo,代码行数:12,代码来源:application_exception_sequence_with_endpoint_call_test.py

示例11: run_test

def run_test():
    '''
    Tests Waldo's ability to propagate an exception back through a sequence within
    an endpoint call.
    
    Returns true if the exception is caught and handled, and false otherwise.
    '''
    Waldo.tcp_accept(Pong,HOST,PORT)
    connector = Waldo.tcp_connect(Ping,HOST,PORT)
    catcher = Waldo.no_partner_create(Catcher)
    catcher.addEndpoint(connector)
    return catcher.testCatchApplicationExceptionFromSequence()
开发者ID:bmistree,项目名称:Waldo,代码行数:12,代码来源:application_exception_endpoint_call_with_sequence_test.py

示例12: run_test

def run_test():
    '''
    Tests the try...finally statement (without the use of catch).

    Returns true if an error may be propagated through a try...finally
    and handled later while having the code in the finally block 
    execute.
    '''
    catcher = Waldo.no_partner_create(Catcher)
    thrower = Waldo.no_partner_create(Thrower)
    catcher.addEndpoint(thrower)
    thrower.addEndpoint(catcher)
    return catcher.testTryFinally()
开发者ID:bmistree,项目名称:Waldo,代码行数:13,代码来源:try_finally_test.py

示例13: run_test

def run_test():
    '''
    Tests Waldo's ability to detect a network failure between two endpoints
    mid-sequence, thrown a NetworkException, and catch that exception using
    a try-catch.
    
    Returns true if the exception is caught and handled, and false otherwise.
    '''
    Waldo.set_default_heartbeat_period(1)
    Waldo.set_default_partner_timeout(3)
    acceptor_process.start()
    time.sleep(SLEEP_TIME)
    connector = Waldo.tcp_connect(Ping,HOST,PORT,signal_func)
    return connector.testNetworkException()
开发者ID:bmistree,项目名称:Waldo,代码行数:14,代码来源:network_exception_mid_sequence_test.py

示例14: on_change_password

def on_change_password(event):
    password_info = menu.get_password_info() #contains tuple (current password, new password, new password)
    cur_password = password_info[0]
    if user_login.get_encrypted_key(name, cur_password) != "":
        if password_info[1] == password_info[2]:
            new_password = password_info[1]
            salt = user_login.get_salt(name)
            new_pw_hash = Waldo.hash(new_password, salt)
            user_login.change_password(name, Waldo.encrypt_keytext(key, new_pw_hash), new_pw_hash)
            menu.set_message("Password has been changed.")
        else:
            menu.set_message("New passwords do not match.")
    else:
        menu.set_message("Username/password combination was not found.")
开发者ID:ekyauk,项目名称:waldo_programs,代码行数:14,代码来源:user.py

示例15: on_login

def on_login (event):
    login_info = login.get_login_info()
    encrypted_key = user_login.get_encrypted_key(login_info[0], login_info[1])
    if encrypted_key != "":
        global name
        name = login_info[0]
        password_hashed = Waldo.hash(login_info[1], user_login.get_salt(name))
        global key
        key = Waldo.decrypt_keytext(encrypted_key, password_hashed)
        global certificate
        certificate = Waldo.get_cert_from_text(user_login.get_certificate(name))
        login.close()
    else:
        login.set_message("Username/password combination was not found.")
开发者ID:ekyauk,项目名称:waldo_programs,代码行数:14,代码来源:user.py


注:本文中的waldo.lib.Waldo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。