Skip to content

Commit

Permalink
Fix typing to prevent generic from decaying to Any
Browse files Browse the repository at this point in the history
  • Loading branch information
dhirving committed Nov 14, 2024
1 parent 3eb4836 commit 3f9f1a6
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@
query_router = APIRouter()


class _StreamQueryDriverExecute(StreamingQuery):
class _QueryContext(NamedTuple):
driver: QueryDriver
tree: QueryTree


class _StreamQueryDriverExecute(StreamingQuery[_QueryContext]):
"""Wrapper to call `QueryDriver.execute` from async stream handler."""

def __init__(self, request: QueryExecuteRequestModel, factory: Factory) -> None:
Expand Down Expand Up @@ -94,7 +99,7 @@ class _QueryAllDatasetsContext(NamedTuple):
query: Query


class _StreamQueryAllDatasets(StreamingQuery):
class _StreamQueryAllDatasets(StreamingQuery[_QueryAllDatasetsContext]):
def __init__(self, request: QueryAllDatasetsRequestModel, factory: Factory) -> None:
self._request = request
self._factory = factory
Expand Down Expand Up @@ -199,8 +204,3 @@ def _get_query_context(factory: Factory, query: QueryInputs) -> Iterator[_QueryC
),

yield _QueryContext(driver=driver, tree=tree)


class _QueryContext(NamedTuple):
driver: QueryDriver
tree: QueryTree

0 comments on commit 3f9f1a6

Please sign in to comment.