Skip to content

Commit e036919

Browse files
chore: remove unused functions in utils/core (apache#25912)
1 parent 784a478 commit e036919

File tree

1 file changed

+1
-37
lines changed

1 file changed

+1
-37
lines changed

superset/utils/core.py

+1-37
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
import sqlalchemy as sa
6161
from cryptography.hazmat.backends import default_backend
6262
from cryptography.x509 import Certificate, load_pem_x509_certificate
63-
from flask import current_app, flash, g, Markup, request
63+
from flask import current_app, g, Markup, request
6464
from flask_appbuilder import SQLA
6565
from flask_appbuilder.security.sqla.models import User
6666
from flask_babel import gettext as __
@@ -354,17 +354,6 @@ class ColumnSpec(NamedTuple):
354354
python_date_format: str | None = None
355355

356356

357-
def flasher(msg: str, severity: str = "message") -> None:
358-
"""Flask's flash if available, logging call if not"""
359-
try:
360-
flash(msg, severity)
361-
except RuntimeError:
362-
if severity == "danger":
363-
logger.error(msg, exc_info=True)
364-
else:
365-
logger.info(msg)
366-
367-
368357
def parse_js_uri_path_item(
369358
item: str | None, unquote: bool = True, eval_undefined: bool = False
370359
) -> str | None:
@@ -448,15 +437,6 @@ def cast_to_boolean(value: Any) -> bool | None:
448437
return False
449438

450439

451-
def list_minus(l: list[Any], minus: list[Any]) -> list[Any]:
452-
"""Returns l without what is in minus
453-
454-
>>> list_minus([1, 2, 3], [2])
455-
[1, 3]
456-
"""
457-
return [o for o in l if o not in minus]
458-
459-
460440
class DashboardEncoder(json.JSONEncoder):
461441
def __init__(self, *args: Any, **kwargs: Any) -> None:
462442
super().__init__(*args, **kwargs)
@@ -995,13 +975,6 @@ def get_email_address_list(address_string: str) -> list[str]:
995975
return [x.strip() for x in address_string_list if x.strip()]
996976

997977

998-
def get_email_address_str(address_string: str) -> str:
999-
address_list = get_email_address_list(address_string)
1000-
address_list_str = ", ".join(address_list)
1001-
1002-
return address_list_str
1003-
1004-
1005978
def choicify(values: Iterable[Any]) -> list[tuple[Any, Any]]:
1006979
"""Takes an iterable and makes an iterable of tuples with it"""
1007980
return [(v, v) for v in values]
@@ -1701,15 +1674,6 @@ def extract_column_dtype(col: BaseColumn) -> GenericDataType:
17011674
return GenericDataType.STRING
17021675

17031676

1704-
def indexed(items: list[Any], key: str | Callable[[Any], Any]) -> dict[Any, list[Any]]:
1705-
"""Build an index for a list of objects"""
1706-
idx: dict[Any, Any] = {}
1707-
for item in items:
1708-
key_ = getattr(item, key) if isinstance(key, str) else key(item)
1709-
idx.setdefault(key_, []).append(item)
1710-
return idx
1711-
1712-
17131677
def is_test() -> bool:
17141678
return parse_boolean_string(os.environ.get("SUPERSET_TESTENV", "false"))
17151679

0 commit comments

Comments
 (0)