aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mlog.py
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2021-03-04 17:16:11 -0500
committerEli Schwartz <eschwartz@archlinux.org>2021-03-04 17:16:11 -0500
commit6a0fabc6472f49621260de215f128a31ae70219b (patch)
tree6a67908358a2c5e5baa215fe0201dfe213dd8a01 /mesonbuild/mlog.py
parent4340bf34faca7eed8076ba4c388fbe15355f2183 (diff)
downloadmeson-6a0fabc6472f49621260de215f128a31ae70219b.zip
meson-6a0fabc6472f49621260de215f128a31ae70219b.tar.gz
meson-6a0fabc6472f49621260de215f128a31ae70219b.tar.bz2
mass rewrite of string formatting to use f-strings everywhere
performed by running "pyupgrade --py36-plus" and committing the results
Diffstat (limited to 'mesonbuild/mlog.py')
-rw-r--r--mesonbuild/mlog.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py
index dbc48a1..15fdb8d 100644
--- a/mesonbuild/mlog.py
+++ b/mesonbuild/mlog.py
@@ -127,7 +127,7 @@ class AnsiDecorator:
if with_codes and self.code:
text = self.code + self.text + AnsiDecorator.plain_code
if self.quoted:
- text = '"{}"'.format(text)
+ text = f'"{text}"'
return text
def __len__(self) -> int:
@@ -230,7 +230,7 @@ def debug(*args: T.Union[str, AnsiDecorator], **kwargs: T.Any) -> None:
def _debug_log_cmd(cmd: str, args: T.List[str]) -> None:
if not _in_ci:
return
- args = ['"{}"'.format(x) for x in args] # Quote all args, just in case
+ args = [f'"{x}"' for x in args] # Quote all args, just in case
debug('!meson_ci!/{} {}'.format(cmd, ' '.join(args)))
def cmd_ci_include(file: str) -> None:
@@ -276,7 +276,7 @@ def log_once(*args: T.Union[str, AnsiDecorator], is_error: bool = False,
# 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: str) -> str:
- return '{}:{}:'.format(fname, lineno)
+ return f'{fname}:{lineno}:'
def _log_error(severity: str, *rargs: T.Union[str, AnsiDecorator],
once: bool = False, fatal: bool = True, **kwargs: T.Any) -> None:
@@ -350,7 +350,7 @@ def exception(e: Exception, prefix: T.Optional[AnsiDecorator] = None) -> None:
# Mypy doesn't follow hasattr, and it's pretty easy to visually inspect
# that this is correct, so we'll just ignore it.
path = get_relative_path(Path(e.file), Path(os.getcwd())) # type: ignore
- args.append('{}:{}:{}:'.format(path, e.lineno, e.colno)) # type: ignore
+ args.append(f'{path}:{e.lineno}:{e.colno}:') # type: ignore
if prefix:
args.append(prefix)
args.append(str(e))