Python PyLint错误地表示对象缺少某些属性

Python PyLint错误地表示对象缺少某些属性,python,code-analysis,pylint,Python,Code Analysis,Pylint,在我的代码中,我使用编译扩展中的对象(在我的例子中是)。我使用PyLint分析代码。PyLint抱怨缺少属性(例如igraph的Graph.nexting),而它显然存在(代码运行时没有错误)。产生此消息的原因可能是什么 下面是一些测试代码 import igraph gr = igraph.Graph(10)#create a graph with 10 vertices edges = gr.es #no pylint errors vertices = gr.vs #no pylint e

在我的代码中,我使用编译扩展中的对象(在我的例子中是)。我使用PyLint分析代码。PyLint抱怨缺少属性(例如igraph的
Graph.nexting
),而它显然存在(代码运行时没有错误)。产生此消息的原因可能是什么

下面是一些测试代码

import igraph
gr = igraph.Graph(10)#create a graph with 10 vertices
edges = gr.es #no pylint errors
vertices = gr.vs #no pylint errors
print gr.are_connected(0, 1) #pylint error E1101
print gr.adjacent(0) #pylint error E1101
这是pylint的输出:

************* Module temp
C0111:  1: Missing docstring
C0103:  2: Invalid name "gr" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
C0103:  3: Invalid name "edges" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
C0103:  4: Invalid name "vertices" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
E1101:  5: Instance of 'Graph' has no 'are_connected' member
E1101:  6: Instance of 'Graph' has no 'adjacent' member

PS:igraph在我的PYTHONPATH中是,如果它是一个已编译的C扩展,那么Pylint几乎无能为力,因为它无法分析源代码。你能打印IGRAPHE.Graph吗?你是否连接在一个交互式外壳中?如果不是,这意味着库可能在实例化时做了一些奇怪的事情,或者方法是内省的

无论如何,这对pylint来说都是一个棘手的问题


您可以使用上提供的补丁(最近包含在开发树中)或忽略带有内联指令的E1101

如果它是一个已编译的C扩展,Pylint几乎无能为力,因为它无法分析源代码。你能打印IGRAPHE.Graph吗?你是否连接在一个交互式外壳中?如果不是,这意味着库可能在实例化时做了一些奇怪的事情,或者方法是内省的

无论如何,这对pylint来说都是一个棘手的问题


您可以使用上提供的补丁(最近包含在开发树中)或忽略带有内联指令的E1101

@Dhaivat Pandya谢谢,在你的python路径上添加了exampleis igraph?我想你是指E1101(而不是我不知道的E11011)@Dhaivat Pandya谢谢,在你的python路径上添加了exampleis igraph?我想你是指E1101(而不是我不知道的E11011)