9

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
TragedyStruck
  • 586
  • 8
  • 24

1 Answers1

9

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.

Peter
  • 161
  • 2
  • 6
  • I was having this issue with db.Column and the various db column types. I added them specifically: db.Column, db.Integer, db.String, ... to generated-members and the errors went away – bjg222 Jan 30 '19 at 19:45