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

B027 false-positive on @overloaded methods #304

Closed
jwodder opened this issue Oct 25, 2022 · 1 comment · Fixed by #306 or #309
Closed

B027 false-positive on @overloaded methods #304

jwodder opened this issue Oct 25, 2022 · 1 comment · Fixed by #306 or #309

Comments

@jwodder
Copy link

jwodder commented Oct 25, 2022

Running flake8 on the following code with flake8-bugbear 22.10.25:

import abc
from typing import IO, Literal, overload

class Opener(abc.ABC):
    @overload
    def open(self, mode: Literal["r"] = "r") -> IO[str]:
        ...

    @overload
    def open(self, mode: Literal["rb"] = "rb") -> IO[bytes]:
        ...

    @abc.abstractmethod
    def open(self, mode: Literal["r", "rb"] = "r") -> IO:
        ...

results in reports of B027 violations for the @overload-decorated open() methods, which is wrong.

@jakkdl
Copy link
Contributor

jakkdl commented Oct 26, 2022

Yeah @overload should definitely be ignored as well. @Zac-HD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants