jenkins-bot submitted this change.
[doc] Show backslash in sphinx doc
Change-Id: Iaf570e4f36b705425756c380cbb711f278695883
---
M pywikibot/tools/formatter.py
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/pywikibot/tools/formatter.py b/pywikibot/tools/formatter.py
index 768e6ca..337bfbe 100644
--- a/pywikibot/tools/formatter.py
+++ b/pywikibot/tools/formatter.py
@@ -69,16 +69,16 @@
r"""
Do ``str.format`` without having to worry about colors.
- It is automatically adding \03 in front of color fields so it's
- unnecessary to add them manually. Any other \03 in the text is
+ It is automatically adding \\03 in front of color fields so it's
+ unnecessary to add them manually. Any other \\03 in the text is
disallowed.
You may use a variant {color} by assigning a valid color to a named
parameter color.
.. deprecated:: 7.2
- new color format pattern like <<color>>colored text<<default>>
- may be used instead.
+ new color format pattern like
+ ``f'<<{color}>>colored text<<default>>'`` can be used instead.
:param text: The format template string
:return: The formatted string
@@ -103,8 +103,7 @@
text = text.format(*args, **kwargs)
except KeyError as e:
if str(e).strip("'") in colors:
- raise ValueError(
- 'Color field "{}" in "{}" uses conversion information or '
- 'format spec'.format(e, text))
+ raise ValueError(f'Color field "{e}" in "{text}" uses conversion '
+ f'information or format spec')
raise
return text
To view, visit change 929027. To unsubscribe, or for help writing mail filters, visit settings.