Specific class for generated-members in pylint?

怎甘沉沦 提交于 2020-01-13 03:49:01

问题


I'm slightly unsure of how the generated-members of pylint works.

Lets say I add the following to .pylintrc:

[TYPECHECK]
generated-members=commit

It hides the following commit error:

E1101:Instance of 'scoped_session' has no 'commit' member

However, this hides commit errors in general, from what I understand. Can I somehow specify the exact class member with generated-members? For example (pseudo):

[TYPECHECK]
generated-members=sqlalchemy.orm.scoped_session.commit

回答1:


I had the same problem. The code

db.session.add(item)
db.session.commit()

causes pylint errors:

[pylint] E1101:Instance of 'scoped_session' has no 'add' member
[pylint] E1101:Instance of 'scoped_session' has no 'commit' member

I added the following string in pylintrc

generated-members=db.session.*

and errors disappear.



来源:https://stackoverflow.com/questions/51168479/specific-class-for-generated-members-in-pylint

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!