
VS Code shows "Inheriting 'Base', which is not a class" as an error message given the below:
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Integer , String , Column
Base = declarative_base()
class Socio(Base):
__tablename__ = 'socios'
id = Column(Integer, autoincrement = True , primary_key = True)
dni = Column(Integer , unique = True)
nombre = Column(String(250))
apellido= Column(String(250))
Why does this happen? How can I fix it?
Inheriting 'Base', which is not a class is not actually an error.Rather, it's a static analysis result coming from Microsoft's Python language server (which in turn leans heavily on pylint) for this kind of analysis. It's not always accurate: If a class is dynamically generated and returned by a function (as is the case here), the static-checking tools may not properly understand its type.
As described in microsoft/python-language-server#1390, this feature can be disabled with the following settings change:
"python.analysis.disabled": [
"inherit-non-class"
],
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With