本文整理匯總了Python中tornado.options.options.group_dict方法的典型用法代碼示例。如果您正苦於以下問題:Python options.group_dict方法的具體用法?Python options.group_dict怎麽用?Python options.group_dict使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tornado.options.options
的用法示例。
在下文中一共展示了options.group_dict方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: main
# 需要導入模塊: from tornado.options import options [as 別名]
# 或者: from tornado.options.options import group_dict [as 別名]
def main():
parse_command_line(final=False)
parse_config_file(options.config_file)
app = Application(
[
('/', MainHandler),
('/login', LoginHandler),
('/logout', LogoutHandler),
],
login_url='/login',
**options.group_dict('application'))
app.listen(options.port)
logging.info('Listening on http://localhost:%d' % options.port)
IOLoop.current().start()
示例2: group_dict
# 需要導入模塊: from tornado.options import options [as 別名]
# 或者: from tornado.options.options import group_dict [as 別名]
def group_dict(self, group):
"""The names and values of options in a group.
Useful for copying options into Application settings::
from tornado.options import define, parse_command_line, options
define('template_path', group='application')
define('static_path', group='application')
parse_command_line()
application = Application(
handlers, **options.group_dict('application'))
.. versionadded:: 3.1
"""
return dict(
(opt.name, opt.value()) for name, opt in self._options.items()
if not group or group == opt.group_name)
示例3: group_dict
# 需要導入模塊: from tornado.options import options [as 別名]
# 或者: from tornado.options.options import group_dict [as 別名]
def group_dict(self, group: str) -> Dict[str, Any]:
"""The names and values of options in a group.
Useful for copying options into Application settings::
from tornado.options import define, parse_command_line, options
define('template_path', group='application')
define('static_path', group='application')
parse_command_line()
application = Application(
handlers, **options.group_dict('application'))
.. versionadded:: 3.1
"""
return dict(
(opt.name, opt.value())
for name, opt in self._options.items()
if not group or group == opt.group_name
)
示例4: group_dict
# 需要導入模塊: from tornado.options import options [as 別名]
# 或者: from tornado.options.options import group_dict [as 別名]
def group_dict(self, group):
"""The names and values of options in a group.
Useful for copying options into Application settings::
from tornado.options import define, parse_command_line, options
define('template_path', group='application')
define('static_path', group='application')
parse_command_line()
application = Application(
handlers, **options.group_dict('application'))
.. versionadded:: 3.1
"""
return dict(
(name, opt.value()) for name, opt in self._options.items()
if not group or group == opt.group_name)