在我的代码中,我使用来自已编译扩展的对象(在我的例子中是igraph)。我使用 PyLint 来分析代码。PyLint 抱怨缺少属性(例如 igraph's Graph.adjacent
),而它显然存在(代码运行时没有错误)。出现此消息的原因可能是什么?
这是一些测试代码
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 中