Skip to content

Commit 5e7ec69

Browse files
committed
fix typing
1 parent 1f458c7 commit 5e7ec69

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

dune_client/query.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,20 @@
77
import json
88
import urllib.parse
99
from dataclasses import dataclass
10-
from typing import Any, TypeAlias
10+
from typing import Any
1111

1212
from dune_client.types import QueryParameter
1313

14-
QueryParameterValue: TypeAlias = str | list[str]
15-
SerializedParameterValue: TypeAlias = QueryParameterValue | int
16-
QueryParameterPayload: TypeAlias = dict[str, QueryParameterValue]
17-
SerializedParameters: TypeAlias = dict[str, SerializedParameterValue]
18-
RequestPayload: TypeAlias = dict[str, str | QueryParameterPayload]
19-
2014

2115
def parse_query_object_or_id(
2216
query: QueryBase | str | int,
23-
) -> tuple[SerializedParameters | None, int]:
17+
) -> tuple[dict[str, str | list[str] | int] | None, int]:
2418
"""
2519
Users are allowed to pass QueryBase or ID into some functions.
2620
This method handles both scenarios, returning a pair of the form (params, query_id)
2721
"""
2822
if isinstance(query, QueryBase):
29-
params: SerializedParameters = {
23+
params: dict[str, str | list[str] | int] = {
3024
f"params.{p.key}": p.to_dict()["value"] for p in query.parameters()
3125
}
3226
return params, query.query_id
@@ -73,7 +67,7 @@ def __hash__(self) -> int:
7367
"""
7468
return self.url().__hash__()
7569

76-
def request_format(self) -> RequestPayload:
70+
def request_format(self) -> dict[str, str | dict[str, str | list[str]]]:
7771
"""Transforms Query objects to params to pass in API"""
7872
return {"query_parameters": {p.key: p.to_dict()["value"] for p in self.parameters()}}
7973

dune_client/types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
from __future__ import annotations
88

99
import re
10+
from collections.abc import Sequence
1011
from enum import Enum
11-
from typing import TYPE_CHECKING, Any, Sequence
12+
from typing import TYPE_CHECKING, Any
1213

1314
from dune_client.util import postgres_date
1415

0 commit comments

Comments
 (0)