diff -r 789d739a683a -r 83dea9e54ff4 src/eric7/Utilities/ModuleParser.py --- a/src/eric7/Utilities/ModuleParser.py Wed Sep 28 12:56:35 2022 +0200 +++ b/src/eric7/Utilities/ModuleParser.py Wed Sep 28 15:35:06 2022 +0200 @@ -1563,7 +1563,7 @@ global _modules _extensions = ( - [".py", ".pyw", ".ptl", ".rb"] if extensions is None else extensions[:] + [".py", ".pyw", ".pyi", ".ptl", ".rb"] if extensions is None else extensions[:] ) with contextlib.suppress(ValueError): _extensions.remove(".py") @@ -1576,6 +1576,7 @@ module = module[:-3] if ( os.path.exists(os.path.join(path[0], "__init__.py")) + or os.path.exists(os.path.join(path[0], "__init__.pyi")) or os.path.exists(os.path.join(path[0], "__init__.rb")) or inpackage ): @@ -1586,7 +1587,7 @@ else: modname = module modname = modname.replace(os.sep, ".") - inpackage = 1 + inpackage = True else: modname = os.path.basename(module) for ext in _extensions: @@ -1689,7 +1690,7 @@ # standard Python module file if name.lower().endswith(".py"): - name = name[:-3] + name = os.path.splitext(name)[0] spec = importlib.machinery.PathFinder.find_spec(name, path) if spec is None: @@ -1720,19 +1721,16 @@ modname = module if os.path.exists(module): - path = [os.path.dirname(module)] + modulePath = [os.path.dirname(module)] if module.lower().endswith(".py"): - module = module[:-3] - if os.path.exists(os.path.join(path[0], "__init__.py")): + module = os.path.splitext(module)[0] + if os.path.exists(os.path.join(modulePath[0], "__init__.py")): if basename: module = module.replace(basename, "") modname = module.replace(os.sep, ".") else: modname = os.path.basename(module) - if modname.lower().endswith(".ptl") or modname.lower().endswith(".pyw"): - modname = modname[:-4] - elif modname.lower().endswith(".rb"): - modname = modname[:-3] + modname = os.path.splitext(modname)[0] module = os.path.basename(module) if modname in _modules: