Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable no_implicit_optional mypy check and fix issue #430

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -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
-------------

Expand All @@ -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
-------------

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/flask_caching/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
Loading