Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specific class for generated-members in pylint?

Tags:

python

pylint

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
like image 314
TragedyStruck Avatar asked Jul 04 '18 07:07

TragedyStruck


1 Answers

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.

like image 108
Peter Avatar answered Sep 30 '22 07:09

Peter