src/eric7/CodeFormatting/IsortFormattingDialog.py

branch
eric7
changeset 9481
0b936ff1bbb9
parent 9475
5c09d70e9290
child 9653
e67609152c5e
diff -r 107aca8932ac -r 0b936ff1bbb9 src/eric7/CodeFormatting/IsortFormattingDialog.py
--- a/src/eric7/CodeFormatting/IsortFormattingDialog.py	Sat Nov 05 19:53:54 2022 +0100
+++ b/src/eric7/CodeFormatting/IsortFormattingDialog.py	Sun Nov 06 11:22:39 2022 +0100
@@ -551,13 +551,12 @@
         @rtype IsortResult
         """
         diffIO = io.StringIO() if withDiff else False
-        with open(os.devnull, "w") as devnull:
-            with contextlib.redirect_stderr(devnull):
-                ok = check_file(
-                    filename,
-                    show_diff=diffIO,
-                    config=isortConfig,
-                )
+        with open(os.devnull, "w") as devnull, contextlib.redirect_stderr(devnull):
+            ok = check_file(
+                filename,
+                show_diff=diffIO,
+                config=isortConfig,
+            )
         if withDiff:
             data = "" if ok else diffIO.getvalue()
             diffIO.close()
@@ -580,15 +579,14 @@
         @return result object
         @rtype IsortResult
         """
-        with open(os.devnull, "w") as devnull:
-            with contextlib.redirect_stderr(devnull):
-                ok = sort_file(
-                    filename,
-                    config=isortConfig,
-                    ask_to_apply=False,
-                    write_to_stdout=False,
-                    show_diff=False,
-                )
+        with open(os.devnull, "w") as devnull, contextlib.redirect_stderr(devnull):
+            ok = sort_file(
+                filename,
+                config=isortConfig,
+                ask_to_apply=False,
+                write_to_stdout=False,
+                show_diff=False,
+            )
 
         status = "changed" if ok else "unchanged"
 

eric ide

mercurial