Skip to content

Commit b42d0ad

Browse files
committed
Fixed types
1 parent 1675af1 commit b42d0ad

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

debug_toolbar/panels/logging.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,27 @@ def __init__(self) -> None:
2424
)
2525
self.collections: t.Dict[int, t.List[t.Dict[str, t.Any]]] = {}
2626

27-
def get_collection(self, thread_id: int = None) -> t.List[t.Dict[str, t.Any]]:
27+
def get_collection(
28+
self,
29+
thread_id: t.Optional[int] = None,
30+
) -> t.List[t.Dict[str, t.Any]]:
2831
if thread_id is None:
2932
thread_id = threading.get_ident()
3033
if thread_id not in self.collections:
3134
self.collections[thread_id] = []
3235
return self.collections[thread_id]
3336

34-
def clear_collection(self, thread_id: int = None) -> None:
37+
def clear_collection(self, thread_id: t.Optional[int] = None) -> None:
3538
if thread_id is None:
3639
thread_id = threading.get_ident()
3740
if thread_id in self.collections:
3841
del self.collections[thread_id]
3942

40-
def collect(self, item: t.Dict[str, t.Any], thread_id: int = None) -> None:
43+
def collect(
44+
self,
45+
item: t.Dict[str, t.Any],
46+
thread_id: t.Optional[int] = None,
47+
) -> None:
4148
self.get_collection(thread_id).append(item)
4249

4350

tests/testclient.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import typing as t
33
from urllib import parse
44

5-
import requests
5+
import httpx
66
from fastapi import status
77
from fastapi.testclient import TestClient as BaseTestClient
88

@@ -11,7 +11,12 @@
1111

1212

1313
class TestClient(BaseTestClient):
14-
def get_store_id(self, path: str, method: str = None, **kwargs: t.Any) -> str:
14+
def get_store_id(
15+
self,
16+
path: str,
17+
method: t.Optional[str] = None,
18+
**kwargs: t.Any,
19+
) -> str:
1520
response = getattr(self, (method or "get"))(path, **kwargs)
1621

1722
if response.headers["content-type"].startswith("text/html"):
@@ -20,7 +25,7 @@ def get_store_id(self, path: str, method: str = None, **kwargs: t.Any) -> str:
2025
cookie = parse.unquote(response.headers["set-cookie"])
2126
return re.findall(r'"storeId": "(.+?)"', cookie)[0]
2227

23-
def render_panel(self, store_id: str, panel_id: str) -> requests.Response:
28+
def render_panel(self, store_id: str, panel_id: str) -> httpx.Response:
2429
url = self.app.url_path_for("debug_toolbar.render_panel") # type: ignore
2530
return self.get(url, params={"store_id": store_id, "panel_id": panel_id})
2631

0 commit comments

Comments
 (0)