From 6cc6742415102edf2e865f58a8d659a24ea90dac Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Tue, 2 Apr 2024 15:40:59 -0400 Subject: [PATCH] Localize log. --- .../wala/cast/python/parser/PythonModuleParser.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/com.ibm.wala.cast.python.jython3/source/com/ibm/wala/cast/python/parser/PythonModuleParser.java b/com.ibm.wala.cast.python.jython3/source/com/ibm/wala/cast/python/parser/PythonModuleParser.java index b8e19beb4..7b65abb37 100644 --- a/com.ibm.wala.cast.python.jython3/source/com/ibm/wala/cast/python/parser/PythonModuleParser.java +++ b/com.ibm.wala.cast.python.jython3/source/com/ibm/wala/cast/python/parser/PythonModuleParser.java @@ -160,7 +160,7 @@ public CAstNode visitImportFrom(ImportFrom importFrom) throws Exception { String moduleName = s.get(); LOGGER.finer("Module name from " + importFrom + " is: " + moduleName + "."); - if (!isLocalModule(moduleName)) moduleName += "/" + MODULE_INITIALIZATION_ENTITY_NAME; + if (!isLocalModule(moduleName)) moduleName = s.get() + "/__init__"; LOGGER.finer("Module name from " + importFrom + " is: " + moduleName + "."); @@ -285,9 +285,13 @@ protected Reader getReader() throws IOException { } private boolean isLocalModule(String moduleName) { - return localModules.stream() - .map(lm -> scriptName((SourceModule) lm)) - .anyMatch(sn -> sn.endsWith(moduleName + ".py")); + boolean ret = + localModules.stream() + .map(lm -> scriptName((SourceModule) lm)) + .anyMatch(sn -> sn.endsWith(moduleName + ".py")); + + LOGGER.finer("Module: " + moduleName + (ret ? " is" : " isn't") + " local."); + return ret; } /**