mirror of https://github.com/apache/superset.git
style(mypy): Fix memoize watch type (#9970)
Co-authored-by: John Bodley <john.bodley@airbnb.com>
This commit is contained in:
parent
fc92692f49
commit
15f267d586
|
@ -281,7 +281,7 @@ class Database(
|
|||
effective_username = g.user.username
|
||||
return effective_username
|
||||
|
||||
@utils.memoized(watch=["impersonate_user", "sqlalchemy_uri_decrypted", "extra"])
|
||||
@utils.memoized(watch=("impersonate_user", "sqlalchemy_uri_decrypted", "extra"))
|
||||
def get_sqla_engine(
|
||||
self,
|
||||
schema: Optional[str] = None,
|
||||
|
|
|
@ -147,11 +147,11 @@ class _memoized:
|
|||
should account for instance variable changes.
|
||||
"""
|
||||
|
||||
def __init__(self, func: Callable, watch: Optional[List[str]] = None) -> None:
|
||||
def __init__(self, func: Callable, watch: Optional[Tuple[str, ...]] = None) -> None:
|
||||
self.func = func
|
||||
self.cache: Dict[Any, Any] = {}
|
||||
self.is_method = False
|
||||
self.watch = watch or []
|
||||
self.watch = watch or ()
|
||||
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any:
|
||||
key = [args, frozenset(kwargs.items())]
|
||||
|
@ -181,7 +181,7 @@ class _memoized:
|
|||
|
||||
|
||||
def memoized(
|
||||
func: Optional[Callable] = None, watch: Optional[List[str]] = None
|
||||
func: Optional[Callable] = None, watch: Optional[Tuple[str, ...]] = None
|
||||
) -> Callable:
|
||||
if func:
|
||||
return _memoized(func)
|
||||
|
|
Loading…
Reference in New Issue