Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive: duplicate-bases when using advanced-alchemy repository classes #9874

Open
ubernostrum opened this issue Aug 15, 2024 · 0 comments
Labels
Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling

Comments

@ubernostrum
Copy link

Bug description

# pylint: disable=missing-docstring,missing-class-docstring,too-few-public-methods

from advanced_alchemy.repository import SQLAlchemyAsyncRepository
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column


class Base(DeclarativeBase):
    pass


class ExampleModel(Base):
    __tablename__ = "example_model"

    id: Mapped[int] = mapped_column(primary_key=True)
    name: Mapped[str]


class ExampleModelRepository(SQLAlchemyAsyncRepository[ExampleModel]):
    model_type = ExampleModel

Configuration

No response

Command used

pylint example.py

Pylint output

************* Module example
example.py:18:0: E0241: Duplicate bases for class 'ExampleModelRepository' (duplicate-bases)

------------------------------------------------------------------
Your code has been rated at 5.00/10 (previous run: 0.00/10, +5.00)

Expected behavior

This should not output a duplicate-bases error; the code imports and runs just fine, which it wouldn't if Python actually thought it had duplicate bases.

I suspect this is a variation of #2717 but with the offending "duplicate base" this time being typing.Protocol (#9222 is another possible variant involving typing.TypedDict, but seems at first glance to be a weirder/more complex issue)

Pylint version

pylint 3.2.6
astroid 3.2.4
Python 3.12.0 (main, Nov  9 2023, 22:56:18) [Clang 15.0.0 (clang-1500.0.40.1)]

OS / Environment

macOS 13.6.7, also observed on a Debian 12 Docker container

Additional dependencies

advanced_alchemy==0.19.0
alembic==1.13.2
astroid==3.2.4
dill==0.3.8
greenlet==3.0.3
isort==5.13.2
Mako==1.3.5
MarkupSafe==2.1.5
mccabe==0.7.0
platformdirs==4.2.2
pylint==3.2.6
SQLAlchemy==2.0.32
tomlkit==0.13.2
typing_extensions==4.12.2
@ubernostrum ubernostrum added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling
Projects
None yet
Development

No branches or pull requests

1 participant