From 3f890f183c5f058a1e9998c794a527f1e237f64f Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 19 Mar 2022 09:14:27 +0800 Subject: [PATCH] nac3standalone/demo: handle imports consistently --- nac3standalone/demo/interpret_demo.py | 3 +++ nac3standalone/demo/src/typevar.py | 2 -- nac3standalone/src/main.rs | 3 --- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/nac3standalone/demo/interpret_demo.py b/nac3standalone/demo/interpret_demo.py index 6d61aadf..d892833c 100755 --- a/nac3standalone/demo/interpret_demo.py +++ b/nac3standalone/demo/interpret_demo.py @@ -6,6 +6,7 @@ import importlib.machinery import pathlib from numpy import int32, int64, uint32, uint64 +from typing import TypeVar, Generic def patch(module): @@ -35,6 +36,8 @@ def patch(module): module.int64 = int64 module.uint32 = uint32 module.uint64 = uint64 + module.TypeVar = TypeVar + module.Generic = Generic module.extern = extern diff --git a/nac3standalone/demo/src/typevar.py b/nac3standalone/demo/src/typevar.py index 4d37f773..e9def8b3 100644 --- a/nac3standalone/demo/src/typevar.py +++ b/nac3standalone/demo/src/typevar.py @@ -1,5 +1,3 @@ -from typing import TypeVar, Generic - @extern def output_int32(x: int32): ... diff --git a/nac3standalone/src/main.rs b/nac3standalone/src/main.rs index fe50797a..bf99cafb 100644 --- a/nac3standalone/src/main.rs +++ b/nac3standalone/src/main.rs @@ -62,9 +62,6 @@ fn main() { let parser_result = parser::parse_program(&program, file_name.into()).unwrap(); for stmt in parser_result.into_iter() { - if matches!(stmt.node, StmtKind::Import { .. } | StmtKind::ImportFrom { .. }) { - continue; - } if let StmtKind::Assign { targets, value, .. } = &stmt.node { fn handle_typevar_definition( var: &Expr,