Salome HOME
style: black format
[tools/sat.git] / src / colorama / win32.py
index 3d1d2f2d91867ecd8663a2870fededa15b2b9c89..34c13ab6e4243b48b1ccc8fb1c7e03d73e3efb51 100644 (file)
@@ -7,6 +7,7 @@ STDERR = -12
 try:
     import ctypes
     from ctypes import LibraryLoader
+
     windll = LibraryLoader(ctypes.WinDLL)
     from ctypes import wintypes
 except (AttributeError, ImportError):
@@ -20,6 +21,7 @@ else:
 
     class CONSOLE_SCREEN_BUFFER_INFO(Structure):
         """struct in wincon.h."""
+
         _fields_ = [
             ("dwSize", COORD),
             ("dwCursorPosition", COORD),
@@ -27,13 +29,20 @@ else:
             ("srWindow", wintypes.SMALL_RECT),
             ("dwMaximumWindowSize", COORD),
         ]
+
         def __str__(self):
-            return '(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)' % (
-                self.dwSize.Y, self.dwSize.X
-                , self.dwCursorPosition.Y, self.dwCursorPosition.X
-                , self.wAttributes
-                , self.srWindow.Top, self.srWindow.Left, self.srWindow.Bottom, self.srWindow.Right
-                , self.dwMaximumWindowSize.Y, self.dwMaximumWindowSize.X
+            return "(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)" % (
+                self.dwSize.Y,
+                self.dwSize.X,
+                self.dwCursorPosition.Y,
+                self.dwCursorPosition.X,
+                self.wAttributes,
+                self.srWindow.Top,
+                self.srWindow.Left,
+                self.srWindow.Bottom,
+                self.srWindow.Right,
+                self.dwMaximumWindowSize.Y,
+                self.dwMaximumWindowSize.X,
             )
 
     _GetStdHandle = windll.kernel32.GetStdHandle
@@ -84,9 +93,7 @@ else:
     _FillConsoleOutputAttribute.restype = wintypes.BOOL
 
     _SetConsoleTitleW = windll.kernel32.SetConsoleTitleA
-    _SetConsoleTitleW.argtypes = [
-        wintypes.LPCSTR
-    ]
+    _SetConsoleTitleW.argtypes = [wintypes.LPCSTR]
     _SetConsoleTitleW.restype = wintypes.BOOL
 
     handles = {
@@ -97,15 +104,13 @@ else:
     def winapi_test():
         handle = handles[STDOUT]
         csbi = CONSOLE_SCREEN_BUFFER_INFO()
-        success = _GetConsoleScreenBufferInfo(
-            handle, byref(csbi))
+        success = _GetConsoleScreenBufferInfo(handle, byref(csbi))
         return bool(success)
 
     def GetConsoleScreenBufferInfo(stream_id=STDOUT):
         handle = handles[stream_id]
         csbi = CONSOLE_SCREEN_BUFFER_INFO()
-        success = _GetConsoleScreenBufferInfo(
-            handle, byref(csbi))
+        success = _GetConsoleScreenBufferInfo(handle, byref(csbi))
         return csbi
 
     def SetConsoleTextAttribute(stream_id, attrs):
@@ -137,18 +142,20 @@ else:
         num_written = wintypes.DWORD(0)
         # Note that this is hard-coded for ANSI (vs wide) bytes.
         success = _FillConsoleOutputCharacterA(
-            handle, char, length, start, byref(num_written))
+            handle, char, length, start, byref(num_written)
+        )
         return num_written.value
 
     def FillConsoleOutputAttribute(stream_id, attr, length, start):
-        ''' FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten )'''
+        """FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten )"""
         handle = handles[stream_id]
         attribute = wintypes.WORD(attr)
         length = wintypes.DWORD(length)
         num_written = wintypes.DWORD(0)
         # Note that this is hard-coded for ANSI (vs wide) bytes.
         return _FillConsoleOutputAttribute(
-            handle, attribute, length, start, byref(num_written))
+            handle, attribute, length, start, byref(num_written)
+        )
 
     def SetConsoleTitle(title):
         return _SetConsoleTitleW(title)