src/eric7/Utilities/ClassBrowsers/pyclbr.py

branch
server
changeset 10592
2bada76be1a6
parent 10477
11b5d533e4a2
child 10596
ea35c92a3c7c
--- a/src/eric7/Utilities/ClassBrowsers/pyclbr.py	Mon Feb 19 15:34:54 2024 +0100
+++ b/src/eric7/Utilities/ClassBrowsers/pyclbr.py	Mon Feb 19 15:56:51 2024 +0100
@@ -20,6 +20,8 @@
 from PyQt6.QtCore import QRegularExpression
 
 from eric7 import Utilities
+from eric7.EricWidgets.EricApplication import ericApp
+from eric7.SystemUtilities import FileSystemUtilities
 from eric7.Utilities import ClassBrowsers
 
 from . import ClbrBaseClasses
@@ -395,7 +397,7 @@
                 self.importedNames[name].append(lineno)
 
 
-def readmodule_ex(module, path=None, isTypeFile=False):
+def readmodule_ex(module, searchPath=None, isTypeFile=False):
     """
     Read a module file and return a dictionary of classes.
 
@@ -405,29 +407,37 @@
 
     @param module name of the module file
     @type str
-    @param path path the module should be searched in
+    @param searchPath path the module should be searched in
     @type list of str
     @param isTypeFile flag indicating a file of this type
     @type bool
     @return the resulting dictionary
     @rtype dict
     """
-    # search the path for the module
-    path = [] if path is None else path[:]
-    f = None
-    if f is None:
-        fullpath = path[:] + sys.path[:]
+    fsInterface = ericApp().getObject("EricServer").getServiceInterface("FileSystem")
+
+    if searchPath and FileSystemUtilities.isRemoteFileName(searchPath[0]):
+        type = ClassBrowsers.determineSourceType(module, isTypeFile)
+        file = fsInterface.join(searchPath[0], module)
+    else:
+        # search the path for the module
+        searchPath = [] if searchPath is None else searchPath[:]
+        fullpath = searchPath[:] + sys.path[:]
         f, file, (suff, mode, type) = ClassBrowsers.find_module(
             module, fullpath, isTypeFile
         )
-    if f:
-        f.close()
+        if f:
+            f.close()
+
     if type not in SUPPORTED_TYPES:
         # not Python source, can't do anything with this module
         return {}
 
     try:
-        src = Utilities.readEncodedFile(file)[0]
+        if FileSystemUtilities.isRemoteFileName(file):
+            src = fsInterface.readEncodedFile(file)[0]
+        else:
+            src = Utilities.readEncodedFile(file)[0]
     except (OSError, UnicodeError):
         # can't do anything with this module
         return {}

eric ide

mercurial