本文整理汇总了Python中botocore.compat.six.callable方法的典型用法代码示例。如果您正苦于以下问题:Python six.callable方法的具体用法?Python six.callable怎么用?Python six.callable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类botocore.compat.six
的用法示例。
在下文中一共展示了six.callable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _verify_is_callable
# 需要导入模块: from botocore.compat import six [as 别名]
# 或者: from botocore.compat.six import callable [as 别名]
def _verify_is_callable(self, func):
if not six.callable(func):
raise ValueError("Event handler %s must be callable." % func)
示例2: _verify_accept_kwargs
# 需要导入模块: from botocore.compat import six [as 别名]
# 或者: from botocore.compat.six import callable [as 别名]
def _verify_accept_kwargs(self, func):
"""Verifies a callable accepts kwargs
:type func: callable
:param func: A callable object.
:returns: True, if ``func`` accepts kwargs, otherwise False.
"""
try:
if not accepts_kwargs(func):
raise ValueError("Event handler %s must accept keyword "
"arguments (**kwargs)" % func)
except TypeError:
return False
示例3: _validate_subscriber_methods
# 需要导入模块: from botocore.compat import six [as 别名]
# 或者: from botocore.compat.six import callable [as 别名]
def _validate_subscriber_methods(cls):
for subscriber_type in cls.VALID_SUBSCRIBER_TYPES:
subscriber_method = getattr(cls, 'on_' + subscriber_type)
if not six.callable(subscriber_method):
raise InvalidSubscriberMethodError(
'Subscriber method %s must be callable.' %
subscriber_method)
if not accepts_kwargs(subscriber_method):
raise InvalidSubscriberMethodError(
'Subscriber method %s must accept keyword '
'arguments (**kwargs)' % subscriber_method)