当前位置: 首页>>代码示例>>Python>>正文


Python utils.get_service_module_name方法代码示例

本文整理汇总了Python中botocore.utils.get_service_module_name方法的典型用法代码示例。如果您正苦于以下问题:Python utils.get_service_module_name方法的具体用法?Python utils.get_service_module_name怎么用?Python utils.get_service_module_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在botocore.utils的用法示例。


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

示例1: _create_client_exceptions

# 需要导入模块: from botocore import utils [as 别名]
# 或者: from botocore.utils import get_service_module_name [as 别名]
def _create_client_exceptions(self, service_model):
        cls_props = {}
        code_to_exception = {}
        for shape_name in service_model.shape_names:
            shape = service_model.shape_for(shape_name)
            if shape.metadata.get('exception', False):
                exception_name = str(shape.name)
                exception_cls = type(exception_name, (ClientError,), {})
                code = shape.metadata.get("error", {}).get("code")
                cls_props[exception_name] = exception_cls
                if code:
                    code_to_exception[code] = exception_cls
                else:
                    # Use the exception name if there is no explicit code
                    # modeled
                    code_to_exception[exception_name] = exception_cls
        cls_name = str(get_service_module_name(service_model) + 'Exceptions')
        client_exceptions_cls = type(
            cls_name, (BaseClientExceptions,), cls_props)
        return client_exceptions_cls(code_to_exception) 
开发者ID:skarlekar,项目名称:faces,代码行数:22,代码来源:errorfactory.py

示例2: _create_client_class

# 需要导入模块: from botocore import utils [as 别名]
# 或者: from botocore.utils import get_service_module_name [as 别名]
def _create_client_class(self, service_name, service_model):
        class_attributes = self._create_methods(service_model)
        py_name_to_operation_name = self._create_name_mapping(service_model)
        class_attributes['_PY_TO_OP_NAME'] = py_name_to_operation_name
        bases = [AioBaseClient]
        service_id = service_model.service_id.hyphenize()
        await self._event_emitter.emit(
            'creating-client-class.%s' % service_id,
            class_attributes=class_attributes,
            base_classes=bases)
        class_name = get_service_module_name(service_model)
        cls = type(str(class_name), tuple(bases), class_attributes)
        return cls 
开发者ID:aio-libs,项目名称:aiobotocore,代码行数:15,代码来源:client.py

示例3: _create_client_class

# 需要导入模块: from botocore import utils [as 别名]
# 或者: from botocore.utils import get_service_module_name [as 别名]
def _create_client_class(self, service_name, service_model):
        class_attributes = self._create_methods(service_model)
        py_name_to_operation_name = self._create_name_mapping(service_model)
        class_attributes['_PY_TO_OP_NAME'] = py_name_to_operation_name
        bases = [BaseClient]
        self._event_emitter.emit('creating-client-class.%s' % service_name,
                                 class_attributes=class_attributes,
                                 base_classes=bases)
        class_name = get_service_module_name(service_model)
        cls = type(str(class_name), tuple(bases), class_attributes)
        return cls 
开发者ID:skarlekar,项目名称:faces,代码行数:13,代码来源:client.py

示例4: document_resource_waiter

# 需要导入模块: from botocore import utils [as 别名]
# 或者: from botocore.utils import get_service_module_name [as 别名]
def document_resource_waiter(section, resource_name, event_emitter,
                             service_model, resource_waiter_model,
                             service_waiter_model, include_signature=True):
    waiter_model = service_waiter_model.get_waiter(
        resource_waiter_model.waiter_name)
    operation_model = service_model.operation_model(
        waiter_model.operation)

    ignore_params = get_resource_ignore_params(resource_waiter_model.params)
    service_module_name = get_service_module_name(service_model)
    description = (
        'Waits until this %s is %s. This method calls '
        ':py:meth:`%s.Waiter.%s.wait` which polls. '
        ':py:meth:`%s.Client.%s` every %s seconds until '
        'a successful state is reached. An error is returned '
        'after %s failed checks.' % (
            resource_name, ' '.join(resource_waiter_model.name.split('_')[2:]),
            service_module_name,
            xform_name(resource_waiter_model.waiter_name),
            service_module_name,
            xform_name(waiter_model.operation),
            waiter_model.delay, waiter_model.max_attempts))
    example_prefix = '%s.%s' % (
        xform_name(resource_name), resource_waiter_model.name)
    document_model_driven_method(
        section=section, method_name=resource_waiter_model.name,
        operation_model=operation_model,
        event_emitter=event_emitter,
        example_prefix=example_prefix,
        method_description=description,
        exclude_input=ignore_params,
        include_signature=include_signature
    )
    if 'return' in section.available_sections:
        # Waiters do not return anything so we should remove
        # any sections that may document the underlying return
        # value of the client method.
        return_section = section.get_section('return')
        return_section.clear_text()
        return_section.remove_all_sections()
        return_section.write(':returns: None') 
开发者ID:skarlekar,项目名称:faces,代码行数:43,代码来源:waiter.py

示例5: _create_client_class

# 需要导入模块: from botocore import utils [as 别名]
# 或者: from botocore.utils import get_service_module_name [as 别名]
def _create_client_class(self, service_name, service_model):
        class_attributes = self._create_methods(service_model)
        py_name_to_operation_name = self._create_name_mapping(service_model)
        class_attributes['_PY_TO_OP_NAME'] = py_name_to_operation_name
        bases = [BaseClient]
        service_id = service_model.service_id.hyphenize()
        self._event_emitter.emit(
            'creating-client-class.%s' % service_id,
            class_attributes=class_attributes,
            base_classes=bases)
        class_name = get_service_module_name(service_model)
        cls = type(str(class_name), tuple(bases), class_attributes)
        return cls 
开发者ID:QData,项目名称:deepWordBug,代码行数:15,代码来源:client.py

示例6: _create_client_class

# 需要导入模块: from botocore import utils [as 别名]
# 或者: from botocore.utils import get_service_module_name [as 别名]
def _create_client_class(self, service_name, service_model):
        class_attributes = self._create_methods(service_model)
        py_name_to_operation_name = self._create_name_mapping(service_model)
        class_attributes['_PY_TO_OP_NAME'] = py_name_to_operation_name
        bases = [AioBaseClient]
        self._event_emitter.emit('creating-client-class.%s' % service_name,
                                 class_attributes=class_attributes,
                                 base_classes=bases)
        class_name = get_service_module_name(service_model)
        cls = type(str(class_name), tuple(bases), class_attributes)
        return cls 
开发者ID:skylander86,项目名称:lambda-text-extractor,代码行数:13,代码来源:client.py

示例7: get_paginator

# 需要导入模块: from botocore import utils [as 别名]
# 或者: from botocore.utils import get_service_module_name [as 别名]
def get_paginator(self, operation_name):
        """Create a paginator for an operation.

        :type operation_name: string
        :param operation_name: The operation name.  This is the same name
            as the method name on the client.  For example, if the
            method name is ``create_foo``, and you'd normally invoke the
            operation as ``client.create_foo(**kwargs)``, if the
            ``create_foo`` operation can be paginated, you can use the
            call ``client.get_paginator("create_foo")``.

        :raise OperationNotPageableError: Raised if the operation is not
            pageable.  You can use the ``client.can_paginate`` method to
            check if an operation is pageable.

        :rtype: L{botocore.paginate.Paginator}
        :return: A paginator object.

        """
        if not self.can_paginate(operation_name):
            raise OperationNotPageableError(operation_name=operation_name)
        else:
            actual_operation_name = self._PY_TO_OP_NAME[operation_name]

            # Create a new paginate method that will serve as a proxy to
            # the underlying Paginator.paginate method. This is needed to
            # attach a docstring to the method.
            def paginate(self, **kwargs):
                return AioPaginator.paginate(self, **kwargs)

            paginator_config = self._cache['page_config'][
                actual_operation_name]
            # Add the docstring for the paginate method.
            paginate.__doc__ = PaginatorDocstring(
                paginator_name=actual_operation_name,
                event_emitter=self.meta.events,
                service_model=self.meta.service_model,
                paginator_config=paginator_config,
                include_signature=False
            )

            # Rename the paginator class based on the type of paginator.
            paginator_class_name = str('%s.Paginator.%s' % (
                get_service_module_name(self.meta.service_model),
                actual_operation_name))

            # Create the new paginator class
            documented_paginator_cls = type(
                paginator_class_name, (AioPaginator,), {'paginate': paginate})

            operation_model = self._service_model.operation_model(actual_operation_name)
            paginator = documented_paginator_cls(
                getattr(self, operation_name),
                paginator_config,
                operation_model)
            return paginator

    # NOTE: this method does not differ from botocore, however it's important to keep
    #   as the "waiter" value points to our own asyncio waiter module 
开发者ID:aio-libs,项目名称:aiobotocore,代码行数:61,代码来源:client.py

示例8: get_paginator

# 需要导入模块: from botocore import utils [as 别名]
# 或者: from botocore.utils import get_service_module_name [as 别名]
def get_paginator(self, operation_name):
        """Create a paginator for an operation.

        :type operation_name: string
        :param operation_name: The operation name.  This is the same name
            as the method name on the client.  For example, if the
            method name is ``create_foo``, and you'd normally invoke the
            operation as ``client.create_foo(**kwargs)``, if the
            ``create_foo`` operation can be paginated, you can use the
            call ``client.get_paginator("create_foo")``.

        :raise OperationNotPageableError: Raised if the operation is not
            pageable.  You can use the ``client.can_paginate`` method to
            check if an operation is pageable.

        :rtype: L{botocore.paginate.Paginator}
        :return: A paginator object.

        """
        if not self.can_paginate(operation_name):
            raise OperationNotPageableError(operation_name=operation_name)
        else:
            actual_operation_name = self._PY_TO_OP_NAME[operation_name]

            # Create a new paginate method that will serve as a proxy to
            # the underlying Paginator.paginate method. This is needed to
            # attach a docstring to the method.
            def paginate(self, **kwargs):
                return Paginator.paginate(self, **kwargs)

            paginator_config = self._cache['page_config'][
                actual_operation_name]
            # Add the docstring for the paginate method.
            paginate.__doc__ = PaginatorDocstring(
                paginator_name=actual_operation_name,
                event_emitter=self.meta.events,
                service_model=self.meta.service_model,
                paginator_config=paginator_config,
                include_signature=False
            )

            # Rename the paginator class based on the type of paginator.
            paginator_class_name = str('%s.Paginator.%s' % (
                get_service_module_name(self.meta.service_model),
                actual_operation_name))

            # Create the new paginator class
            documented_paginator_cls = type(
                paginator_class_name, (Paginator,), {'paginate': paginate})

            paginator = documented_paginator_cls(
                getattr(self, operation_name),
                paginator_config)
            return paginator 
开发者ID:skarlekar,项目名称:faces,代码行数:56,代码来源:client.py

示例9: get_paginator

# 需要导入模块: from botocore import utils [as 别名]
# 或者: from botocore.utils import get_service_module_name [as 别名]
def get_paginator(self, operation_name):
        """Create a paginator for an operation.

        :type operation_name: string
        :param operation_name: The operation name.  This is the same name
            as the method name on the client.  For example, if the
            method name is ``create_foo``, and you'd normally invoke the
            operation as ``client.create_foo(**kwargs)``, if the
            ``create_foo`` operation can be paginated, you can use the
            call ``client.get_paginator("create_foo")``.

        :raise OperationNotPageableError: Raised if the operation is not
            pageable.  You can use the ``client.can_paginate`` method to
            check if an operation is pageable.

        :rtype: L{botocore.paginate.Paginator}
        :return: A paginator object.

        """
        if not self.can_paginate(operation_name):
            raise OperationNotPageableError(operation_name=operation_name)
        else:
            actual_operation_name = self._PY_TO_OP_NAME[operation_name]

            # Create a new paginate method that will serve as a proxy to
            # the underlying Paginator.paginate method. This is needed to
            # attach a docstring to the method.
            def paginate(self, **kwargs):
                return Paginator.paginate(self, **kwargs)

            paginator_config = self._cache['page_config'][
                actual_operation_name]
            # Add the docstring for the paginate method.
            paginate.__doc__ = PaginatorDocstring(
                paginator_name=actual_operation_name,
                event_emitter=self.meta.events,
                service_model=self.meta.service_model,
                paginator_config=paginator_config,
                include_signature=False
            )

            # Rename the paginator class based on the type of paginator.
            paginator_class_name = str('%s.Paginator.%s' % (
                get_service_module_name(self.meta.service_model),
                actual_operation_name))

            # Create the new paginator class
            documented_paginator_cls = type(
                paginator_class_name, (Paginator,), {'paginate': paginate})

            operation_model = self._service_model.operation_model(actual_operation_name)
            paginator = documented_paginator_cls(
                getattr(self, operation_name),
                paginator_config,
                operation_model)
            return paginator 
开发者ID:QData,项目名称:deepWordBug,代码行数:58,代码来源:client.py


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