getsentry/responses

A little typing issue?

rafrafek opened this issue · 0 comments

Describe the bug

Hello,

I think the definition here:

class CallList(Sequence[Any], Sized):

could be:

class CallList(Sequence[Call], Sized):

I'm using the latest Pyright static type checker in strict mode and it gives me the error below:

error: Return type, "Generator[filter[Unknown], Any, None]", is partially unknown (reportUnknownParameterType)

for the code in Steps to Reproduce.

Additional context

See the discussion here: microsoft/pyright#8164

Version of responses

0.25.3

Steps to Reproduce

import pytest
import responses

@pytest.fixture
def req_mock():
    with responses.RequestsMock() as mock:
        yield mock

@pytest.fixture
def foo_request(req_mock: responses.RequestsMock):
    req_mock.add(responses.GET, url="https://foo.example.com/123")
    yield filter(
        lambda r: r.request.url.startswith("https://foo.example.com"), req_mock.calls
    )

Expected Result

Function foo_request returns Generator[filter[Call], Any, None].

Actual Result

Function foo_request returns Generator[filter[Unknown], Any, None].