--- a/src/eric7/RemoteServerInterface/EricServerFileSystemInterface.py Fri Mar 08 15:51:14 2024 +0100 +++ b/src/eric7/RemoteServerInterface/EricServerFileSystemInterface.py Fri Mar 08 16:08:43 2024 +0100 @@ -19,7 +19,6 @@ from eric7.RemoteServer.EricRequestCategory import EricRequestCategory from eric7.SystemUtilities import FileSystemUtilities - _RemoteFsCache = {} # dictionary containing cached remote file system data keyed by remote path @@ -83,9 +82,8 @@ @param connected flag indicating a connected state @type bool """ - if connected: - if not bool(self.__serverPathSep): - self.__serverPathSep = self.__getPathSep() + if connected and not bool(self.__serverPathSep): + self.__serverPathSep = self.__getPathSep() def __getPathSep(self): """ @@ -942,12 +940,11 @@ path separator. @rtype tuple of (str, str) """ - if self.__serverPathSep == "\\": - # remote is a Windows system - normp = p.replace("/", "\\") - else: - # remote is a Posix system - normp = p.replace("\\", "/") + normp = ( + p.replace("/", "\\") # remote is a Windows system + if self.__serverPathSep == "\\" + else p.replace("\\", "/") # remote is a Posix system + ) i = normp.rfind(self.__serverPathSep) + 1 head, tail = normp[:i], normp[i:] @@ -1410,12 +1407,12 @@ try: listing = self.listdir(directory=directory, recursive=True)[2] for entry in listing: - _RemoteFsCache[ - FileSystemUtilities.remoteFileName(entry["path"]) - ] = entry + _RemoteFsCache[FileSystemUtilities.remoteFileName(entry["path"])] = ( + entry + ) print(f"Remote Cache Size: {len(_RemoteFsCache)} entries") except OSError as err: - print("error in 'populateFsCache()':", str(err)) + print("Error in 'populateFsCache()':", str(err)) # noqa: M801 def removeFromFsCache(self, directory): """