robdiciuccio commented on a change in pull request #11704:
URL:
https://github.com/apache/incubator-superset/pull/11704#discussion_r525419029
##########
File path: superset/jinja_context.py
##########
@@ -15,22 +15,49 @@
# specific language governing permissions and limitations
# under the License.
"""Defines the templating context for SQL Lab"""
-import inspect
+import json
import re
-from typing import Any, cast, List, Optional, Tuple, TYPE_CHECKING
+from functools import partial
+from typing import Any, Callable, cast, Dict, List, Optional, Tuple,
TYPE_CHECKING
-from flask import g, request
+from flask import current_app, g, request
+from flask_babel import gettext as _
from jinja2.sandbox import SandboxedEnvironment
-from superset import jinja_base_context
-from superset.extensions import feature_flag_manager, jinja_context_manager
-from superset.utils.core import convert_legacy_filters_into_adhoc,
merge_extra_filters
+from superset.exceptions import SupersetTemplateException
+from superset.extensions import feature_flag_manager
+from superset.utils.core import (
+ convert_legacy_filters_into_adhoc,
+ memoized,
+ merge_extra_filters,
+)
if TYPE_CHECKING:
from superset.connectors.sqla.models import SqlaTable
from superset.models.core import Database
from superset.models.sql_lab import Query
+NONE_TYPE = type(None).__name__
+ALLOWED_TYPES = (
+ NONE_TYPE,
+ "bool",
+ "str",
+ "unicode",
+ "int",
+ "long",
+ "float",
+ "list",
+ "dict",
+ "tuple",
+ "set",
+)
+COLLECTION_TYPES = ("list", "dict", "tuple", "set")
+
+
+@memoized
Review comment:
The value doesn't change over time, so just trying to save some
processing cycles. Probably not much gain here, but attempting not to repeat
initialization logic.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]