本文整理汇总了Python中server.run函数的典型用法代码示例。如果您正苦于以下问题:Python run函数的具体用法?Python run怎么用?Python run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: run
def run(params , options):
"""
"""
if len(params) and params[0].isdigit():
server.run(int(params[0]))
else:
server.run()
开发者ID:chshouyu,项目名称:ursa,代码行数:7,代码来源:start.py
示例2: run
def run(self):
log = get_log("daemon")
import server
try:
server.run()
except:
log.exception()
开发者ID:andythigpen,项目名称:x10,代码行数:7,代码来源:controller.py
示例3: next_round
def next_round(board, links, scores):
move = clients.Enemy.run(board, 1)
board, links, scores[0], won = server.run(board, links, scores[0], move, 1)
move = clients.Enemy.run(board, 2) # move = AI.run(board)
board, links, scores[1], won = server.run(board, links, scores[1], move, 2)
return board, links, scores, won
开发者ID:TheMegaTB,项目名称:TwixT,代码行数:8,代码来源:handler.py
示例4: server_thread_rountine
def server_thread_rountine():
self._thread_started_cond.acquire()
self._thread_started_cond.notify()
self._thread_started_cond.release()
with patch('smartbus.ipcclient.Client') as mock_smbipc_cls:
mock_smbipc_cls.__lib = True
mock_smbipc_cls.initialize = MagicMock(return_value=True)
server.run(prog_args)
开发者ID:Hesong-OpenSource,项目名称:sbusr,代码行数:8,代码来源:test_rpc.py
示例5: run
def run():
if not 'CONDUCTOR_CONFIG' in os.environ:
raise RuntimeError("CONDUCTOR_CONFIG is not set in the environment. Please contact Conductor support for help configuring Conductor Client")
if webbrowser.open('http://localhost:8085/index.html', new=1, autoraise=True):
server.run(port=8085)
else:
raise RuntimeError ("Unable to open web browser. Please contact Conductor support for help configuring Conductor Client")
开发者ID:AtomicConductor,项目名称:conductor_client,代码行数:8,代码来源:__init__.py
示例6: main
def main():
parser = argparse.ArgumentParser(description='Run the bycombat server.')
parser.add_argument('--build', choices=['debug', 'release'], default='debug', required=False, help='build to run with server')
parser.add_argument('--debug', action='store_const', const='debug', dest='build', help='run debug server using local cocos project')
parser.add_argument('--release', action='store_const', const='release', dest='build', help='run release server using built cocos project')
parser.add_argument('--port', type=int, dest='port', default=5000, help='run the server on a different port')
args = parser.parse_args()
debug = args.build == 'debug'
port = args.port
print('Running server in {} mode'.format(args.build))
server.run(debug, port)
开发者ID:adamlwgriffiths,项目名称:flask-cocos2d-js,代码行数:12,代码来源:server.py
示例7: run_server
def run_server():
import server
log('run server...')
cfg = read_config()
try:
while True:
server.run('res\\packages', cfg['address'], cfg['port'])
log('stopped, restarting...')
except:
log('* Crashed *')
import traceback
traceback.print_exc()
log('Server stopped!')
开发者ID:juho-p,项目名称:wot-map-viewer,代码行数:13,代码来源:__init__.py
示例8: _run
def _run(self):
self.gameOn = True
while self.gameOn:
run()
dt = fpsClock.tick(30)
#Inputs
self.inputManager.update()
#Updates
self.update(dt)
#Renders, put in the screen
self.render()
开发者ID:rafasimao,项目名称:SpaceInvadersCS,代码行数:15,代码来源:manager_server.py
示例9: test_run
def test_run(mock_make_server, mock_get):
mock_server = mock.MagicMock()
mock_make_server.return_value = mock_server
mock_get.return_value = fake_response(200, '{"FileStatuses": {"FileStatus": []}}')
server.run(['server.py'])
mock_make_server.assert_called_once_with('0.0.0.0', 9876, mock.ANY)
mock_server.serve_forever.assert_called_once_with()
mock_get.assert_called_once_with(
'http://localhost:14000/webhdfs/v1/?user.name=igv&op=liststatus')
mock_make_server.reset_mock()
mock_server.reset_mock()
mock_get.reset_mock()
server.run(['server.py', '1234'])
mock_make_server.assert_called_once_with('0.0.0.0', 1234, mock.ANY)
mock_server.serve_forever.assert_called_once_with()
mock_get.assert_called_once_with(
'http://localhost:14000/webhdfs/v1/?user.name=igv&op=liststatus')
开发者ID:hammerlab,项目名称:igv-httpfs,代码行数:18,代码来源:server_test.py
示例10: run_text_interface
def run_text_interface():
"""
takes command line input
"""
prompt = "press 1 to start a group chat\n" \
"press 2 to join a group chat\n" \
"press 3 to quit\n" \
"> "
# wait for the user to choose an option
choice = ""
while choice != "1" and choice != "2" and choice != "3":
choice = raw_input(prompt)
print ""
# run the selected option
if choice == "1":
server.run()
if choice == "2":
config.set_voice()
client.run()
elif choice == "3":
sys.exit()
开发者ID:claytonpeterson,项目名称:computer-voice-chat,代码行数:23,代码来源:main.py
示例11: len
#!/usr/bin/env python3
import server
import sys
if __name__ == "__main__":
if len(sys.argv) < 2:
server.run()
else:
server.run(sys.argv[1])
开发者ID:lnls-fac,项目名称:vacpp,代码行数:10,代码来源:run.py
示例12: main
def main():
"""Perform the analysis."""
parser = argparse.ArgumentParser(description="Process some integers.")
parser.add_argument(
"pid", metavar="PID", type=int, nargs="?", help="the pid of the run to analyze, or omit to use the latest"
)
parser.add_argument("--ownTime", dest="sort", action="store_const", const="own", help="sort by own time")
parser.add_argument("--calls", dest="sort", action="store_const", const="calls", help="sort by call count")
parser.add_argument("--average", dest="sort", action="store_const", const="avg", help="sort by call count")
parser.add_argument("--total", dest="sort", action="store_const", const="total", help="sort by total time")
parser.add_argument("--max", dest="sort", action="store_const", const="max", help="sort by total time")
parser.add_argument("--class", dest="classRegex", help="regex for classes to include")
parser.add_argument("--message", dest="messageRegex", help="regex for messsages to include")
parser.add_argument("--threads", dest="action", action="store_const", const="threads", help="print thread list")
parser.add_argument("--thread", dest="thread", help="filter by thread")
parser.add_argument("--minTime", dest="minTime", help="minimum time in micros to include")
parser.add_argument("--maxTime", dest="maxTime", help="maximum time in micros to include")
parser.add_argument("--tree", dest="tree", help="print a call tree")
parser.add_argument("--list", dest="listMessage", help="print a list of the given message calls")
parser.add_argument("--server", dest="action", action="store_const", const="server", help="run server")
parser.add_argument("--files", dest="action", action="store_const", const="files", help="list profile files")
parser.add_argument("--clean", dest="action", action="store_const", const="clean", help="delete profile files")
args = parser.parse_args()
if args.action == "clean":
cleanDataFiles()
return
if args.action == "files":
listDataFiles()
return
data = getData(args.pid)
if args.action == "threads":
for threadName, thread in data.threads.iteritems():
print "%s - %d events" % (threadName, len(thread.events))
return
if args.action == "server":
from server import run
run(data)
return
if args.tree:
for node in data.threads[args.tree].tree:
printNode(node)
return
if args.listMessage:
return listMessages(data, args.listMessage)
rule = buildRule(args)
longestName, ownTime, count, avg, totalTime, maxTime = data.compute(rule)
sortBy = ownTime
if args.sort == "calls":
sortBy = count
elif args.sort == "avg":
sortBy = avg
elif args.sort == "total":
sortBy = totalTime
elif args.sort == "max":
sortBy = maxTime
mostTime = sorted(sortBy.items(), key=lambda x: x[1], reverse=True)[:100]
print "%s %s %s %s %s %s" % (
fit("message", longestName + 3),
fit("calls", 9),
fit("ownTime", 13),
fit("avgOwn", 11),
fit("maxOwn", 14),
fit("total", 15),
)
for name, _ in mostTime:
print "%s %s %s %s %s %s" % (
fit(name, longestName + 3),
fit("%d" % count[name], 9),
fit("%0.3fms" % (ownTime.get(name, 0) / 1000.0), 13),
fit("%0.4fms" % (avg.get(name, 0) / 1000.0), 11),
fit("%0.4fms" % (maxTime[name] / 1000.0), 14),
fit("%0.3fms" % (totalTime[name] / 1000.0), 15),
)
开发者ID:jdcbbk,项目名称:hookshot,代码行数:93,代码来源:profile.py
示例13:
#! /usr/bin/env python3
import args
import server, client
if __name__ == '__main__':
(listen_port, remote_host, remote_port, files) = args.check_args()
# user may pass listen port 0
if listen_port != None:
server.run(listen_port, files)
else:
client.run(remote_host, remote_port, files)
开发者ID:lululeta2014,项目名称:mihaib,代码行数:13,代码来源:ft.py
示例14: print
try:
import config
print('[Info] Loading configuration from config.py')
Server = config.Server
Dashboard = config.Dashboard
Worker = config.Worker
except ImportError:
print('[Warning] No configuration file were found! Using default config settings.')
print('[Warning] For more info see config.py. example file or README file.')
Server = None
Dashboard = None
Worker = None
if len(sys.argv) < 2:
sys.exit('Usage: %s component-name (i.e. server, dashboard or worker)' % sys.argv[0])
elif (sys.argv[1] == 'worker'):
print 'running worker'
import worker
worker.run(Worker)
elif (sys.argv[1] == 'dashboard'):
print 'running dashboard'
import dashboard
dashboard.run(Dashboard)
elif (sys.argv[1] == 'server'):
print 'running server'
import server
server.run(Server)
else:
sys.exit('Usage: %s component-name (i.e. server, dashboard or worker)' % sys.argv[0])
开发者ID:msimoncz,项目名称:brender,代码行数:29,代码来源:brender.py
示例15: main
def main(argv=None): # IGNORE:C0111
'''Command line options.'''
if argv is None:
argv = sys.argv
else:
sys.argv.extend(argv)
program_name = os.path.basename(sys.argv[0])
program_version = "v%s" % __version__
program_build_date = str(__updated__)
program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date)
program_license = '''SmartBus Remote Method Provider for IPSC CTI server.
Created by [email protected] on %s.
Copyright 2014 Hesong(GuangZhou) Info-Tech. All rights reserved.
USAGE
''' % (str(__date__))
program_runtime_message = '''
runtime:
executable: {}
version: {}
platform: {}
path:
{}
'''.format(sys.executable, sys.version, sys.platform, (os.linesep + ' ').join(sys.path))
globalvars.startuptxt = '''
{}
{}
version : {}
date : {}
update : {}
'''.format(program_version_message, program_runtime_message, __version__, __date__, __updated__)
try:
# Setup argument parser
parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter)
parser.add_argument('-V', '--version', action='version', version=program_version_message)
parser.add_argument("-v", "--verbose", action="store_true", help="output verbose logging text.")
parser.add_argument('-W', '--no-web-server', action='store_true', help="run the program without starting the web server.")
# Process arguments
args = parser.parse_args()
# set INTERRUPT signal handler
def handle_sigint(signum, frame):
print('SIGINT handled!')
server.stop()
signal.signal(signal.SIGINT, handle_sigint)
except KeyboardInterrupt:
### handle keyboard interrupt ###
return 0
except Exception as e:
if DEBUG or TESTRUN:
raise(e)
indent = len(program_name) * " "
sys.stderr.write(program_name + ": " + repr(e) + "\n")
sys.stderr.write(indent + " for help use --help" + "\n")
return 2
# startup server
print('startup server')
server.run(args)
print('program terminated')
return 0
开发者ID:Hesong-OpenSource,项目名称:sbusr,代码行数:70,代码来源:sbusr_run.py
示例16: test_download
img = self.client.service.get_file("NETWORK", 1, "test.xlsx")
assert img is not None, "File was not saved or retrieved correctly!"
result = self.client.service.remove_file("NETWORK", 1, "test.xlsx")
assert result == 'OK', "File was not deletd correctly!"
def test_download(self):
file_to_upload = open('test.xlsx','rb')
fileData = file_to_upload.read()
encodedData = base64.b64encode(fileData)
file_to_upload.close()
self.client.service.add_file("NETWORK", 1, "test.xlsx", encodedData)
img = self.client.service.get_file("NETWORK", 1, "test.xlsx")
assert img == encodedData, "File was not retrieved correctly!"
result = self.client.service.remove_file("NETWORK", 1, "test.xlsx")
assert result == 'OK', "File was not deletd correctly!"
def test_deletFile(self):
file_to_upload = open('test.xlsx','rb')
fileData = file_to_upload.read()
encodedData = base64.b64encode(fileData)
file_to_upload.close()
self.client.service.add_file("NETWORK", 1, "test.xlsx", encodedData)
result = self.client.service.remove_file("NETWORK", 1, "test.xlsx")
assert result == 'OK', "File was not deletd correctly!"
if __name__ == '__main__':
server.run()
开发者ID:UMWRG,项目名称:HydraPlatform,代码行数:29,代码来源:test_image.py
示例17: set_state
self.add(self.state)
return self.state
@authenticated(["__has_ssl__"])
def set_state(self, request, state):
print "Setting state to", request,state
self.state = state
return self.state
# class MyOtherActuator(ContinuousActuator):
# def get_state(self, request):
# return self.state
# def set_state(self, request, state):
# print "Setting state to", state
# self.state = state
act = MyActuator(inst.uuid('/a1'), 'UoM')
import actuate
inst.add_timeseries('/a1', act)
inst.add_timeseries('/t1', 'V')
rl = RateLimiter(10)
a2 = inst.add_actuator('/a2', 'UoM', MyActuator,
read_limit=10,
write_limit=10,
setup={})
server.run(inst, port=8080)
# a = MyActuator()
# b = MyOtherActuator(range=[0, 5])
# SmapHttp.start_server({'a': a, 'b': b}, port=8000, handler=SmapHttp.SslSmapHandler)
开发者ID:Alwnikrotikz,项目名称:smap-data,代码行数:30,代码来源:actuate.py
示例18: start
def start():
server.run()
开发者ID:blueantelope,项目名称:-Antelope.CI,代码行数:2,代码来源:app.py
示例19: run
'''
Created on 08-Mar-2016
@author: Rohan Shah
'''
from server import app, run
# Runs API WSGI SERVER
# Use app variable as application when being used with uwsgi.
run(app, host='localhost', port=8000, server='gevent')
开发者ID:rohanjshah,项目名称:scale-apis-with-pub-sub,代码行数:11,代码来源:__main__.py
示例20: server_function
def server_function():
while True:
server.run()
开发者ID:imclab,项目名称:order_preserving_encryption,代码行数:3,代码来源:main.py
注:本文中的server.run函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论