jenkins-bot has submitted this change and it was merged.
Change subject: code cleanup
......................................................................
code cleanup
- remove obsolete NothingFound class. This was previously used for compat's
-untagged option which retrieved image informations from toolserver
- remove nothing list and use strip() method instead to find empty descriptions
- remove return values in checkStep method. It is superfluous to "continue" a
loop as a last statement.
Change-Id: I3a5d2218b115c83db8c35b6fbc792f8b19bc9a10
---
M scripts/checkimages.py
1 file changed, 9 insertions(+), 18 deletions(-)
Approvals:
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 516efda..f478b9b 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -526,11 +526,6 @@
"""Log is full and the Bot cannot add other data to prevent Errors."""
-class NothingFound(pywikibot.Error):
-
- """Regex returned [] instead of results."""
-
-
def printWithTimeZone(message):
"""Print the messages followed by the TimeZone encoded correctly."""
if message[-1] != ' ':
@@ -1471,9 +1466,6 @@
def checkStep(self):
"""Check a single file page."""
- # nothing = Defining an empty image description
- nothing = ['', ' ', ' ', ' ', '\n', '\n ', '\n ', '\n\n', '\n \n',
- ' \n', ' \n ', ' \n \n']
# something = Minimal requirements for an image description.
# If this fits, no tagging will take place
# (if there aren't other issues)
@@ -1511,11 +1503,11 @@
except pywikibot.NoPage:
pywikibot.output(u"Skipping %s because it has been deleted."
% self.imageName)
- return True
+ return
except pywikibot.IsRedirectPage:
pywikibot.output(u"Skipping %s because it's a redirect."
% self.imageName)
- return True
+ return
# Delete the fields where the templates cannot be loaded
regex_nowiki = re.compile(r'<nowiki>(.*?)</nowiki>', re.DOTALL)
regex_pre = re.compile(r'<pre>(.*?)</pre>', re.DOTALL)
@@ -1525,7 +1517,7 @@
# in the image the original text will be reloaded, don't worry).
if self.isTagged():
printWithTimeZone(u'%s is already tagged...' % self.imageName)
- return True
+ return
# something is the array with {{, MIT License and so on.
for a_word in something:
@@ -1538,7 +1530,7 @@
(license_found, hiddenTemplateFound) = self.smartDetection()
# Here begins the check block.
if brackets and license_found:
- return True
+ return
elif delete:
pywikibot.output(u"%s is not a file!" % self.imageName)
if not di:
@@ -1555,8 +1547,8 @@
textlink=True)}
head = dih
self.report(canctext, self.imageName, notification, head)
- return True
- elif self.imageCheckText in nothing:
+ return
+ elif not self.imageCheckText.strip(): # empty image description
pywikibot.output(
u"The file's description for %s does not contain a license "
u" template!" % self.imageName)
@@ -1567,7 +1559,7 @@
head = nh
self.report(self.unvertext, self.imageName, notification, head,
smwl)
- return True
+ return
else:
pywikibot.output(u"%s has only text and not the specific license..."
% self.imageName)
@@ -1578,7 +1570,7 @@
head = nh
self.report(self.unvertext, self.imageName, notification, head,
smwl)
- return True
+ return
def main(*args):
@@ -1769,8 +1761,7 @@
if duplicatesActive:
if not Bot.checkImageDuplicated(duplicates_rollback):
continue
- if Bot.checkStep():
- continue
+ Bot.checkStep()
if repeat:
pywikibot.output(u"Waiting for %s seconds," % time_sleep)
--
To view, visit https://gerrit.wikimedia.org/r/263361
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3a5d2218b115c83db8c35b6fbc792f8b19bc9a10
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: listpages.py: Fix help docstring
......................................................................
listpages.py: Fix help docstring
Replace -dir with -save in docstring.
Change-Id: Ic17d6255a532c3959ac0924314fe2f01f4d53ea6
---
M scripts/listpages.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/listpages.py b/scripts/listpages.py
index 8c3c8f7..cb3352c 100755
--- a/scripts/listpages.py
+++ b/scripts/listpages.py
@@ -43,7 +43,7 @@
-get Page content is printed.
-save Save Page content to a file named as page.title(as_filename=True).
- Directory can be set with -dir:dir_name
+ Directory can be set with -save:dir_name
If no dir is specified, current direcory will be used.
-encode File encoding can be specified with '-encode:name' (name must be a
--
To view, visit https://gerrit.wikimedia.org/r/265926
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic17d6255a532c3959ac0924314fe2f01f4d53ea6
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: movepages.py: prevent error message with from/to
......................................................................
movepages.py: prevent error message with from/to
Prevent to display error message:
ERROR: Unable to execute script because no generator was defined.
when -from -to are used to specify input.
Change-Id: I96a3cea2f0fd959379a0fc67d8ed5c978217eda1
---
M scripts/movepages.py
1 file changed, 4 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/movepages.py b/scripts/movepages.py
index 00336b7..b276b9c 100755
--- a/scripts/movepages.py
+++ b/scripts/movepages.py
@@ -274,10 +274,12 @@
bot = MovePagesBot(preloadingGen, **options)
bot.run()
return True
- else:
- # in theory pairs could be missing too
+
+ if not fromToPairs:
pywikibot.bot.suggest_help(missing_generator=True)
return False
+ else:
+ return True
if __name__ == '__main__':
main()
--
To view, visit https://gerrit.wikimedia.org/r/265639
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I96a3cea2f0fd959379a0fc67d8ed5c978217eda1
Gerrit-PatchSet: 4
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Allow Coordinate.precision to be None
......................................................................
Allow Coordinate.precision to be None
Wikibase has coordinates without a precision.
They cause an exception when saving unmodified.
Also add a setter for Coordinate.precision, so
existing data without a precision can be improved.
Bug: T123910
Change-Id: I9ce758c7271c78ba9b97bf2f52b4b34160d935e1
---
M pywikibot/__init__.py
1 file changed, 12 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index c2f4dd5..d3353d4 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -331,6 +331,11 @@
u"""
Return the precision of the geo coordinate.
+ The precision is calculated if the Coordinate does not have a precision,
+ and self._dim is set.
+
+ When no precision and no self._dim exists, None is returned.
+
The biggest error (in degrees) will be given by the longitudinal error;
the same error in meters becomes larger (in degrees) further up north.
We can thus ignore the latitudinal error.
@@ -346,13 +351,19 @@
Therefore::
precision = math.degrees(self._dim/(radius*math.cos(math.radians(self.lat))))
+
+ @rtype: float or None
"""
- if not self._precision:
+ if self._precision is None and self._dim is not None:
radius = 6378137 # TODO: Support other globes
self._precision = math.degrees(
self._dim / (radius * math.cos(math.radians(self.lat))))
return self._precision
+ @precision.setter
+ def precision(self, value):
+ self._precision = value
+
def precisionToDim(self):
"""Convert precision from Wikibase to GeoData's dim."""
raise NotImplementedError
--
To view, visit https://gerrit.wikimedia.org/r/264740
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9ce758c7271c78ba9b97bf2f52b4b34160d935e1
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>