Skip to content

Commit 5172a43

Browse files
committed
Update the codemod to await st.write()
1 parent 3782652 commit 5172a43

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

packages/kernel/py/stlite-lib/stlite_lib/codemod.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,7 @@ def patch(code: str | ast.Module, script_path: str) -> ast.Module:
911911
wildcard_import_monitor_targets = set(
912912
[
913913
WildcardImportTarget(module="time", attr="sleep"),
914+
WildcardImportTarget(module="streamlit", attr="write"),
914915
WildcardImportTarget(module="streamlit", attr="write_stream"),
915916
WildcardImportTarget(module="asyncio", attr="run"),
916917
]
@@ -924,6 +925,7 @@ def patch(code: str | ast.Module, script_path: str) -> ast.Module:
924925
func_call_handler = FuncCallTransformHandler(
925926
{
926927
FunctionCall(name="time.sleep"): TransformRuleAction.TIME_SLEEP,
928+
FunctionCall(name="streamlit.write"): TransformRuleAction.AWAIT_CALL,
927929
FunctionCall(name="streamlit.write_stream"): TransformRuleAction.AWAIT_CALL,
928930
AttrFunctionCall(
929931
obj=ReturnValue(called_function="streamlit.navigation"),

streamlit

0 commit comments

Comments
 (0)