microsoft / python-language-server

Microsoft Language Server for Python
Apache License 2.0
910 stars 130 forks source link

No support for metaclasses (SQLAlchemy's `declarative_base` marked as error) #1674

Open schlamar opened 4 years ago

schlamar commented 4 years ago

Environment data

Expected behaviour

No error for code snippet below.

Actual behaviour

Error Inheriting 'Base', which is not a class.

Code Snippet

from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()

class User(Base):
    __tablename__ = 'users'

    id = Column(Integer, primary_key=True)
    name = Column(String)
    fullname = Column(String)
    nickname = Column(String)

    def __repr__(self):
        return "<User(name='%s', fullname='%s', nickname='%s')>" % (
            self.name, self.fullname, self.nickname)
jakebailey commented 4 years ago

For now, you may disable inherit-non-class by following the instructions in https://github.com/microsoft/python-language-server#linting-options-diagnostics, or by using # noqa on the class line.