Open huntfx opened 3 years ago
@Peter92 thanks for the report. This bug is probably linked to #3334 and #1061.
Hey, I saw those two, they appear to be referencing a slightly different issue (specifically no-member
) so I didn't want to overcomplicate things by bundling multiple issues into one.
However, upon saying that, I noticed that after #1061 was closed, @chaoflow did mention the exact same thing I was talking about, but he appears to have mostly been ignored (understandable as I assume issues aren't checked again after being closed).
In case anyone else stumbled on this issue. The docs for SQLAlchemy 2.0 say to use the @classmethod
decorator to let typing tools know that cls
is expected as an argument, instead of self
. I don't know if older SQLAlchemy versions have issues with that decorator, but it worked fine here using SQLAlchemy 2.0.
I'm not sure if this would be within the scope of
pylint
features, but a similar question was looked at previously, so I may as well mention the problem.The
hybrid_property
of SQLAlchemy has anexpression
method, which acts like a classmethod in that it takescls
as an argument, notself
. Pylint doesn't like this, and comes up with theno-self-argument
warning. The documentation for it is here.Here's an example:
From a look at the source code, there doesn't seem to be an obvious way to detecting that though, so it may need to be more of a hardcoded feature if implemented.