Skip to content

Commit a2db2b5

Browse files
committed
Add assignment expressions
1 parent 999af4b commit a2db2b5

3 files changed

Lines changed: 3 additions & 8 deletions

File tree

debug_toolbar/panels/headers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ class HeadersPanel(Panel):
99
template = "panels/headers.html"
1010

1111
async def generate_stats(self, request: Request, response: Response) -> Stats:
12-
request_headers = dict(request.headers)
13-
14-
if "cookie" in request_headers:
12+
if "cookie" in (request_headers := dict(request.headers)):
1513
request_headers["cookie"] = "=> see Request panel"
1614

1715
return {

debug_toolbar/panels/redirects.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ async def process_request(self, request: Request) -> Response:
1515
response = await super().process_request(request)
1616

1717
if 300 <= response.status_code < 400:
18-
redirect_to = response.headers.get("Location")
19-
20-
if redirect_to:
18+
if redirect_to := response.headers.get("Location"):
2119

2220
async def content() -> t.AsyncGenerator[str, None]:
2321
yield self.render(

debug_toolbar/panels/sql.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
class BoldKeywordFilter:
2525
def process(self, stream: Stream) -> Stream:
2626
for token_type, value in stream:
27-
is_keyword = token_type in T.Keyword
28-
if is_keyword:
27+
if is_keyword := token_type in T.Keyword:
2928
yield T.Text, "<strong>"
3029
yield token_type, html.escape(value)
3130
if is_keyword:

0 commit comments

Comments
 (0)