-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
not-callable
false positive for class
#8138
Comments
Thanks @emontnemery for the report. I can reproduce this using the example over in the sqlalchemy issue (copy/paste below). The example in the description doesn't run successfully as a Python script however. from sqlalchemy import func, select, Integer
from sqlalchemy.orm import mapped_column
from sqlalchemy.orm import DeclarativeBase
from sqlalchemy.sql.selectable import Select
class Base(DeclarativeBase):
pass
class MyTable(Base):
__tablename__ = "host_entry"
id = mapped_column(Integer, primary_key=True)
def state_attrs_exist(attr: int | None) -> Select:
"""Check if a state attributes id exists in the states table."""
return select(func.min(MyTable.id)).where(MyTable.id == attr) |
Sorry, I did not know that was a requirement. Should I edit the example? |
No worries! Its handy for us if the example is working code so that we can focus on only the reported false positive. If you have time to edit it then please feel free but otherwise the other example should be sufficient I think. |
Here is a working script. The last line produces an error message in pylint, but only if the sqlalchemy version is at least 2.0.
|
+1 |
bump |
In the Here is a modification of the original script which runs in python, but outputs the
If you modify the property definition to return something that is callable, then pylint does not output not-callable:
Removing the |
Bug description
Pylint complains about
func.myfunc
in the snippet below not being callable.A concrete use case is in sqlalchemy/sqlalchemy#9189
Configuration
No response
Command used
Pylint output
************* Module test4b test4b.py:19:0: E1102: func.myfunc is not callable (not-callable)
Expected behavior
Pylint should not complain about func.myfunc not being callable
Pylint version
OS / Environment
Ubuntu
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: