Skip to content

Method overload stub gives "Method could be a function" #3439

Closed
@opk12

Description

@opk12
from typing import overload


class Cls:
    @overload
    def method(self, param: int) -> None:
        ...

    @overload
    def method(self, param: str) -> None:
        ...

    def method(self, param):
        print(self.__repr__, param)
test1.py:6: [R0201(no-self-use), Cls.method] Method could be a function
test1.py:10: [R0201(no-self-use), Cls.method] Method could be a function

This is on the preview release 2.4.4 pip install pylint astroid --pre -U

A quick search for "overload" doesn't result in duplicate issues.

pylint --version output

(venv) $  pylint --version
pylint 2.4.4
astroid 2.3.3
Python 3.7.6 (default, Jan 30 2020, 09:44:41) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions