Skip to content

Commit acb505f

Browse files
committed
fix(logging): update type hints in GunicornAccessFormatter for better clarity
1 parent bb8c14a commit acb505f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

uvicorn/logging.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def format(self, record: logging.LogRecord) -> str:
189189
import binascii
190190
import os
191191
import re
192-
from typing import Any, cast
192+
from typing import Any, Optional, cast
193193

194194
recordcopy = copy(record)
195195

@@ -198,8 +198,8 @@ def format(self, record: logging.LogRecord) -> str:
198198
args_tuple = cast(tuple[Any, ...], recordcopy.args)
199199
scope = cast(dict[str, Any], args_tuple[0])
200200
status_code = cast(int, args_tuple[1])
201-
response_time = cast(float | None, args_tuple[2])
202-
response_length = cast(int | None, args_tuple[3])
201+
response_time = cast(Optional[float], args_tuple[2])
202+
response_length = cast(Optional[int], args_tuple[3])
203203

204204
method = cast(str, scope.get("method", ""))
205205
path = cast(str, scope.get("path", ""))

0 commit comments

Comments
 (0)