refactor(utils): replace strtobool with parse_boolean_string (#14494)
This commit is contained in:
parent
68058b0ad9
commit
4ac90ddaee
|
|
@ -29,7 +29,6 @@ import re
|
|||
import sys
|
||||
from collections import OrderedDict
|
||||
from datetime import date
|
||||
from distutils.util import strtobool
|
||||
from typing import Any, Callable, Dict, List, Optional, Type, TYPE_CHECKING, Union
|
||||
|
||||
from cachelib.base import BaseCache
|
||||
|
|
@ -44,7 +43,7 @@ from superset.jinja_context import ( # pylint: disable=unused-import
|
|||
)
|
||||
from superset.stats_logger import DummyStatsLogger
|
||||
from superset.typing import CacheConfig
|
||||
from superset.utils.core import is_test
|
||||
from superset.utils.core import is_test, parse_boolean_string
|
||||
from superset.utils.encrypt import SQLAlchemyUtilsAdapter
|
||||
from superset.utils.log import DBEventLogger
|
||||
from superset.utils.logging_configurator import DefaultLoggingConfigurator
|
||||
|
|
@ -388,7 +387,7 @@ DEFAULT_FEATURE_FLAGS: Dict[str, bool] = {
|
|||
# Feature flags may also be set via 'SUPERSET_FEATURE_' prefixed environment vars.
|
||||
DEFAULT_FEATURE_FLAGS.update(
|
||||
{
|
||||
k[len("SUPERSET_FEATURE_") :]: bool(strtobool(v))
|
||||
k[len("SUPERSET_FEATURE_") :]: parse_boolean_string(v)
|
||||
for k, v in os.environ.items()
|
||||
if re.search(r"^SUPERSET_FEATURE_\w+", k)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
import json
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from distutils.util import strtobool
|
||||
from io import BytesIO
|
||||
from typing import Any
|
||||
from zipfile import is_zipfile, ZipFile
|
||||
|
|
@ -62,6 +61,7 @@ from superset.datasets.schemas import (
|
|||
get_delete_ids_schema,
|
||||
get_export_ids_schema,
|
||||
)
|
||||
from superset.utils.core import parse_boolean_string
|
||||
from superset.views.base import DatasourceFilter, generate_download_headers
|
||||
from superset.views.base_api import (
|
||||
BaseSupersetModelRestApi,
|
||||
|
|
@ -302,7 +302,7 @@ class DatasetRestApi(BaseSupersetModelRestApi):
|
|||
$ref: '#/components/responses/500'
|
||||
"""
|
||||
override_columns = (
|
||||
bool(strtobool(request.args["override_columns"]))
|
||||
parse_boolean_string(request.args["override_columns"])
|
||||
if "override_columns" in request.args
|
||||
else False
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue