summaryrefslogtreecommitdiff
path: root/venv/lib/python3.11/site-packages/rich/_windows.py
diff options
context:
space:
mode:
authorcyfraeviolae <cyfraeviolae>2024-04-03 03:17:55 -0400
committercyfraeviolae <cyfraeviolae>2024-04-03 03:17:55 -0400
commit12cf076118570eebbff08c6b3090e0d4798447a1 (patch)
tree3ba25e17e3c3a5e82316558ba3864b955919ff72 /venv/lib/python3.11/site-packages/rich/_windows.py
parentc45662ff3923b34614ddcc8feb9195541166dcc5 (diff)
no venv
Diffstat (limited to 'venv/lib/python3.11/site-packages/rich/_windows.py')
-rw-r--r--venv/lib/python3.11/site-packages/rich/_windows.py71
1 files changed, 0 insertions, 71 deletions
diff --git a/venv/lib/python3.11/site-packages/rich/_windows.py b/venv/lib/python3.11/site-packages/rich/_windows.py
deleted file mode 100644
index e17c5c0..0000000
--- a/venv/lib/python3.11/site-packages/rich/_windows.py
+++ /dev/null
@@ -1,71 +0,0 @@
-import sys
-from dataclasses import dataclass
-
-
-@dataclass
-class WindowsConsoleFeatures:
- """Windows features available."""
-
- vt: bool = False
- """The console supports VT codes."""
- truecolor: bool = False
- """The console supports truecolor."""
-
-
-try:
- import ctypes
- from ctypes import LibraryLoader
-
- if sys.platform == "win32":
- windll = LibraryLoader(ctypes.WinDLL)
- else:
- windll = None
- raise ImportError("Not windows")
-
- from rich._win32_console import (
- ENABLE_VIRTUAL_TERMINAL_PROCESSING,
- GetConsoleMode,
- GetStdHandle,
- LegacyWindowsError,
- )
-
-except (AttributeError, ImportError, ValueError):
- # Fallback if we can't load the Windows DLL
- def get_windows_console_features() -> WindowsConsoleFeatures:
- features = WindowsConsoleFeatures()
- return features
-
-else:
-
- def get_windows_console_features() -> WindowsConsoleFeatures:
- """Get windows console features.
-
- Returns:
- WindowsConsoleFeatures: An instance of WindowsConsoleFeatures.
- """
- handle = GetStdHandle()
- try:
- console_mode = GetConsoleMode(handle)
- success = True
- except LegacyWindowsError:
- console_mode = 0
- success = False
- vt = bool(success and console_mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING)
- truecolor = False
- if vt:
- win_version = sys.getwindowsversion()
- truecolor = win_version.major > 10 or (
- win_version.major == 10 and win_version.build >= 15063
- )
- features = WindowsConsoleFeatures(vt=vt, truecolor=truecolor)
- return features
-
-
-if __name__ == "__main__":
- import platform
-
- features = get_windows_console_features()
- from rich import print
-
- print(f'platform="{platform.system()}"')
- print(repr(features))