Skip to content

Commit 8f0d4e3

Browse files
committed
use pin even if multiple modules imported withing single statement
1 parent 8406ee8 commit 8f0d4e3

File tree

1 file changed

+10
-12
lines changed
  • backend/parsers/windmill-parser-py-imports/src

1 file changed

+10
-12
lines changed

backend/parsers/windmill-parser-py-imports/src/lib.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,16 @@ fn parse_code_for_imports(code: &str, path: &str) -> error::Result<Vec<String>>
122122
let nimports: Vec<String> = ast
123123
.into_iter()
124124
.filter_map(|x| match x {
125-
Stmt::Import(StmtImport { names, range }) => find_pin(range)
126-
.and_then(|e| if names.len() > 1 { None } else { Some(e) })
127-
.or(Some(
128-
names
129-
.into_iter()
130-
.map(|x| {
131-
let name = x.name.to_string();
132-
process_import(Some(name), path, 0)
133-
})
134-
.flatten()
135-
.collect::<Vec<String>>(),
136-
)),
125+
Stmt::Import(StmtImport { names, range }) => find_pin(range).or(Some(
126+
names
127+
.into_iter()
128+
.map(|x| {
129+
let name = x.name.to_string();
130+
process_import(Some(name), path, 0)
131+
})
132+
.flatten()
133+
.collect::<Vec<String>>(),
134+
)),
137135
Stmt::ImportFrom(StmtImportFrom { level: Some(i), module, .. }) if i.to_u32() > 0 => {
138136
Some(process_import(
139137
module.map(|x| x.to_string()),

0 commit comments

Comments
 (0)