getsentry / responses

A utility for mocking out the Python Requests library.
Apache License 2.0
4.08k stars 347 forks source link

[0.24.0 regression] `@overload`s of `responses.activate` need to be restored too #692

Closed andersk closed 7 months ago

andersk commented 7 months ago

Describe the bug

684 incorrectly removed the @overload declarations for CallList.__getitem__ and responses.activate. The former was restored in #690, but the latter needs to be restored too, as shown by the example below.

Additional context

No response

Version of responses

0.24.0

Steps to Reproduce

Run mypy on this code:

import responses

class C:
    @responses.activate
    def f(self) -> str:
        return "hello"

    def g(self) -> None:
        greeting: str = self.f()

Expected Result

Success: no issues found in 1 source file

Actual Result

test.py:10: error: Too few arguments  [call-arg]
test.py:10: error: Incompatible types in assignment (expression has type "Callable[..., Any] | Any", variable has type "str")  [assignment]
Found 2 errors in 1 file (checked 1 source file)