# HG changeset patch
# User jfp <jf.pieronne@laposte.net>
# Date 1719396344 -7200
#      Wed Jun 26 12:05:44 2024 +0200
# Node ID 87c1d7ed1e246361e8392557ddec1734335289dc
# Parent  fccd9853e04849f622b2754f4850513fce8768c2
format using black, replace VMSError with OSError

diff --git a/python/local/ovms_module/ovms/rtl/lib/FindFile.py b/python/local/ovms_module/ovms/rtl/lib/FindFile.py
--- a/python/local/ovms_module/ovms/rtl/lib/FindFile.py
+++ b/python/local/ovms_module/ovms/rtl/lib/FindFile.py
@@ -2,13 +2,11 @@
 from ovms.rtl.lib import getdvi
 import ctypes
 
-VMSError = OSError
-
-VMSLIBRTL = '/SYS$COMMON/SYSLIB/LIBRTL.EXE'
+VMSLIBRTL = "/SYS$COMMON/SYSLIB/LIBRTL.EXE"
 LIBRTL = ctypes.CDLL(VMSLIBRTL)
-vms_find_file = getattr(LIBRTL, 'LIB$FIND_FILE')
-vms_find_file_end = getattr(LIBRTL, 'LIB$FIND_FILE_END')
-vms_trim_filespec = getattr(LIBRTL, 'LIB$TRIM_FILESPEC')
+vms_find_file = getattr(LIBRTL, "LIB$FIND_FILE")
+vms_find_file_end = getattr(LIBRTL, "LIB$FIND_FILE_END")
+vms_trim_filespec = getattr(LIBRTL, "LIB$TRIM_FILESPEC")
 
 LIB_M_FIL_LONG_NAMES = 4
 NAML_C_MAXRSS = 4095
@@ -23,13 +21,9 @@
     ):
         self.filespec = filespec
         self.default_filespec = (
-            None
-            if default_filespec is None
-            else descrip.bydesc(default_filespec)
+            None if default_filespec is None else descrip.bydesc(default_filespec)
         )
-        self.resultant_filespec = ctypes.create_string_buffer(
-            NAML_C_MAXRSS + 1
-        )
+        self.resultant_filespec = ctypes.create_string_buffer(NAML_C_MAXRSS + 1)
         self.context = ctypes.c_uint32()
         self.nullArg = ctypes.c_void_p()
         self.flags = ctypes.c_uint(flags)
@@ -58,10 +52,15 @@
             ctypes.byref(self.flags),
         )
         if not (s & 1):
-            raise StopIteration if s in (
-                rmsdef.RMS__NMF,
-                rmsdef.RMS__FNF,
-            ) else VMSError(s)
+            raise (
+                StopIteration
+                if s
+                in (
+                    rmsdef.RMS__NMF,
+                    rmsdef.RMS__FNF,
+                )
+                else OSError(s)
+            )
 
         s = vms_trim_filespec(
             descrip.bydesc(self.resultant_filespec),
@@ -72,9 +71,7 @@
         res = bytes(self.new_filespec[: self.resultant_length.value])
         # Check if the device is file oriented, lib$find_file return a file if
         # a device like NLA0: is used
-        if (
-            getdvi(dvidef.DVI__DEVCHAR, device_name=res)[1] & devdef.DEV_M_FOD
-        ) == 0:
+        if (getdvi(dvidef.DVI__DEVCHAR, device_name=res)[1] & devdef.DEV_M_FOD) == 0:
             raise StopIteration
         return res
 
@@ -86,11 +83,11 @@
         with FindFile(fn) as ifn:
             ifn.__next__()
         return True
-    except (StopIteration, VMSError):
+    except (StopIteration, OSError):
         return False
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     import sys
 
     with FindFile(sys.argv[1].encode()) as ifn: