jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1340493?usp=email )
Change subject: UI: Use removesuffix for the terminal newline
......................................................................
UI: Use removesuffix for the terminal newline
Replace the trailing CRLF/LF regex substitution with removesuffix calls.
The surrounding check already requires a final LF, so removing that LF
and one optional CR preserves the existing behavior.
Change-Id: I5d50d591e2f7eb42680626749a4baab4a8d0f493
---
M pywikibot/userinterfaces/terminal_interface_base.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/userinterfaces/terminal_interface_base.py
b/pywikibot/userinterfaces/terminal_interface_base.py
index aa99573..e3cb43f 100644
--- a/pywikibot/userinterfaces/terminal_interface_base.py
+++ b/pywikibot/userinterfaces/terminal_interface_base.py
@@ -196,7 +196,8 @@
# Add default before the last linefeed
if text.endswith('\n'):
- text_parts[-1] = re.sub(r'\r?\n\Z', '', text_parts[-1])
+ text_parts[-1] = (
+ text_parts[-1].removesuffix('\n').removesuffix('\r'))
text_parts.extend(('default', '\n'))
text_parts.append('default')
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1340493?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I5d50d591e2f7eb42680626749a4baab4a8d0f493
Gerrit-Change-Number: 1340493
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]