本文整理汇总了Python中pylint.checkers.utils.is_inside_abstract_class函数的典型用法代码示例。如果您正苦于以下问题:Python is_inside_abstract_class函数的具体用法?Python is_inside_abstract_class怎么用?Python is_inside_abstract_class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_inside_abstract_class函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: visit_subscript
def visit_subscript(self, node):
supported_protocol = None
if isinstance(node.value, (astroid.ListComp, astroid.DictComp)):
return
if node.ctx == astroid.Load:
supported_protocol = supports_getitem
msg = "unsubscriptable-object"
elif node.ctx == astroid.Store:
supported_protocol = supports_setitem
msg = "unsupported-assignment-operation"
elif node.ctx == astroid.Del:
supported_protocol = supports_delitem
msg = "unsupported-delete-operation"
if isinstance(node.value, astroid.SetComp):
self.add_message(msg, args=node.value.as_string(), node=node.value)
return
if is_inside_abstract_class(node):
return
inferred = safe_infer(node.value)
if inferred is None or inferred is astroid.YES:
return
if not supported_protocol(inferred):
self.add_message(msg, args=node.value.as_string(), node=node.value)
开发者ID:yannack,项目名称:pylint,代码行数:28,代码来源:typecheck.py
示例2: _check_membership_test
def _check_membership_test(self, node):
if is_inside_abstract_class(node):
return
if is_comprehension(node):
return
infered = safe_infer(node)
if infered is None or infered is astroid.YES:
return
if not supports_membership_test(infered):
self.add_message("unsupported-membership-test", args=node.as_string(), node=node)
开发者ID:yannack,项目名称:pylint,代码行数:10,代码来源:typecheck.py
示例3: _check_iterable
def _check_iterable(self, node):
if is_inside_abstract_class(node):
return
if is_comprehension(node):
return
infered = safe_infer(node)
if infered is None or infered is astroid.YES:
return
if not is_iterable(infered):
self.add_message("not-an-iterable", args=node.as_string(), node=node)
开发者ID:yannack,项目名称:pylint,代码行数:10,代码来源:typecheck.py
示例4: _check_mapping
def _check_mapping(self, node):
if is_inside_abstract_class(node):
return
if isinstance(node, astroid.DictComp):
return
infered = safe_infer(node)
if infered is None or infered is astroid.YES:
return
if not is_mapping(infered):
self.add_message("not-a-mapping", args=node.as_string(), node=node)
开发者ID:yannack,项目名称:pylint,代码行数:10,代码来源:typecheck.py
示例5: visit_subscript
def visit_subscript(self, node):
if isinstance(node.value, (astroid.ListComp, astroid.DictComp)):
return
if isinstance(node.value, astroid.SetComp):
self.add_message('unsubscriptable-object',
args=node.value.as_string(),
node=node.value)
return
infered = safe_infer(node.value)
if infered is None or infered is astroid.YES:
return
if is_inside_abstract_class(node):
return
if not supports_subscript(infered):
self.add_message('unsubscriptable-object',
args=node.value.as_string(),
node=node.value)
开发者ID:aRkadeFR,项目名称:dotVim,代码行数:20,代码来源:typecheck.py
注:本文中的pylint.checkers.utils.is_inside_abstract_class函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论