11"""
2- flask_caching
3- ~~~~~~~~~~~~~
2+ flask_caching
3+ ~~~~~~~~~~~~~
44
5- Adds cache support to your application.
5+ Adds cache support to your application.
66
7- :copyright: (c) 2010 by Thadeus Burgess.
8- :license: BSD, see LICENSE for more details.
7+ :copyright: (c) 2010 by Thadeus Burgess.
8+ :license: BSD, see LICENSE for more details.
99"""
1010
1111import base64
1616import uuid
1717import warnings
1818from collections import OrderedDict
19+ from collections .abc import Callable
1920from typing import Any
20- from typing import Callable
2121from typing import Dict
2222from typing import List
2323from typing import Optional
@@ -137,7 +137,8 @@ def init_app(self, app: Flask, config=None) -> None:
137137 self .source_check = config ["CACHE_SOURCE_CHECK" ]
138138
139139 if self .with_jinja2_ext :
140- from .jinja2ext import CacheExtension , JINJA_CACHE_ATTR_NAME
140+ from .jinja2ext import CacheExtension
141+ from .jinja2ext import JINJA_CACHE_ATTR_NAME
141142
142143 setattr (app .jinja_env , JINJA_CACHE_ATTR_NAME , self )
143144 app .jinja_env .add_extension (CacheExtension )
@@ -210,7 +211,7 @@ def delete(self, *args, **kwargs) -> bool:
210211 """Proxy function for internal cache object."""
211212 return self .cache .delete (* args , ** kwargs )
212213
213- def delete_many (self , * args , ** kwargs ) -> List [str ]:
214+ def delete_many (self , * args , ** kwargs ) -> list [str ]:
214215 """Proxy function for internal cache object."""
215216 return self .cache .delete_many (* args , ** kwargs )
216217
@@ -222,15 +223,15 @@ def get_many(self, *args, **kwargs):
222223 """Proxy function for internal cache object."""
223224 return self .cache .get_many (* args , ** kwargs )
224225
225- def set_many (self , * args , ** kwargs ) -> List [Any ]:
226+ def set_many (self , * args , ** kwargs ) -> list [Any ]:
226227 """Proxy function for internal cache object."""
227228 return self .cache .set_many (* args , ** kwargs )
228229
229- def get_dict (self , * args , ** kwargs ) -> Dict [str , Any ]:
230+ def get_dict (self , * args , ** kwargs ) -> dict [str , Any ]:
230231 """Proxy function for internal cache object."""
231232 return self .cache .get_dict (* args , ** kwargs )
232233
233- def unlink (self , * args , ** kwargs ) -> List [str ]:
234+ def unlink (self , * args , ** kwargs ) -> list [str ]:
234235 """Proxy function for internal cache object
235236 only support Redis
236237 """
@@ -449,7 +450,7 @@ def default_make_cache_key(*args, **kwargs):
449450 # (the way `url_for` expects them)
450451 argspec_args = inspect .getfullargspec (f ).args
451452
452- for arg_name , arg in zip (argspec_args , args ):
453+ for arg_name , arg in zip (argspec_args , args , strict = False ):
453454 kwargs [arg_name ] = arg
454455
455456 use_request = kwargs .pop ("use_request" , False )
@@ -543,7 +544,7 @@ def _memoize_version(
543544 timeout : Optional [int ] = None ,
544545 forced_update : Optional [Union [bool , Callable ]] = False ,
545546 args_to_ignore : Optional [Any ] = None ,
546- ) -> Union [Tuple [str , str ], Tuple [str , None ]]:
547+ ) -> Union [tuple [str , str ], tuple [str , None ]]:
547548 """Updates the hash version associated with a memoized function or
548549 method.
549550 """
@@ -597,7 +598,7 @@ def _memoize_version(
597598
598599 if dirty :
599600 self .cache .set_many (
600- dict (zip (fetch_keys , version_data_list )), timeout = timeout
601+ dict (zip (fetch_keys , version_data_list , strict = False )), timeout = timeout
601602 )
602603
603604 return fname , "" .join (version_data_list )
0 commit comments