• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python i18n._函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中neutronclient.i18n._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: add_known_arguments

    def add_known_arguments(self, parser):
        _add_updatable_args(parser)
        parser.add_argument(
            '--admin-state-down',
            dest='admin_state', action='store_false',
            help=_('Set admin state up to false.'))
        parser.add_argument(
            '--admin_state_down',
            dest='admin_state', action='store_false',
            help=argparse.SUPPRESS)
        parser.add_argument(
            '--mac-address',
            help=_('MAC address of this port.'))
        parser.add_argument(
            '--mac_address',
            help=argparse.SUPPRESS)
        parser.add_argument(
            '--vnic-type', metavar='<direct | macvtap | normal>',
            choices=['direct', 'macvtap', 'normal'],
            help=_('VNIC type for this port.'))
        parser.add_argument(
            '--vnic_type',
            choices=['direct', 'macvtap', 'normal'],
            help=argparse.SUPPRESS)
        self.add_arguments_secgroup(parser)
        self.add_arguments_extradhcpopt(parser)

        parser.add_argument(
            'network_id', metavar='NETWORK',
            help=_('Network ID or name this port belongs to.'))
开发者ID:Dynavisor,项目名称:python-neutronclient,代码行数:30,代码来源:port.py


示例2: get_parser

 def get_parser(self, prog_name):
     parser = super(CreatePortPairGroup, self).get_parser(prog_name)
     parser.add_argument(
         'name',
         metavar='NAME',
         help=_('Name of the Port Pair Group.'))
     parser.add_argument(
         '--description',
         help=_('Description for the Port Pair Group.'))
     parser.add_argument(
         '--port-pair',
         metavar='PORT-PAIR',
         dest='port_pairs',
         default=[],
         action='append',
         help=_('ID or name of the Port Pair.'
                'This option can be repeated.'))
     parser.add_argument(
         '--port-pair-group-parameters',
         metavar='[lb_fields=LB_FIELDS]',
         type=nc_utils.str2dict_type(optional_keys=['lb_fields']),
         help=_('Dictionary of Port pair group parameters. '
                'Currently, only \'&\' separated string of the lb_fields '
                'are supported.'))
     return parser
开发者ID:igordcard,项目名称:networking-sfc,代码行数:25,代码来源:port_pair_group.py


示例3: get_parser

 def get_parser(self, prog_name):
     parser = super(CreatePortPair, self).get_parser(prog_name)
     parser.add_argument(
         'name',
         metavar='NAME',
         help=_('Name of the Port Pair.'))
     parser.add_argument(
         '--description',
         help=_('Description for the Port Pair.'))
     parser.add_argument(
         '--ingress',
         required=True,
         help=_('ID or name of the ingress neutron port.'))
     parser.add_argument(
         '--egress',
         required=True,
         help=_('ID or name of the egress neutron port.'))
     parser.add_argument(
         '--service-function-parameter',
         metavar='[correlation=CORRELATION_TYPE, weight=WEIGHT]',
         type=nc_utils.str2dict_type(optional_keys=['correlation',
                                                    'weight']),
         help=_('Dictionary of Service function parameters. '
                'Currently, only correlation=None and weight '
                'is supported. Weight is an integer that influences '
                'the selection of a port pair within a port pair group '
                'for a flow. The higher the weight, the more flows will '
                'hash to the port pair. The default weight is 1.'))
     return parser
开发者ID:igordcard,项目名称:networking-sfc,代码行数:29,代码来源:port_pair.py


示例4: get_parser

 def get_parser(self, prog_name):
     parser = super(CreatePortChain, self).get_parser(prog_name)
     parser.add_argument(
         'name',
         metavar='NAME',
         help=_('Name of the Port Chain.'))
     parser.add_argument(
         '--description',
         help=_('Description for the Port Chain.'))
     parser.add_argument(
         '--port-pair-group',
         metavar='PORT-PAIR-GROUP',
         dest='port_pair_groups',
         required=True,
         action='append',
         help=_('ID or name of the Port Pair Group. '
                'This option can be repeated.'))
     parser.add_argument(
         '--flow-classifier',
         default=[],
         metavar='FLOW-CLASSIFIER',
         dest='flow_classifiers',
         action='append',
         help=_('ID or name of the Flow Classifier.'
                'This option can be repeated.'))
     parser.add_argument(
         '--chain-parameters',
         metavar='[correlation=CORRELATION_TYPE, symmetric=BOOLEAN_TYPE]',
         type=nc_utils.str2dict_type(optional_keys=['correlation',
                                                    'symmetric']),
         help=_('Dictionary of chain parameters. Supports '
                'correlation=mpls and symmetric=true|false'))
     return parser
开发者ID:igordcard,项目名称:networking-sfc,代码行数:33,代码来源:port_chain.py


示例5: add_known_arguments

 def add_known_arguments(self, parser):
     parser.add_argument(
         '--name',
         help=_('Name of this router.'))
     utils.add_boolean_argument(
         parser, '--admin-state-up', dest='admin_state',
         help=_('Specify the administrative state of the router'
                ' (True meaning "Up")'))
     utils.add_boolean_argument(
         parser, '--admin_state_up', dest='admin_state',
         help=argparse.SUPPRESS)
     utils.add_boolean_argument(
         parser, '--distributed', dest='distributed',
         help=_('True means this router should operate in'
                ' distributed mode.'))
     routes_group = parser.add_mutually_exclusive_group()
     routes_group.add_argument(
         '--route', metavar='destination=CIDR,nexthop=IP_ADDR',
         action='append', dest='routes', type=utils.str2dict,
         help=_('Route to associate with the router.'
                ' You can repeat this option.'))
     routes_group.add_argument(
         '--no-routes',
         action='store_true',
         help=_('Remove routes associated with the router.'))
开发者ID:nmagnezi,项目名称:python-neutronclient,代码行数:25,代码来源:router.py


示例6: add_known_arguments

 def add_known_arguments(self, parser):
     parser.add_argument(
         "--nodes",
         type=string.split,
         help=_("List of Service Chain Node IDs or names of the Service " "Chain Nodes"),
     )
     parser.add_argument("--shared", type=bool, help=_("Shared flag"))
开发者ID:hninthidawin,项目名称:python-group-based-policy-client,代码行数:7,代码来源:servicechain.py


示例7: _networktemplateassignment_updatable_args

def _networktemplateassignment_updatable_args(parser):
    parser.add_argument(
        'template_id', metavar='template-id',
        help=_('ID of the network template associated with this tenant.'))
    parser.add_argument(
        'stack_id', metavar='stack-id',
        help=_('ID of the heat template associated with this tenant.'))
开发者ID:wolverineav,项目名称:networking-bigswitch,代码行数:7,代码来源:_bsn_plugin_client.py


示例8: add_known_arguments

 def add_known_arguments(self, parser):
     add_updatable_arguments(parser)
     parser.add_argument(
         '--ip-version',
         type=int,
         default=4, choices=[4, 6],
         help=_('IP version to use, default is 4.'))
     parser.add_argument(
         '--ip_version',
         type=int,
         choices=[4, 6],
         help=argparse.SUPPRESS)
     parser.add_argument(
         'network_id', metavar='NETWORK',
         help=_('Network ID or name this subnet belongs to.'))
     parser.add_argument(
         'cidr', metavar='CIDR',
         help=_('CIDR of subnet to create.'))
     parser.add_argument(
         '--ipv6-ra-mode',
         choices=['dhcpv6-stateful', 'dhcpv6-stateless', 'slaac'],
         help=_('IPv6 RA (Router Advertisement) mode.'))
     parser.add_argument(
         '--ipv6-address-mode',
         choices=['dhcpv6-stateful', 'dhcpv6-stateless', 'slaac'],
         help=_('IPv6 address mode.'))
开发者ID:gdpak,项目名称:python-neutronclient,代码行数:26,代码来源:subnet.py


示例9: add_bandwidth_limit_arguments

def add_bandwidth_limit_arguments(parser):
    parser.add_argument(
        '--max_kbps',
        help=_('max bandwidth in kbps.'))
    parser.add_argument(
        '--max_burst_kbps',
        help=_('Max burst bandwidth in kbps.'))
开发者ID:mangelajo,项目名称:python-neutronclient,代码行数:7,代码来源:type.py


示例10: add_known_arguments

 def add_known_arguments(self, parser):
     # adding admin_state_up here so that it is available for update only
     # as it is True by default and not meaningful in the create operation
     parser.add_argument(
         '--admin-state-up',
         dest='admin_state_up',
         action='store_true',
         help=_('Set hosting device administratively up.'),
         default=argparse.SUPPRESS)
     parser.add_argument(
         '--admin_state_up',
         dest='admin_state_up',
         action='store_true',
         help=argparse.SUPPRESS,
         default=argparse.SUPPRESS)
     # adding no_auto_delete here so that it is available for update only
     # as auto_delete is False by default and not meaningful in the create
     # operation
     parser.add_argument(
         '--no-auto-delete',
         dest='auto_delete',
         action='store_false',
         help=_('Exempt hosting device from automated life cycle '
                'management.'),
         default=argparse.SUPPRESS)
     parser.add_argument(
         '--no_auto_delete',
         dest='auto_delete',
         action='store_false',
         help=argparse.SUPPRESS,
         default=argparse.SUPPRESS)
     _add_updatable_args(parser)
开发者ID:CiscoKorea,项目名称:networking-cisco,代码行数:32,代码来源:hostingdevice.py


示例11: _add_updatable_args

def _add_updatable_args(parser):
    parser.add_argument(
        '--name',
        help=_('Name of this Tap service.'))
    parser.add_argument(
        '--description',
        help=_('Description for this Tap service.'))
开发者ID:rachid-cherkaoui,项目名称:tap-as-a-service,代码行数:7,代码来源:tapservice.py


示例12: updatable_args2body

def updatable_args2body(parsed_args, body, for_create=True, ip_version=None):
    if parsed_args.disable_dhcp and parsed_args.enable_dhcp:
        raise exceptions.CommandError(_("You cannot enable and disable DHCP at the same time."))

    if parsed_args.no_gateway:
        body["subnet"].update({"gateway_ip": None})
    elif parsed_args.gateway:
        body["subnet"].update({"gateway_ip": parsed_args.gateway})
    if parsed_args.name:
        body["subnet"].update({"name": parsed_args.name})
    if parsed_args.disable_dhcp:
        body["subnet"].update({"enable_dhcp": False})
    if parsed_args.enable_dhcp:
        body["subnet"].update({"enable_dhcp": True})
    if parsed_args.allocation_pools:
        body["subnet"]["allocation_pools"] = parsed_args.allocation_pools
    if parsed_args.host_routes:
        body["subnet"]["host_routes"] = parsed_args.host_routes
    if parsed_args.dns_nameservers:
        body["subnet"]["dns_nameservers"] = parsed_args.dns_nameservers
    if for_create and parsed_args.ipv6_ra_mode:
        if ip_version == 4:
            raise exceptions.CommandError(_("--ipv6-ra-mode is invalid " "when --ip-version is 4"))
        body["subnet"]["ipv6_ra_mode"] = parsed_args.ipv6_ra_mode
    if for_create and parsed_args.ipv6_address_mode:
        if ip_version == 4:
            raise exceptions.CommandError(_("--ipv6-address-mode is " "invalid when --ip-version " "is 4"))
        body["subnet"]["ipv6_address_mode"] = parsed_args.ipv6_address_mode
开发者ID:yizhongyin,项目名称:OpenstackLiberty,代码行数:28,代码来源:subnet.py


示例13: add_known_arguments

 def add_known_arguments(self, parser):
     parser.add_argument("name", metavar="NAME", help=_("Name of the Port Chain."))
     parser.add_argument("--description", help=_("Description for the Port Chain."))
     parser.add_argument(
         "--port-pair-group",
         metavar="PORT-PAIR-GROUP",
         dest="port_pair_groups",
         default=[],
         required=True,
         action="append",
         help=_("ID or name of the Port Pair Group. " "This option can be repeated."),
     )
     parser.add_argument(
         "--flow-classifier",
         default=[],
         metavar="FLOW-CLASSIFIER",
         dest="flow_classifiers",
         action="append",
         help=_("ID or name of the Flow Classifier." "This option can be repeated."),
     )
     parser.add_argument(
         "--chain-parameters",
         metavar="type=TYPE[,correlation=CORRELATION_TYPE]",
         type=utils.str2dict,
         help=_("Dictionary of chain parameters. Currently, only " "correlation=mpls is supported by default."),
     )
开发者ID:jiangxilong,项目名称:networking-sfc,代码行数:26,代码来源:port_chain.py


示例14: validate_lifetime_dict

def validate_lifetime_dict(lifetime_dict):

    for key, value in lifetime_dict.items():
        if key not in lifetime_keys:
            message = _(
                "Lifetime Dictionary KeyError: "
                "Reason-Invalid unit key : "
                "'%(key)s' not in %(supported_key)s ") % {
                    'key': key, 'supported_key': lifetime_keys}
            raise exceptions.CommandError(message)
        if key == 'units' and value not in lifetime_units:
            message = _(
                "Lifetime Dictionary ValueError: "
                "Reason-Invalid units : "
                "'%(key_value)s' not in %(supported_units)s ") % {
                    'key_value': key, 'supported_units': lifetime_units}
            raise exceptions.CommandError(message)
        if key == 'value':
            try:
                if int(value) < 60:
                    raise ValueError()
            except ValueError:
                message = _(
                    "Lifetime Dictionary ValueError: "
                    "Reason-Invalid value should be at least 60:"
                    "'%(key_value)s' = %(value)s ") % {
                        'key_value': key, 'value': value}
                raise exceptions.CommandError(message)
            else:
                lifetime_dict['value'] = int(value)
    return
开发者ID:Dynavisor,项目名称:python-neutronclient,代码行数:31,代码来源:utils.py


示例15: _add_updatable_args

def _add_updatable_args(parser):
    parser.add_argument(
        '--name',
        help=_('Name of this port.'))
    parser.add_argument(
        '--fixed-ip', metavar='subnet_id=SUBNET,ip_address=IP_ADDR',
        action='append',
        help=_('Desired IP and/or subnet for this port: '
               'subnet_id=<name_or_id>,ip_address=<ip>. '
               'You can repeat this option.'))
    parser.add_argument(
        '--fixed_ip',
        action='append',
        help=argparse.SUPPRESS)
    parser.add_argument(
        '--device-id',
        help=_('Device ID of this port.'))
    parser.add_argument(
        '--device_id',
        help=argparse.SUPPRESS)
    parser.add_argument(
        '--device-owner',
        help=_('Device owner of this port.'))
    parser.add_argument(
        '--device_owner',
        help=argparse.SUPPRESS)
开发者ID:yizhongyin,项目名称:OpenstackLiberty,代码行数:26,代码来源:port.py


示例16: add_known_arguments

 def add_known_arguments(self, parser):
     parser.add_argument(
         '--name',
         help=_('Name of security group.'))
     parser.add_argument(
         '--description',
         help=_('Description of security group.'))
开发者ID:rjain-iitr,项目名称:python-neutronclient,代码行数:7,代码来源:securitygroup.py


示例17: validate_dpd_dict

def validate_dpd_dict(dpd_dict):
    for key, value in dpd_dict.items():
        if key not in dpd_supported_keys:
            message = _(
                "DPD Dictionary KeyError: "
                "Reason-Invalid DPD key : "
                "'%(key)s' not in %(supported_key)s ") % {
                    'key': key, 'supported_key': dpd_supported_keys}
            raise exceptions.CommandError(message)
        if key == 'action' and value not in dpd_supported_actions:
            message = _(
                "DPD Dictionary ValueError: "
                "Reason-Invalid DPD action : "
                "'%(key_value)s' not in %(supported_action)s ") % {
                    'key_value': value,
                    'supported_action': dpd_supported_actions}
            raise exceptions.CommandError(message)
        if key in ('interval', 'timeout'):
            try:
                if int(value) <= 0:
                    raise ValueError()
            except ValueError:
                message = _(
                    "DPD Dictionary ValueError: "
                    "Reason-Invalid positive integer value: "
                    "'%(key)s' = %(value)s ") % {
                        'key': key, 'value': value}
                raise exceptions.CommandError(message)
            else:
                dpd_dict[key] = int(value)
    return
开发者ID:Dynavisor,项目名称:python-neutronclient,代码行数:31,代码来源:utils.py


示例18: get_parser

 def get_parser(self, prog_name):
     parser = super(UpdatePolicyProfileV2, self).get_parser(prog_name)
     parser.add_argument("--add-tenant",
                         help=_("Add tenant to the policy profile."))
     parser.add_argument("--remove-tenant",
                         help=_("Remove tenant from the policy profile."))
     return parser
开发者ID:Dynavisor,项目名称:python-neutronclient,代码行数:7,代码来源:policyprofile.py


示例19: retry_request

    def retry_request(self, method, action, body=None,
                      headers=None, params=None):
        """Call do_request with the default retry configuration.

        Only idempotent requests should retry failed connection attempts.
        :raises: ConnectionFailed if the maximum # of retries is exceeded
        """
        max_attempts = self.retries + 1
        for i in range(max_attempts):
            try:
                return self.do_request(method, action, body=body,
                                       headers=headers, params=params)
            except exceptions.ConnectionFailed:
                # Exception has already been logged by do_request()
                if i < self.retries:
                    _logger.debug('Retrying connection to Neutron service')
                    time.sleep(self.retry_interval)
                elif self.raise_errors:
                    raise

        if self.retries:
            msg = (_("Failed to connect to Neutron server after %d attempts")
                   % max_attempts)
        else:
            msg = _("Failed to connect Neutron server")

        raise exceptions.ConnectionFailed(reason=msg)
开发者ID:hninthidawin,项目名称:python-group-based-policy-client,代码行数:27,代码来源:client.py


示例20: _add_updatable_args

def _add_updatable_args(parser):
    parser.add_argument(
        '--name',
        help=_('Name of this router type.'))
    parser.add_argument(
        '--description',
        help=_('Description of this router type.'))
    parser.add_argument(
        '--ha-enabled',
        dest='ha_enabled_by_default',
        action='store_true',
        help=_('Make HA enabled for the router type.'),
        default=argparse.SUPPRESS)
    parser.add_argument(
        '--ha_enabled',
        dest='ha_enabled_by_default',
        action='store_true',
        help=argparse.SUPPRESS,
        default=argparse.SUPPRESS)
    parser.add_argument(
        '--unshared',
        dest='shared',
        action='store_false',
        help=_('Make router type NOT shared among tenants.'),
        default=argparse.SUPPRESS)
    parser.add_argument(
        '--slot-need',
        help=_('Number of slots routers of this type consumes.'))
    parser.add_argument(
        '--slot_need',
        help=argparse.SUPPRESS)
开发者ID:CiscoKorea,项目名称:networking-cisco,代码行数:31,代码来源:routertype.py



注:本文中的neutronclient.i18n._函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python v2_0.find_resourceid_by_name_or_id函数代码示例发布时间:2022-05-27
下一篇:
Python utils.str2dict_type函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap