mirror of
https://github.com/apache/superset.git
synced 2026-04-21 17:14:57 +00:00
chore: use contextlib.surpress instead of passing on error (#24896)
Co-authored-by: John Bodley <4567245+john-bodley@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
72150ebadf
commit
e585db85b6
@@ -15,6 +15,7 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import contextlib
|
||||
import re
|
||||
import threading
|
||||
from re import Pattern
|
||||
@@ -24,8 +25,7 @@ from flask_babel import gettext as __
|
||||
from sqlalchemy.engine.reflection import Inspector
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
# Need to try-catch here because pyocient may not be installed
|
||||
try:
|
||||
with contextlib.suppress(ImportError, RuntimeError): # pyocient may not be installed
|
||||
# Ensure pyocient inherits Superset's logging level
|
||||
import geojson
|
||||
import pyocient
|
||||
@@ -35,8 +35,6 @@ try:
|
||||
|
||||
superset_log_level = app.config["LOG_LEVEL"]
|
||||
pyocient.logger.setLevel(superset_log_level)
|
||||
except (ImportError, RuntimeError):
|
||||
pass
|
||||
|
||||
from superset.constants import TimeGrain
|
||||
from superset.db_engine_specs.base import BaseEngineSpec
|
||||
|
||||
Reference in New Issue
Block a user