1

We have pylint hooked up with our Django build, and one of the high priority errors we're getting

"Instance of 'unicode' has no 'state' member"

I've set the generated-members variable on variables that are truly generated (i.e. X_id and Y_set) so that it ignores unresolved references to those, but in this case, it's throwing the flag on this line:

if y.state not in [Y.X.RUNNING, Y.X.PAUSED, Y.X.LOADING]:

The only reference to y previously is a get which retrieves the object from the database, and then a later method which updates y but also returns a Y instance. Now, RUNNING/PAUSED/LOADING are unicode string enums that, but I don't see why that would make pylint infer that y is a unicode type...

Is this actually hiding a bug, and I'm simply not seeing it, or is there something I need to tell pylint about the inferred typing (y is a model and state is a CharField, so it does get operated on like a string)?

DivineWolfwood
  • 1,752
  • 12
  • 20

0 Answers0