简体   繁体   English

Openstack Python代码** kwargs-> help = _('在管理员上下文中用于连接nova的密码')

[英]Openstack Python code **kwargs -> help=_('Password for connection to nova in admin context')

I want to analyze OpenStack code for research. 我想分析OpenStack代码进行研究。 but I am not familiar with Python. 但是我对Python不熟悉。 I don't understand why that code have single under score -> help=_('string') I can't find that shape in python book plz help me to know usage of that grammer in python Thanks This is oslo_config package with cfg module... 我不明白为什么该代码在得分下只有一个-> help = _('string')我在python书中找不到该形状plz帮助我知道python中该语法的用法谢谢这是带有cfg的oslo_config程序包模块...

class oslo_config.cfg.BoolOpt(name, **kwargs) oslo_config.cfg.BoolOpt(名称,** kwargs)类

Parameters: name – the option's name **kwargs – arbitrary keyword arguments passed to Opt 参数:name-选项的名称** kwargs-传递给Opt的任意关键字参数

from oslo_config import cfg
core_opts = [
    cfg.BoolOpt('allow_bulk', default=True,
                help=_("Allow the usage of the bulk API")),
    cfg.BoolOpt('allow_pagination', default=False,
                help=_("Allow the usage of the pagination")),
    cfg.StrOpt('api_paste_config', default="api-paste.ini",
               help=_("The API paste config file to use")),
    cfg.StrOpt('api_extensions_path', default="",
               help=_("The path for API extensions")),

The _() is there to support text translation. _()在那里支持文本翻译。 It is an alias for the gettext() function in the gettext module. 它是gettext模块中gettext()函数的别名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM