本文整理汇总了Python中waldo.lib.Waldo类的典型用法代码示例。如果您正苦于以下问题:Python Waldo类的具体用法?Python Waldo怎么用?Python Waldo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Waldo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: run_test
def run_test():
id_tester = Waldo.no_partner_create(IdTester)
id = id_tester.id()
manager = Waldo.no_partner_create(Manager)
manager_id = manager.id()
manager.add_endpoint(id_tester)
if id != id_tester._uuid or manager_id != manager._uuid:
return False
elif id_tester.get_id() != id_tester.id() or manager.get_id() != manager.id():
return False
elif id != manager.get_managed_endpoint_id():
return False
else:
return True
开发者ID:bmistree,项目名称:Waldo,代码行数:14,代码来源:id_method.py
示例17: start_coordinator
def start_coordinator():
math_endpoint = Waldo.math_endpoint_lib()
coordinator_master = Waldo.no_partner_create(
CoordinatorMaster, util_funcs.between,
util_funcs.rand_uuid,math_endpoint,
conf.MAX_NUMBER_FINGER_TABLE_ENTRIES)
# begin listening for connections to coordinator master
Waldo.tcp_accept(
Coordinator, conf.COORDINATOR_HOST_PORT_PAIR.host,
conf.COORDINATOR_HOST_PORT_PAIR.port, coordinator_master)
return coordinator_master
开发者ID:bmistree,项目名称:Waldo,代码行数:14,代码来源:dht_lib.py
示例18: run_test
def run_test():
single_side = Waldo.no_partner_create(SingleSide)
if not test_ext_num(single_side):
return False
return True
开发者ID:bmistree,项目名称:Waldo,代码行数:7,代码来源:external_tests.py
示例19: run_test
def run_test():
single_side = Waldo.no_partner_create(SingleSide)
if (1, 2, 3) != single_side.return_static_nums():
print "\nErr getting static numbers"
return False
if (1, 2, 3) != single_side.return_func_call_nums():
print "\nErr getting func call numbers"
return False
if ("a", "b") != single_side.return_variable_texts():
print "\nErr getting variable texts"
return False
if ("a", "b") != single_side.return_func_call_variable_texts():
print "\nErr getting func call variable texts"
return False
if ("a", "b", "c") != single_side.return_extended_texts():
print "\nErr getting extended texts"
return False
for i in range(1, 15):
if (i, i) != single_side.return_tuple_endpoint_global():
print "\nErr: incorrect tuple value of mutated state"
return False
for j in range(i + 1, i + 15):
if (j, j, 0) != single_side.wrapped_tuple():
print "\nErr: incorrect tuple value of wrapped mutated state"
return False
return True
开发者ID:harrison8989,项目名称:Waldo,代码行数:34,代码来源:tuple_return_tests.py
示例20: main
def main():
# Connecting + Starting
client = Waldo.tcp_connect(Client, HOSTNAME, PORT)
print "Started"
startTime = time.time()
# Sending all messages
try:
for n in range(0, 100):
client.send_msg(str(100))
time.sleep(DELAY)
for n in range(100, numMessages):
client.send_msg(str(n))
time.sleep(DELAY)
except:
print "Sending message failed."
# Packaging time and sending it
totalTime = time.time() - startTime
print "Finished: " + str(totalTime)
numClients = 1
if len(sys.argv) >= 2:
# assume numClients is only one unless the number of clients is given
numClients = int(sys.argv[1])
# Writing and closing
client.stop()
f = open("clientLog", "a")
f.write(str(numClients) + " " + str(numClients * numMessages) + " " + str(totalTime) + "\n")
f.close()
开发者ID:harrison8989,项目名称:Waldo,代码行数:30,代码来源:client.py
注:本文中的waldo.lib.Waldo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论