Skip to content

UP047 Fails to indentify functions that have Callable in their signature #19863

@Kroppeb

Description

@Kroppeb

Summary

I noticed something weird with UP047, foo triggers a warning while foo2 does not.

from collections.abc import Callable
from typing import TypeVar

T = TypeVar("T")


def foo(t: list[T]) -> T:
    return t[0]


def foo2(t: list[T], c: Callable[[T], None]) -> T:
    c(t[0])
    return t[1]

Playground: https://play.ruff.rs/cd7af9a8-0532-40fe-83c7-4282a658808c

Version

v0.12.7

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingruleImplementing or modifying a lint rule

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions