forked from pool/python-scikit-build-core
86 lines
2.6 KiB
Diff
86 lines
2.6 KiB
Diff
|
From bc81cb1250ab4488fef55c081feccf6620e28144 Mon Sep 17 00:00:00 2001
|
||
|
From: Ben Greiner <code@bnavigator.de>
|
||
|
Date: Sun, 9 Jun 2024 22:07:19 +0200
|
||
|
Subject: [PATCH 1/3] Only replace rich if the color is defined
|
||
|
|
||
|
---
|
||
|
src/scikit_build_core/_logging.py | 8 +++++++-
|
||
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/src/scikit_build_core/_logging.py b/src/scikit_build_core/_logging.py
|
||
|
index c449c74f..ad1433b7 100644
|
||
|
--- a/src/scikit_build_core/_logging.py
|
||
|
+++ b/src/scikit_build_core/_logging.py
|
||
|
@@ -116,10 +116,16 @@ def colors() -> dict[str, str]:
|
||
|
return _COLORS
|
||
|
return _NO_COLORS
|
||
|
|
||
|
+def _sub_rich(m: re.Match) -> str:
|
||
|
+ try:
|
||
|
+ r = "".join(colors()[x] for x in m.group(1).split())
|
||
|
+ except KeyError:
|
||
|
+ r = m.group(0)
|
||
|
+ return r
|
||
|
|
||
|
def _process_rich(msg: object) -> str:
|
||
|
return ANY_ESCAPE.sub(
|
||
|
- lambda m: "".join(colors()[x] for x in m.group(1).split()),
|
||
|
+ _sub_rich,
|
||
|
str(msg),
|
||
|
)
|
||
|
|
||
|
|
||
|
From aa97911dacb0460f9d6eef27240bee92894aa364 Mon Sep 17 00:00:00 2001
|
||
|
From: "pre-commit-ci[bot]"
|
||
|
<66853113+pre-commit-ci[bot]@users.noreply.github.com>
|
||
|
Date: Sun, 9 Jun 2024 20:11:51 +0000
|
||
|
Subject: [PATCH 2/3] style: pre-commit fixes
|
||
|
|
||
|
---
|
||
|
src/scikit_build_core/_logging.py | 2 ++
|
||
|
1 file changed, 2 insertions(+)
|
||
|
|
||
|
diff --git a/src/scikit_build_core/_logging.py b/src/scikit_build_core/_logging.py
|
||
|
index ad1433b7..a824ac24 100644
|
||
|
--- a/src/scikit_build_core/_logging.py
|
||
|
+++ b/src/scikit_build_core/_logging.py
|
||
|
@@ -116,6 +116,7 @@ def colors() -> dict[str, str]:
|
||
|
return _COLORS
|
||
|
return _NO_COLORS
|
||
|
|
||
|
+
|
||
|
def _sub_rich(m: re.Match) -> str:
|
||
|
try:
|
||
|
r = "".join(colors()[x] for x in m.group(1).split())
|
||
|
@@ -123,6 +124,7 @@ def _sub_rich(m: re.Match) -> str:
|
||
|
r = m.group(0)
|
||
|
return r
|
||
|
|
||
|
+
|
||
|
def _process_rich(msg: object) -> str:
|
||
|
return ANY_ESCAPE.sub(
|
||
|
_sub_rich,
|
||
|
|
||
|
From bbbd406e90a7f3e001bf7c7df367e97af5cf32ba Mon Sep 17 00:00:00 2001
|
||
|
From: Ben Greiner <code@bnavigator.de>
|
||
|
Date: Sun, 9 Jun 2024 22:25:27 +0200
|
||
|
Subject: [PATCH 3/3] Fix typing annotation
|
||
|
|
||
|
---
|
||
|
src/scikit_build_core/_logging.py | 2 +-
|
||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/src/scikit_build_core/_logging.py b/src/scikit_build_core/_logging.py
|
||
|
index a824ac24..66957d32 100644
|
||
|
--- a/src/scikit_build_core/_logging.py
|
||
|
+++ b/src/scikit_build_core/_logging.py
|
||
|
@@ -117,7 +117,7 @@ def colors() -> dict[str, str]:
|
||
|
return _NO_COLORS
|
||
|
|
||
|
|
||
|
-def _sub_rich(m: re.Match) -> str:
|
||
|
+def _sub_rich(m: re.Match[Any]) -> str:
|
||
|
try:
|
||
|
r = "".join(colors()[x] for x in m.group(1).split())
|
||
|
except KeyError:
|