From 0d9d24bb1b1c4eae7720ce84017e2ffa862eb869 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Tue, 9 Aug 2022 15:48:28 +0200 Subject: [PATCH] fix replacement --- backend/src/parser.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/parser.rs b/backend/src/parser.rs index 369bb7c806..5642cd807e 100644 --- a/backend/src/parser.rs +++ b/backend/src/parser.rs @@ -661,7 +661,6 @@ pub fn parse_python_imports(code: &str) -> error::Result> { .lines() .skip(pos + 1) .map_while(|x| re.captures(x).map(|x| x.get(1).unwrap().as_str())) - .map(replace_import) .collect(); Ok(lines) } else { @@ -677,7 +676,8 @@ pub fn parse_python_imports(code: &str) -> error::Result> { StatementType::Import { names } => Some( names .into_iter() - .map(|x| x.symbol.split('.').next().unwrap_or("").to_string()) + .map(|x| x.symbol.split('.').next().unwrap_or("")) + .map(replace_import) .collect::>(), ), StatementType::ImportFrom { level: _, module: Some(mod_), names: _ } => {