diff --git a/CHANGES.rst b/CHANGES.rst index 389ae9e7..4ed9497f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,8 +1,13 @@ Changelog ========= +Unreleased +---------- + +- fix type signature in ``flask_caching.utils.make_template_fragment_key``. :pr:`430` - Added docs and example for make_cache_key + Version 2.0.2 ------------- @@ -12,6 +17,7 @@ Released 2023-01-12 - migrate ``flask_caching.backends.RedisCluster`` dependency from redis-py-cluster to redis-py - bug fix: make the ``make_cache_key`` attributed of decorated view functions writeable. :pr:`431`, issue `#97` + Version 2.0.1 ------------- diff --git a/setup.cfg b/setup.cfg index afe6b815..65fd7aa3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -91,7 +91,7 @@ disallow_subclassing_any = true # disallow_incomplete_defs = true # check_untyped_defs = true disallow_untyped_decorators = true -# no_implicit_optional = true +no_implicit_optional = true warn_redundant_casts = true warn_unused_ignores = true # warn_return_any = true diff --git a/src/flask_caching/utils.py b/src/flask_caching/utils.py index d499098c..b853a8b6 100644 --- a/src/flask_caching/utils.py +++ b/src/flask_caching/utils.py @@ -2,6 +2,7 @@ import string from typing import Callable from typing import List +from typing import Optional TEMPLATE_FRAGMENT_KEY_TEMPLATE = "_template_fragment_cache_%s%s" # Used to remove control characters and whitespace from cache keys. @@ -102,7 +103,9 @@ def function_namespace(f, args=None): return ns, ins -def make_template_fragment_key(fragment_name: str, vary_on: List[str] = None) -> str: +def make_template_fragment_key( + fragment_name: str, vary_on: Optional[List[str]] = None +) -> str: """Make a cache key for a specific fragment name.""" if vary_on: fragment_name = "%s_" % fragment_name