Skip to content

Commit b09b5e3

Browse files
committed
Fix optional Foursquare section when disabled
1 parent 3a8e0e2 commit b09b5e3

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

examples/widget_demo.marimo.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,13 @@ def _(fsq_enabled, fsq_preagg_url, http_error_cls, mo, url_error_cls, urllib_req
228228

229229
@app.cell
230230
def _(datetime_cls, fsq_enabled, mo, target_path):
231-
if target_path.exists():
232-
_size_mb = target_path.stat().st_size / 1_000_000
233-
_updated = datetime_cls.fromtimestamp(target_path.stat().st_mtime).strftime("%Y-%m-%d %H:%M:%S")
234-
mo.md(f"Pre-agg DB status: local file found ({_size_mb:.1f} MB, mtime {_updated})")
235-
else:
236-
mo.md("Pre-agg DB status: local file not found")
231+
if fsq_enabled and target_path is not None:
232+
if target_path.exists():
233+
_size_mb = target_path.stat().st_size / 1_000_000
234+
_updated = datetime_cls.fromtimestamp(target_path.stat().st_mtime).strftime("%Y-%m-%d %H:%M:%S")
235+
mo.md(f"Pre-agg DB status: local file found ({_size_mb:.1f} MB, mtime {_updated})")
236+
else:
237+
mo.md("Pre-agg DB status: local file not found")
237238
return
238239

239240

@@ -306,12 +307,13 @@ def _(
306307
@app.cell
307308
def _(fsq_enabled, fsq_preagg_url, mo, target_path):
308309
fsq_source = None
309-
if target_path.exists():
310-
mo.md(f"Using local pre-agg DB: `{target_path}`")
311-
fsq_source = str(target_path)
312-
else:
313-
mo.md(f"Using remote pre-agg DB: `{fsq_preagg_url}`")
314-
fsq_source = fsq_preagg_url
310+
if fsq_enabled and target_path is not None:
311+
if target_path.exists():
312+
mo.md(f"Using local pre-agg DB: `{target_path}`")
313+
fsq_source = str(target_path)
314+
else:
315+
mo.md(f"Using remote pre-agg DB: `{fsq_preagg_url}`")
316+
fsq_source = fsq_preagg_url
315317
return (fsq_source,)
316318

317319

0 commit comments

Comments
 (0)