aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2022-11-18 13:44:02 -0800
committerEli Schwartz <eschwartz@archlinux.org>2023-05-31 17:20:46 -0400
commit11fab771b17f7d20cc5af235acfcc68ec63baa16 (patch)
treeb0aa2fc0419c7650e02b3ae596c1cb7c10026b18
parentada2a976f003f505181d2f252ef907f8caa345e0 (diff)
downloadmeson-11fab771b17f7d20cc5af235acfcc68ec63baa16.zip
meson-11fab771b17f7d20cc5af235acfcc68ec63baa16.tar.gz
meson-11fab771b17f7d20cc5af235acfcc68ec63baa16.tar.bz2
mlog: use StringProtocol where we said we should
Replace a long comment explaining that we need StringProtocol, with StringProtocol
-rw-r--r--mesonbuild/mlog.py9
1 files changed, 1 insertions, 8 deletions
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py
index 9c8187e..edddad5 100644
--- a/mesonbuild/mlog.py
+++ b/mesonbuild/mlog.py
@@ -503,14 +503,7 @@ def normal_blue(text: str) -> AnsiDecorator:
def normal_cyan(text: str) -> AnsiDecorator:
return AnsiDecorator(text, "\033[36m")
-# This isn't strictly correct. What we really want here is something like:
-# class StringProtocol(typing_extensions.Protocol):
-#
-# def __str__(self) -> str: ...
-#
-# This would more accurately embody what this function can handle, but we
-# don't have that yet, so instead we'll do some casting to work around it
-def get_error_location_string(fname: str, lineno: int) -> str:
+def get_error_location_string(fname: StringProtocol, lineno: int) -> str:
return f'{fname}:{lineno}:'
def get_relative_path(target: Path, current: Path) -> Path: