Fri, 23 Dec 2022 11:37:49 +0100
Added TODO markers to modernize the code (os.scandir instead of os.listdir)
--- a/src/eric7/Graphics/ApplicationDiagramBuilder.py Fri Dec 23 11:36:26 2022 +0100 +++ b/src/eric7/Graphics/ApplicationDiagramBuilder.py Fri Dec 23 11:37:49 2022 +0100 @@ -117,6 +117,7 @@ # project is a package return path else: + # TODO: replace os.listdir() with os.scandir() # check, if any of the top directories is a package for entry in [e for e in os.listdir(path) if not e.startswith(".")]: fullpath = os.path.join(path, entry) @@ -125,6 +126,7 @@ if os.path.exists(init): candidates.append(fullpath) + # TODO: replace os.listdir() with os.scandir() # check, if project uses the 'src' layout if os.path.exists(os.path.join(path, "src")): srcPath = os.path.join(path, "src")
--- a/src/eric7/Graphics/PackageDiagramBuilder.py Fri Dec 23 11:36:26 2022 +0100 +++ b/src/eric7/Graphics/PackageDiagramBuilder.py Fri Dec 23 11:37:49 2022 +0100 @@ -154,6 +154,7 @@ subpackagesDict = {} subpackagesList = [] + # TODO: replace os.listdir() with os.scandir() for subpackage in os.listdir(self.package): subpackagePath = os.path.join(self.package, subpackage) if (
--- a/src/eric7/PluginManager/PluginRepositoryDialog.py Fri Dec 23 11:36:26 2022 +0100 +++ b/src/eric7/PluginManager/PluginRepositoryDialog.py Fri Dec 23 11:37:49 2022 +0100 @@ -1084,6 +1084,7 @@ downloadPath = Preferences.getPluginManager("DownloadPath") downloads = {} # plug-in name as key, file name as value + # TODO: replace os.listdir() with os.scandir() # step 1: extract plug-ins and downloaded files for pluginFile in os.listdir(downloadPath): if not os.path.isfile(os.path.join(downloadPath, pluginFile)):
--- a/src/eric7/SystemUtilities/FileSystemUtilities.py Fri Dec 23 11:36:26 2022 +0100 +++ b/src/eric7/SystemUtilities/FileSystemUtilities.py Fri Dec 23 11:37:49 2022 +0100 @@ -466,6 +466,7 @@ if ignore is not None: ignoreList.extend(ignore) + # TODO: replace os.listdir() with os.scandir() try: entries = os.listdir(path) for entry in entries: @@ -507,6 +508,7 @@ @param excludeDirs basename of directories to ignore @return list of all directories found """ + # TODO: replace os.listdir() with os.scandir() try: names = os.listdir(path) except OSError: