jenkins-bot has submitted this change and it was merged.
Change subject: Fix calling of getFilesFromAnHash, also pep8
......................................................................
Fix calling of getFilesFromAnHash, also pep8
Change-Id: I906d003dde9083cf18ccb443fca635b581992ba1
---
M pywikibot/site.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index b4357d6..c2889db 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -2947,14 +2947,14 @@
NOTE 2: it returns the image title WITHOUT the image namespace.
"""
- if hash_found == None: # If the hash is none return None and not continue
+ if hash_found is None: # If the hash is none return None and not continue
return None
return [image.title(withNamespace=False)
for image in self.allimages(sha1=hash_found)]
@deprecated('Site().getFilesFromAnHash')
def getImagesFromAnHash(self, hash_found=None):
- return self.getFilesFromAnHash(self, hash_found)
+ return self.getFilesFromAnHash(hash_found)
def upload(self, imagepage, source_filename=None, source_url=None,
--
To view, visit https://gerrit.wikimedia.org/r/78165
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I906d003dde9083cf18ccb443fca635b581992ba1
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
DrTrigon has submitted this change and it was merged.
Change subject: *solve error "ValueError: invalid literal for float(): N/A" *minor docu changes and clean-up
......................................................................
*solve error "ValueError: invalid literal for float(): N/A"
*minor docu changes and clean-up
Change-Id: I8e9854c003380523fc54aa4aab6160ef2316b736
---
M catimages.py
1 file changed, 16 insertions(+), 3 deletions(-)
Approvals:
DrTrigon: Verified; Looks good to me, approved
jenkins-bot: Verified
diff --git a/catimages.py b/catimages.py
index 10b3376..acff497 100644
--- a/catimages.py
+++ b/catimages.py
@@ -2703,9 +2703,10 @@
result.append({ 'ID': int(s["index"]) + 1,
'Format': u'%s/%s' % (s["codec_type"], s.get("codec_name",u'?')),
- 'Rate': rate or u'-',
+ 'Rate': rate or None,
'Dimensions': dim or (None, None),
- 'Duration': float(s['duration']),
+ 'Duration': None if (s['duration'].lower() == 'n/a')
+ else float(s['duration']),
})
if 'image' in d["format"]["format_name"]:
@@ -3826,6 +3827,18 @@
return (tagged, logged)
def _make_infoblock(self, cat, res, tmpl_available=None):
+ """ Create infoblocks for pasting into wikitext from Templates
+ available on the wiki.
+
+ Nested values are flattened and numbered for output. Invalid or
+ unknown values can be marked e.g. by using u'-' or None.
+ Values like None, [] (empty list), ... that resolve by bool() to
+ False are hidden/omitted and not outputted at all. Unknown values
+ should be hidden to save space (make human readable) and be handled
+ by the Templates.
+ Unknown values that are NEEDED should be set to u'-' everything
+ else (not needed) to None, [] and so on.
+ """
if not res:
return u''
@@ -3852,7 +3865,7 @@
for item in res:
result.append( u" {{FileContentsByBot/%s" % cat )
for key in titles:
- if item[key]: # (work-a-round for empty 'Eyes')
+ if item[key]: # hide/omit (work-a-round for empty 'Eyes')
result.append( self._output_format_flatten(key, item[key]) )
result.append( u" }}" )
result.append( u"}}" )
--
To view, visit https://gerrit.wikimedia.org/r/77638
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8e9854c003380523fc54aa4aab6160ef2316b736
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: DrTrigon <dr.trigon(a)surfeu.ch>
Gerrit-Reviewer: DrTrigon <dr.trigon(a)surfeu.ch>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged.
Change subject: Add a family parameter to DataPage.interwiki so users can choose which links they want
......................................................................
Add a family parameter to DataPage.interwiki so users can choose which links they want
Change-Id: If1d0fb8fc902a1509fb964540c518b3d2d765376
---
M wikipedia.py
1 file changed, 10 insertions(+), 4 deletions(-)
Approvals:
Ladsgroup: Looks good to me, approved
Xqt: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/wikipedia.py b/wikipedia.py
index 3d4e924..ccdc5d7 100644
--- a/wikipedia.py
+++ b/wikipedia.py
@@ -4696,19 +4696,25 @@
def isEmpty(self):
return not self.exists()
- def interwiki(self):
+ def interwiki(self, family='wikipedia'):
"""Return a list of interwiki links from data repository.
The return value is a list of Page objects for each of the
interwiki links.
+ @param family: Which family of links to get
+ @type family: str
"""
+ if family == 'wikipedia':
+ suffix = 'wiki'
+ else:
+ suffix = family
links = self.get()['links']
- self._interwiki = [Page(getSite(code.replace('wiki',
+ self._interwiki = [Page(getSite(code.replace(suffix,
'').replace('_', '-'),
- fam='wikipedia'),
+ fam=family),
links[code]) for code in links
- if code.endswith('wiki')]
+ if code.endswith(suffix)]
return self._interwiki
def linktitles(self):
--
To view, visit https://gerrit.wikimedia.org/r/77159
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If1d0fb8fc902a1509fb964540c518b3d2d765376
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot