Skip to content

Ellipsis in Protocol methods not recognized in 'assignment-from-no-return' on methods of dataclass members #9080

Open
@DanielRosenwasser

Description

@DanielRosenwasser

Bug description

from dataclasses import dataclass
from typing import Protocol

class Blah(Protocol):
    def do_thing(self) -> str:
        ...

@dataclass
class BlahUser:
    blah: Blah
    def do_thing_with_blah(self):
        value = self.blah.do_thing()
        return value

Pylint's assignment-from-no-return rule issues the following error

Assigning result of a function call, where the function has no return

But Blah is a protocol, there's no expectation it should return.

I can raise in the body of Blah instead. Not using dataclass is another alternative.

Configuration

No response

Command used

I received this error through the Pylint VS Code extension

Pylint output

Assigning result of a function call, where the function has no return

Expected behavior

I would expect no error.

Pylint version

v2023.7.12711014

OS / Environment

Ubuntu Linux

Additional dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    False Positive 🦟A message is emitted but nothing is wrong with the codetyping

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions