From 32acafa5e08784775db88ec1c498178a461f5c45 Mon Sep 17 00:00:00 2001 From: Martijn Pieters Date: Thu, 27 Apr 2023 16:11:59 +0100 Subject: [PATCH] Correct type hint: namespace is not optional The namespace argument is positional and will never be `None` so should not be marked as Optional. It is always a string, and the default is to pass in an empty string. --- README.md | 2 +- fastapi_cache/key_builder.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4f0b31d..ce038b0 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ take effect globally. ```python def my_key_builder( func, - namespace: Optional[str] = "", + namespace: str = "", request: Request = None, response: Response = None, *args, diff --git a/fastapi_cache/key_builder.py b/fastapi_cache/key_builder.py index 852e632..a43317c 100644 --- a/fastapi_cache/key_builder.py +++ b/fastapi_cache/key_builder.py @@ -7,7 +7,7 @@ from starlette.responses import Response def default_key_builder( func: Callable, - namespace: Optional[str] = "", + namespace: str = "", request: Optional[Request] = None, response: Optional[Response] = None, args: Optional[tuple] = None,