diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 22b1be0d..3d76a6aa 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -25,6 +25,7 @@ The following people have contributed to the development of Rich: - [Kenneth Hoste](https://github.com/boegel) - [Lanqing Huang](https://github.com/lqhuang) - [Finn Hughes](https://github.com/finnhughes) +- [JP Hutchins](https://github.com/JPhutchins) - [Ionite](https://github.com/ionite34) - [Josh Karpel](https://github.com/JoshKarpel) - [Jan Katins](https://github.com/jankatins) diff --git a/rich/color.py b/rich/color.py index 4270a278..e2c23a6a 100644 --- a/rich/color.py +++ b/rich/color.py @@ -1,5 +1,5 @@ -import platform import re +import sys from colorsys import rgb_to_hls from enum import IntEnum from functools import lru_cache @@ -15,7 +15,7 @@ if TYPE_CHECKING: # pragma: no cover from .text import Text -WINDOWS = platform.system() == "Windows" +WINDOWS = sys.platform == "win32" class ColorSystem(IntEnum): diff --git a/rich/console.py b/rich/console.py index 1232cd5c..67fd2879 100644 --- a/rich/console.py +++ b/rich/console.py @@ -1,6 +1,5 @@ import inspect import os -import platform import sys import threading import zlib @@ -76,7 +75,7 @@ if TYPE_CHECKING: JUPYTER_DEFAULT_COLUMNS = 115 JUPYTER_DEFAULT_LINES = 100 -WINDOWS = platform.system() == "Windows" +WINDOWS = sys.platform == "win32" HighlighterType = Callable[[Union[str, "Text"]], "Text"] JustifyMethod = Literal["default", "left", "center", "right", "full"] diff --git a/rich/syntax.py b/rich/syntax.py index 618e0459..f3ceff75 100644 --- a/rich/syntax.py +++ b/rich/syntax.py @@ -1,5 +1,4 @@ import os.path -import platform import re import sys import textwrap @@ -52,7 +51,7 @@ from .text import Text TokenType = Tuple[str, ...] -WINDOWS = platform.system() == "Windows" +WINDOWS = sys.platform == "win32" DEFAULT_THEME = "monokai" # The following styles are based on https://github.com/pygments/pygments/blob/master/pygments/formatters/terminal.py diff --git a/rich/traceback.py b/rich/traceback.py index 821c7501..e3232e0b 100644 --- a/rich/traceback.py +++ b/rich/traceback.py @@ -2,7 +2,6 @@ from __future__ import absolute_import import linecache import os -import platform import sys from dataclasses import dataclass, field from traceback import walk_tb @@ -39,7 +38,7 @@ from .syntax import Syntax from .text import Text from .theme import Theme -WINDOWS = platform.system() == "Windows" +WINDOWS = sys.platform == "win32" LOCALS_MAX_LENGTH = 10 LOCALS_MAX_STRING = 80