Skip to content

Commit 0866d03

Browse files
committed
fix mypy errors
1 parent 5df828b commit 0866d03

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

bigframes/formatting_helpers.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,14 @@ def progress_callback(
105105
"""Displays a progress bar while the query is running"""
106106
global current_display, current_display_id, previous_display_html
107107

108-
import bigframes._config
109-
import bigframes.core.events
108+
try:
109+
import bigframes._config
110+
import bigframes.core.events
111+
except ImportError:
112+
# Since this gets called from __del__, skip if the import fails to avoid
113+
# ImportError: sys.meta_path is None, Python is likely shutting down.
114+
# This will allow cleanup to continue.
115+
return
110116

111117
progress_bar = bigframes._config.options.display.progress_bar
112118

tests/system/small/test_session_as_bpd.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,9 @@ def test_to_datetime(session: bigframes.session.Session):
140140

141141
def test_to_timedelta(session: bigframes.session.Session):
142142
offsets = np.arange(5)
143-
unit = "s"
144143

145-
bpd_result = bpd.to_timedelta(offsets, unit=unit)
146-
session_result = session.to_timedelta(offsets, unit=unit)
144+
bpd_result = bpd.to_timedelta(offsets, unit="s")
145+
session_result = session.to_timedelta(offsets, unit="s")
147146

148147
global_session = bpd.get_global_session()
149148
assert global_session is not session

0 commit comments

Comments
 (0)