简体   繁体   中英

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

I want to analyze OpenStack code for research. but I am not familiar with 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...

class oslo_config.cfg.BoolOpt(name, **kwargs)

Parameters: name – the option's name **kwargs – arbitrary keyword arguments passed to 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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