rework default python script

This commit is contained in:
Ruben Fiszel
2022-08-05 20:21:13 +02:00
parent 07f4a217d0
commit 0346d955f9
2 changed files with 6 additions and 15 deletions
+2 -8
View File
@@ -478,10 +478,7 @@ async fn push_next_flow_job(
serde_json::Value::Number(serde_json::Number::from(0)),
);
iteration_map.insert("value".to_string(), itered[0].clone());
args.insert(
"iteration".to_string(),
serde_json::Value::Object(iteration_map),
);
args.insert("iter".to_string(), serde_json::Value::Object(iteration_map));
match itered {
serde_json::Value::Array(arr) => (Some(args), Some((0 as u8, arr, vec![]))),
a @ _ => Err(Error::BadRequest(format!(
@@ -506,10 +503,7 @@ async fn push_next_flow_job(
"value".to_string(),
itered[nindex.to_owned() as usize].clone(),
);
args.insert(
"iteration".to_string(),
serde_json::Value::Object(iteration_map),
);
args.insert("iter".to_string(), serde_json::Value::Object(iteration_map));
(
Some(args),
Some((nindex, itered.clone(), forloop_jobs.clone())),
+4 -7
View File
@@ -1,16 +1,13 @@
export const PYTHON_INIT_CODE = `import os
import wmill
from datetime import datetime
# Our webeditor includes a syntax, type checker through a language server running pyright
# and the autoformatter Black in our servers. Use Cmd/Ctrl + S to autoformat the code.
# Beware that the code is only saved when you click Save and not across reload.
# You can however navigate to any steps safely.
"""
Use Cmd/Ctrl + S to autoformat the code.
The client is used to interact with windmill itself through its standard API.
One can explore the methods available through autocompletion of \`client.XXX\`.
Only the most common methods are included for ease of use. Request more as
feedback if you feel you are missing important ones.
One can explore the methods available through autocompletion of \`wmill.XXX\`.
"""
def main(name: str = "Nicolas Bourbaki",
age: int = 42,
obj: dict = {"even": "dicts"},