This is an automated email from the ASF dual-hosted git repository.
johnbodley pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 15f267d style(mypy): Fix memoize watch type (#9970)
15f267d is described below
commit 15f267d5861a75833821e15c65a998b122e15fd3
Author: John Bodley <[email protected]>
AuthorDate: Tue Jun 2 16:02:07 2020 -0700
style(mypy): Fix memoize watch type (#9970)
Co-authored-by: John Bodley <[email protected]>
---
superset/models/core.py | 2 +-
superset/utils/core.py | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/superset/models/core.py b/superset/models/core.py
index 69d306a..015abc2 100755
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -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,
diff --git a/superset/utils/core.py b/superset/utils/core.py
index de758dc..58a425f 100644
--- a/superset/utils/core.py
+++ b/superset/utils/core.py
@@ -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)