jd / tenacity

Retrying library for Python
http://tenacity.readthedocs.io
Apache License 2.0
6.82k stars 283 forks source link

`before_log` doesn't accept LoggerAdapter - mypy #405

Open macieyng opened 1 year ago

macieyng commented 1 year ago

Description

mypy is complaining that error: Argument 1 to "before_log" has incompatible type "LoggerAdapter[Logger]"; expected "Logger" [arg-type]

by looking at the implementation

def before_log(logger: "logging.Logger", log_level: int) -> typing.Callable[["RetryCallState"], None]:

Looks like we need to create some type that implements logger interface and check against that rather than against arbitrary types or simply allow logger adapter.

I'm willing to work on this issue. lmk wdyt.

dwreeves commented 1 year ago

Do you have anything for this ready? / Do you intend to still work on this?

macieyng commented 1 year ago

I just wanted to express my readiness to work on this, but I was waiting for maintainers to approve or discuss the idea.