Skip to content

Abstract base class defined separately to concrete implementation: pylint complains method args are unused #9441

Open
@jmcp

Description

@jmcp

Question

I've been asked to work on an internal library, which has lots of ABCs defined in separate files to their implementations / concrete class.

I've come across several situations where the concrete class' implementation methods don't use all of the parameters defined in the @abstractmethod of the class - because pylint complained:

core.py:24:0: E0402: Attempted relative import beyond top-level package (relative-beyond-top-level)
core.py:233:47: W0613: Unused argument 'dataset' (unused-argument)

The relative import is for the ABC definition, which has this method definition:

    @abstractmethod
    def db_check_table_exist(self, table: str, dataset: str = "", project_id: str = "") -> bool:
        """Check if table exists in database."""
....

whereas the concrete class has this:

    def db_check_table_exist(self, table: str, dataset: str = "", project_id: str = "") -> bool:
        """Check if table exists in database."""
...

and doesn't use either the dataset or project_id parameters

Does pylint recognise and accept concrete class implementations where method signatures match the ABC definition?

Should I use a disable override for the concrete class' method?

Thankyou in advance

Documentation for future user

I thought I'd be able to find a hint in https://pylint.readthedocs.io/en/stable/user_guide/messages/messages_overview.html#refactor-category (specifically, but any category really) but wasn't able to figure it out.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions