jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/753092 )
Change subject: [bugfix] remove question mark character from forbidden file name characters
......................................................................
[bugfix] remove question mark character from forbidden file name characters
The forbidden chars were introduced sometime before 2006 when some code
parts was moved from interwiki.py script to interwiki_graph module. The
original variant of compat's upload module only had '\\' as forbidden
char and other checks are also made within page module especially inside
Link initializer. Therefore I think the question mark kan safely be
removed here.
Bug: T93482
Change-Id: Iabbe639dce2bf42a422f59f7335df978473a3984
---
M pywikibot/specialbots/_upload.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Martineznovo: Looks good to me, but someone else must approve
JJMC89: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/specialbots/_upload.py b/pywikibot/specialbots/_upload.py
index 20d9bb0..fe93944 100644
--- a/pywikibot/specialbots/_upload.py
+++ b/pywikibot/specialbots/_upload.py
@@ -243,7 +243,7 @@
filename = newfn
# FIXME: these 2 belong somewhere else, presumably in family
# forbidden characters are handled by pywikibot/page.py
- forbidden = ':*?/\\' # to be extended
+ forbidden = ':*/\\' # to be extended
try:
allowed_formats = self.target_site.siteinfo.get(
'fileextensions', get_default=False)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/753092
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Iabbe639dce2bf42a422f59f7335df978473a3984
Gerrit-Change-Number: 753092
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: Martineznovo <martineznovo(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/753038 )
Change subject: [W0074] refactor loop by any() call
......................................................................
[W0074] refactor loop by any() call
Change-Id: I006a30786c22bd8f15b37d085c068760d3ca50f5
---
M pywikibot/page/__init__.py
M scripts/replace.py
2 files changed, 6 insertions(+), 10 deletions(-)
Approvals:
JJMC89: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index 69df5ea..cf96533 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -734,9 +734,7 @@
static_keys = self.site.getmagicwords('staticredirect')
text = self.get(get_redirect=True, force=force)
if static_keys:
- for key in static_keys:
- if key in text:
- return True
+ return any(key in text for key in static_keys)
return False
def isCategoryRedirect(self) -> bool:
diff --git a/scripts/replace.py b/scripts/replace.py
index 4d7f372..12cf5fe 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -138,7 +138,7 @@
the top of the help.
"""
#
-# (C) Pywikibot team, 2004-2021
+# (C) Pywikibot team, 2004-2022
#
# Distributed under the terms of the MIT license.
#
@@ -467,9 +467,8 @@
:rtype: bool
"""
if 'text-contains' in self.exceptions:
- for exc in self.exceptions['text-contains']:
- if exc.search(text):
- return True
+ return any(exc.search(text)
+ for exc in self.exceptions['text-contains'])
return False
@@ -565,9 +564,8 @@
def isTextExcepted(self, original_text) -> bool:
"""Return True iff one of the exceptions applies for the given text."""
if 'text-contains' in self.exceptions:
- for exc in self.exceptions['text-contains']:
- if exc.search(original_text):
- return True
+ return any(exc.search(original_text)
+ for exc in self.exceptions['text-contains'])
return False
def apply_replacements(self, original_text, applied, page=None):
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/753038
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I006a30786c22bd8f15b37d085c068760d3ca50f5
Gerrit-Change-Number: 753038
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged