本文整理匯總了Python中botocore.docs.docstring.ClientMethodDocstring方法的典型用法代碼示例。如果您正苦於以下問題:Python docstring.ClientMethodDocstring方法的具體用法?Python docstring.ClientMethodDocstring怎麽用?Python docstring.ClientMethodDocstring使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類botocore.docs.docstring
的用法示例。
在下文中一共展示了docstring.ClientMethodDocstring方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _create_api_method
# 需要導入模塊: from botocore.docs import docstring [as 別名]
# 或者: from botocore.docs.docstring import ClientMethodDocstring [as 別名]
def _create_api_method(self, py_operation_name, operation_name,
service_model):
def _api_call(self, *args, **kwargs):
# We're accepting *args so that we can give a more helpful
# error message than TypeError: _api_call takes exactly
# 1 argument.
if args:
raise TypeError(
"%s() only accepts keyword arguments." % py_operation_name)
# The "self" in this scope is referring to the BaseClient.
return self._make_api_call(operation_name, kwargs)
_api_call.__name__ = str(py_operation_name)
# Add the docstring to the client method
operation_model = service_model.operation_model(operation_name)
docstring = ClientMethodDocstring(
operation_model=operation_model,
method_name=operation_name,
event_emitter=self._event_emitter,
method_description=operation_model.documentation,
example_prefix='response = client.%s' % py_operation_name,
include_signature=False
)
_api_call.__doc__ = docstring
return _api_call