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
Hello PywikibotCommitWatcher,
I'd like you to do a code review. Please visit
https://gerrit.wikimedia.org/r/76317
to review the following change.
Change subject: bug fix; solve bug introduced by r11524 and reported by totoazero and xqt
......................................................................
bug fix; solve bug introduced by r11524 and reported by totoazero and xqt
Change-Id: I30c0efab5cb2c3dfc0cb574792e7a17a5a00e2a3
---
M externals/__init__.py
1 file changed, 15 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/compat refs/changes/17/76317/1
diff --git a/externals/__init__.py b/externals/__init__.py
index dfd4f20..7b18c26 100644
--- a/externals/__init__.py
+++ b/externals/__init__.py
@@ -279,14 +279,21 @@
return False
else:
files = dependency_dictionary[distro]
- if files and show_question(files):
- callable_ = globals()[distro.replace('-', '_') + '_install']
+ func = distro.replace('-', '_') + '_install'
+ if files and (func in globals()) and show_question(files):
+ callable_ = globals()[func]
return callable_(files)
else:
return False
+def sunos_install(dependency_dictionary):
+ lowlevel_warning(u'Not implemented yet, download mode will be used.')
+ return False # skip this in order to trigger 'download_install' next
+
+
def windows_install(dependency_dictionary):
+ lowlevel_warning(u'Not available in windows OS, download mode will be used.')
return False # skip this in order to trigger 'download_install' next
### END of VisTrails inspired and copied code ### ### ### ### ### ### ### ###
@@ -373,11 +380,15 @@
return
# install the missing module
- dist = guess_system().split(u'-')
- if globals()[dist[0] + '_install'](modules_needed[m][0]):
+ dist = guess_system()
+ func = dist.split(u'-')[0] + '_install'
+ lowlevel_warning(u'Trying to install by use of "%s" package management system:' % dist)
+ if (func in globals()) and globals()[func](modules_needed[m][0]):
return
+ lowlevel_warning(u'Trying to install by download from source URL:')
if download_install(modules_needed[m][1], m, path):
return
+ lowlevel_warning(u'Trying to install by use of mercurial:')
if (len(modules_needed[m]) > 2) and\
mercurial_repo_install(modules_needed[m][2], m, path):
return
--
To view, visit https://gerrit.wikimedia.org/r/76317
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I30c0efab5cb2c3dfc0cb574792e7a17a5a00e2a3
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: DrTrigon <dr.trigon(a)surfeu.ch>
Gerrit-Reviewer: PywikibotCommitWatcher <pywikibot-commits(a)lists.wikimedia.org>
Gerrit-Reviewer: Toto Azéro <totoazero(a)yahoo.fr>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
DrTrigon has submitted this change and it was merged.
Change subject: .pep8: ignore E122 "continuation line missing ..."
......................................................................
.pep8: ignore E122 "continuation line missing ..."
E122 continuation line missing indentation or outdented disallows the
following:
pywikibot.output(
u"...some long text that really doesn't fit on the same line"
)
because the text is outdented compared to the original function call.
Change-Id: I1457f2d3e8cbeacd9bee9fa10fa7924e8dfb949a
---
M .pep8
1 file changed, 1 insertion(+), 0 deletions(-)
Approvals:
DrTrigon: Checked; Looks good to me, approved
diff --git a/.pep8 b/.pep8
index 4827278..e52a001 100644
--- a/.pep8
+++ b/.pep8
@@ -1,3 +1,4 @@
[pep8]
+ignore = E122
exclude = distribute_setup.py,externals,user-config.py,./scripts/i18n/*,./pywikibot/date.py
max_line_length = 256
--
To view, visit https://gerrit.wikimedia.org/r/76731
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1457f2d3e8cbeacd9bee9fa10fa7924e8dfb949a
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
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