src/eric7/MicroPython/MicroPythonFileSystemUtilities.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9473
3f23dbf37dbe
diff -r e9e7eca7efee -r bf71ee032bb4 src/eric7/MicroPython/MicroPythonFileSystemUtilities.py
--- a/src/eric7/MicroPython/MicroPythonFileSystemUtilities.py	Wed Jul 13 11:16:20 2022 +0200
+++ b/src/eric7/MicroPython/MicroPythonFileSystemUtilities.py	Wed Jul 13 14:55:47 2022 +0200
@@ -18,7 +18,7 @@
 def mtime2string(mtime, adjustEpoch=False):
     """
     Function to convert a time value to a string representation.
-    
+
     @param mtime time value
     @type int
     @param adjustEpoch flag indicating to adjust the time for the difference
@@ -35,7 +35,7 @@
 def mode2string(mode):
     """
     Function to convert a mode value to a string representation.
-    
+
     @param mode mode value
     @type int
     @return string representation of the given mode value
@@ -47,7 +47,7 @@
 def decoratedName(name, mode, isDir=False):
     """
     Function to decorate the given name according to the given mode.
-    
+
     @param name file or directory name
     @type str
     @param mode mode value
@@ -71,7 +71,7 @@
 def isVisible(name, showHidden):
     """
     Function to check, if a filesystem entry is a hidden file or directory.
-    
+
     @param name name to be checked
     @type str
     @param showHidden flag indicating to show hidden files as well
@@ -79,16 +79,13 @@
     @return flag indicating a visible filesystem entry
     @rtype bool
     """
-    return (
-        showHidden or
-        (not name.startswith(".") and not name.endswith("~"))
-    )
+    return showHidden or (not name.startswith(".") and not name.endswith("~"))
 
 
 def fstat(filename):
     """
     Function to get the stat() of file.
-    
+
     @param filename name of the file
     @type str
     @return tuple containing the stat() result
@@ -104,7 +101,7 @@
 def listdirStat(dirname, showHidden=False):
     """
     Function to get a list of directory entries and associated stat() tuples.
-    
+
     @param dirname name of the directory to list
     @type str
     @param showHidden flag indicating to show hidden files as well
@@ -117,9 +114,10 @@
         files = os.listdir(dirname) if dirname else os.listdir()
     except OSError:
         return []
-    
-    if dirname in ('', '/'):
+
+    if dirname in ("", "/"):
         return [(f, fstat(f)) for f in files if isVisible(f, showHidden)]
-    
-    return [(f, fstat(os.path.join(dirname, f))) for f in files
-            if isVisible(f, showHidden)]
+
+    return [
+        (f, fstat(os.path.join(dirname, f))) for f in files if isVisible(f, showHidden)
+    ]

eric ide

mercurial