本文介绍了禁用Pylint no成员-特定库的E1101错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于从特定库中创建的对象,是否仍要隐藏E1101错误?我们的大型存储库周围遍布熊猫创建的各种对象的#pylint: disable=E1101.

Is there anyway to hide E1101 errors for objects that are created from a specific library? Our large repository is littered with #pylint: disable=E1101 around various objects created by pandas.

例如,pylint将在以下代码上引发no成员错误:

For example, pylint will throw a no member error on the following code:

import pandas.io.data
import pandas as pd
spy = pandas.io.data.DataReader("SPY", "yahoo")
spy.to_csv("test.csv")
spy = pd.read_csv("test.csv")
close_px = spy.ix["2012":]

将出现以下错误:

E:  6,11: Instance of 'tuple' has no 'ix' member (no-member)
E:  6,11: Instance of 'TextFileReader' has no 'ix' member (no-member)

推荐答案

您可以使用generated-members选项将其属性标记为动态生成.

You can mark their attributes as dynamically generated using generated-members option.

例如大熊猫:

generated-members=pandas.*

这篇关于禁用Pylint no成员-特定库的E1101错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-12 00:30