From 992ad6fd93834d2cb1d15910502f35e4cd356c70 Mon Sep 17 00:00:00 2001 From: Samuel Grayson Date: Tue, 15 Feb 2022 12:44:11 -0600 Subject: [PATCH] Fixed anutils.get_module_name --- pyan/anutils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyan/anutils.py b/pyan/anutils.py index 8063e61..ba74f9c 100644 --- a/pyan/anutils.py +++ b/pyan/anutils.py @@ -39,6 +39,8 @@ def get_module_name(filename, root: str = None): potential_root = os.path.dirname(directories[0][0]) is_root = any([f == "__init__.py" for f in os.listdir(potential_root)]) directories.insert(0, (potential_root, is_root)) + if is_root: + break # keep directories where itself of parent is root while not directories[0][1]: