jenkins-bot has submitted this change and it was merged.
Change subject: Progressing dots to show test is running
......................................................................
Progressing dots to show test is running
- register all tests in different instances and run them
separately
Change-Id: I30a7256f2b87e7e8a348731526e2d36b42a86f9a
---
M tests/date_tests.py
1 file changed, 34 insertions(+), 20 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/date_tests.py b/tests/date_tests.py
index 730c5b3..835f38b 100644
--- a/tests/date_tests.py
+++ b/tests/date_tests.py
@@ -13,31 +13,45 @@
class TestDate(unittest.TestCase):
"""Test cases for date library"""
- def testMapEntry(self):
- """Test the validity of the pywikibot.date format maps."""
- for formatName in date.formats:
- step = 1
- if formatName in date.decadeFormats:
- step = 10
- predicate, start, stop = date.formatLimits[formatName]
+ def __init__(self, formatname):
+ super(TestDate, self).__init__()
+ self.formatname = formatname
- for code, convFunc in date.formats[formatName].items():
- for value in range(start, stop, step):
- self.assertTrue(
- predicate(value),
- "date.formats['%(formatName)s']['%(code)s']:\n"
- "invalid value %(value)d" % locals())
+ def testMapEntry(self, formatname):
+ """The test ported from date.py"""
+ step = 1
+ if formatname in date.decadeFormats:
+ step = 10
+ predicate, start, stop = date.formatLimits[formatname]
- newValue = convFunc(convFunc(value))
- self.assertEqual(
- newValue, value,
- "date.formats['%(formatName)s']['%(code)s']:\n"
- "value %(newValue)d does not match %(value)s"
- % locals())
+ for code, convFunc in date.formats[formatname].items():
+ for value in range(start, stop, step):
+ self.assertTrue(
+ predicate(value),
+ "date.formats['%(formatname)s']['%(code)s']:\n"
+ "invalid value %(value)d" % locals())
+
+ newValue = convFunc(convFunc(value))
+ self.assertEqual(
+ newValue, value,
+ "date.formats['%(formatname)s']['%(code)s']:\n"
+ "value %(newValue)d does not match %(value)s"
+ % locals())
+
+ def runTest(self):
+ """method called by unittest"""
+ self.testMapEntry(self.formatname)
+
+
+def suite():
+ """Setup the test suite and register all test to different instances"""
+ suite = unittest.TestSuite()
+ suite.addTests(TestDate(formatname) for formatname in date.formats)
+ return suite
if __name__ == '__main__':
try:
- unittest.main()
+ unittest.TextTestRunner().run(suite())
except SystemExit:
pass
--
To view, visit https://gerrit.wikimedia.org/r/136035
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I30a7256f2b87e7e8a348731526e2d36b42a86f9a
Gerrit-PatchSet: 4
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
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: Provide correct instuctions on how to use a proxy
......................................................................
Provide correct instuctions on how to use a proxy
The instructions result in a console warning, which can be removed
by using 'del' after declaring the proxy.
httplib2 v0.7 and above include SocksiPy
Change-Id: Ib92fb5e1d0ca135d529566b7f4ea225d648acac7
---
M pywikibot/config2.py
1 file changed, 5 insertions(+), 9 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 18b9ca6..87883fe 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -587,15 +587,11 @@
# Proxy configuration
-# assign prox = None to connect directly
-# For proxy support first run: apt-get install python-socks.py
-# then change your user-config.py like:
-# import httplib2
-# import socks
-# proxy = httplib2.ProxyInfo(socks.PROXY_TYPE_HTTP, 'localhost', 8000)
-# The following lines will be printed, but it works:
-# Configuration variable 'httplib2' is defined but unknown. Misspelled?
-# Configuration variable 'socks' is defined but unknown. Misspelled?proxy = None
+# For proxy support, install socksipy or httplib2 0.7+
+# then add these three lines to your user-config.py:
+# from httplib2 import ProxyInfo, socks
+# proxy = ProxyInfo(socks.PROXY_TYPE_HTTP, 'localhost', 8000)
+# del ProxyInfo, socks
proxy = None
# Simulate settings
--
To view, visit https://gerrit.wikimedia.org/r/137273
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib92fb5e1d0ca135d529566b7f4ea225d648acac7
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(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 <>
jenkins-bot has submitted this change and it was merged.
Change subject: pep257: write docstrings as a command
......................................................................
pep257: write docstrings as a command
documented for one-line docstrings:
http://legacy.python.org/dev/peps/pep-0257/#one-line-docstrings
this commit *only* concerns 3rd-person forms
to reduce changes to a minimum:
even obvious typos within the same docstrings have *not* been fixed
Change-Id: I8c6e51e02904d499f30f51fe063d1b2e17ea7f67
---
M pywikibot/__init__.py
M pywikibot/data/api.py
M pywikibot/date.py
M pywikibot/family.py
M pywikibot/i18n.py
M pywikibot/page.py
M pywikibot/pagegenerators.py
M pywikibot/site.py
M pywikibot/titletranslate.py
M pywikibot/xmlreader.py
M scripts/archivebot.py
M scripts/category.py
M scripts/commonscat.py
M scripts/delete.py
M scripts/flickrripper.py
M scripts/imagetransfer.py
M scripts/newitem.py
M scripts/protect.py
M scripts/reflinks.py
M scripts/template.py
M scripts/weblinkchecker.py
M tests/date_tests.py
22 files changed, 42 insertions(+), 42 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index a774f33..7826fec 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -63,11 +63,11 @@
return cls.strptime(ts, cls.mediawikiTSFormat)
def toISOformat(self):
- """Converts the Timestamp object to an ISO 8601 timestamp"""
+ """Convert the Timestamp object to an ISO 8601 timestamp"""
return self.strftime(self.ISO8601Format)
def totimestampformat(self):
- """Converts the Timestamp object to the internal MediaWiki timestamp format."""
+ """Convert the Timestamp object to the internal MediaWiki timestamp format."""
return self.strftime(self.mediawikiTSFormat)
def __str__(self):
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index d82e1a9..47e7912 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -477,7 +477,7 @@
return dt + self.expiry < datetime.datetime.now()
def _load_cache(self):
- """ Returns whether the cache can be used """
+ """ Return whether the cache can be used """
try:
with open(self._cachefile_path(), 'rb') as f:
uniquedescr, self._data, self._cachetime = pickle.load(f)
@@ -924,7 +924,7 @@
class LoginManager(login.LoginManager):
- """Supplies getCookie() method to use API interface."""
+ """Supply getCookie() method to use API interface."""
def getCookie(self, remember=True, captchaId=None, captchaAnswer=None):
"""Login to the site.
diff --git a/pywikibot/date.py b/pywikibot/date.py
index a1b85ad..4e6de5a 100644
--- a/pywikibot/date.py
+++ b/pywikibot/date.py
@@ -332,7 +332,7 @@
def escapePattern2(pattern):
- """Converts a string pattern into a regex expression and cache.
+ """Convert a string pattern into a regex expression and cache.
Allows matching of any _digitDecoders inside the string.
Returns a compiled regex object and a list of digit decoders
@@ -1953,7 +1953,7 @@
def makeMonthNamedList(lang, pattern, makeUpperCase=None):
- """Creates a list of 12 elements based on the name of the month.
+ """Create a list of 12 elements based on the name of the month.
The language-dependent month name is used as a formating argument to the
pattern. The pattern must be have one %s that will be replaced by the
localized month name.
@@ -2279,12 +2279,12 @@
def getNumberOfDaysInMonth(month):
- """Returns the number of days in a given month, 1 being January, etc."""
+ """Return the number of days in a given month, 1 being January, etc."""
return formatLimits[dayMnthFmts[month-1]][2]-1
def getAutoFormat(lang, title, ignoreFirstLetterCase=True):
- """Returns (dictName,value), where value can be a year, date, etc, and
+ """Return (dictName,value), where value can be a year, date, etc, and
dictName is 'YearBC', 'December', etc.
"""
diff --git a/pywikibot/family.py b/pywikibot/family.py
index 75ed448..ceeacc7 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -1045,12 +1045,12 @@
return True
def post_get_convert(self, site, getText):
- """Does a conversion on the retrieved text from the wiki
+ """Do a conversion on the retrieved text from the wiki
i.e. Esperanto X-conversion """
return getText
def pre_put_convert(self, site, putText):
- """Does a conversion on the text to insert on the wiki
+ """Do a conversion on the text to insert on the wiki
i.e. Esperanto X-conversion """
return putText
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index a7dd59b..c204121 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -337,7 +337,7 @@
def twtranslate(code, twtitle, parameters=None):
- """ Uses TranslateWiki files to provide translations based on the TW title
+ """ Use TranslateWiki files to provide translations based on the TW title
twtitle, which corresponds to a page on TW.
@param code The language code
@@ -465,7 +465,7 @@
def twhas_key(code, twtitle):
- """ Uses TranslateWiki files to to check whether specified translation
+ """ Use TranslateWiki files to to check whether specified translation
based on the TW title is provided. No code fallback is made.
@param code The language code
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 01efdf2..bb120c6 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -740,7 +740,7 @@
)
def protection(self):
- """Returns a dictionary reflecting page protections"""
+ """Return a dictionary reflecting page protections"""
return self.site.page_restrictions(self)
def canBeEdited(self):
@@ -1325,7 +1325,7 @@
@deprecate_arg("throttle", None)
def delete(self, reason=None, prompt=True, mark=False):
- """Deletes the page from the wiki. Requires administrator status.
+ """Delete the page from the wiki. Requires administrator status.
@param reason: The edit summary for the deletion, or rationale
for deletion if requesting. If None, ask for it.
@@ -3033,7 +3033,7 @@
self.sources.remove(source_dict)
def addQualifier(self, qualifier, **kwargs):
- """Adds the given qualifier
+ """Add the given qualifier
@param qualifier: the qualifier to add
@type qualifier: Claim
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 87472d0..c1a9aa7 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -819,7 +819,7 @@
def RedirectFilterPageGenerator(generator, no_redirects=True):
- """Yields pages from another generator that are redirects or not."""
+ """Yield pages from another generator that are redirects or not."""
for page in generator:
if not page.isRedirectPage() and no_redirects:
yield page
@@ -1163,7 +1163,7 @@
def LinksearchPageGenerator(link, namespaces=None, step=None, total=None,
site=None):
- """Yields all pages that include a specified link, according to
+ """Yield all pages that include a specified link, according to
[[Special:Linksearch]].
"""
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 8d9faeb..2d2d243 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -898,7 +898,7 @@
return group.lower() in self._userinfo['groups']
def messages(self, sysop=False):
- """Returns true if the user has new messages, and false otherwise."""
+ """Return true if the user has new messages, and false otherwise."""
if not self.logged_in(sysop):
self.login(sysop)
return 'hasmsg' in self._userinfo
@@ -1013,7 +1013,7 @@
return msgs['comma-separator'].join(args[:-2] + [concat.join(args[-2:])])
def expand_text(self, text, title=None, includecomments=None):
- """ Parses the given text for preprocessing and rendering
+ """ Parse the given text for preprocessing and rendering
e.g expand templates and strip comments if includecomments
parameter is not True. Keeps text inside
<nowiki></nowiki> tags unchanges etc. Can be used to parse
@@ -1394,7 +1394,7 @@
return page._pageid > 0
def page_restrictions(self, page):
- """Returns a dictionary reflecting page protections"""
+ """Return a dictionary reflecting page protections"""
if not self.page_exists(page):
raise NoPage(page)
if not hasattr(page, "_protection"):
@@ -3680,7 +3680,7 @@
return data['entities']
def preloaditempages(self, pagelist, groupsize=50):
- """Yields ItemPages with content prefilled.
+ """Yield ItemPages with content prefilled.
Note that pages will be iterated in a different order
than in the underlying pagelist.
diff --git a/pywikibot/titletranslate.py b/pywikibot/titletranslate.py
index 2a9bae6..891f7c9 100644
--- a/pywikibot/titletranslate.py
+++ b/pywikibot/titletranslate.py
@@ -122,7 +122,7 @@
def getPoisonedLinks(pl):
- """Returns a list of known corrupted links that should be removed if seen
+ """Return a list of known corrupted links that should be removed if seen
"""
result = []
diff --git a/pywikibot/xmlreader.py b/pywikibot/xmlreader.py
index 7b08695..55191ad 100644
--- a/pywikibot/xmlreader.py
+++ b/pywikibot/xmlreader.py
@@ -157,7 +157,7 @@
self.restrictions)
def _create_revision(self, revision):
- """Creates a Single revision"""
+ """Create a Single revision"""
revisionid = revision.findtext("{%s}id" % self.uri)
timestamp = revision.findtext("{%s}timestamp" % self.uri)
comment = revision.findtext("{%s}comment" % self.uri)
diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index e9a8c9b..7ed36d9 100644
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -255,7 +255,7 @@
self.header = self.header % self.vars
def load_page(self):
- """Loads the page to be archived and breaks it up into threads."""
+ """Load the page to be archived and break it up into threads."""
self.header = ''
self.threads = []
self.archives = {}
diff --git a/scripts/category.py b/scripts/category.py
index 7468a48..749b693 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -409,7 +409,7 @@
def __init__(self, oldcat, newcat=None, batch=False, comment='',
inplace=False, move_oldcat=True, delete_oldcat=True,
title_regex=None, history=False, pagesonly=False):
- """Stores all given parameters in the objects attributes.
+ """Store all given parameters in the objects attributes.
@param oldcat: The move source.
@param newcat: The move target.
@@ -907,7 +907,7 @@
return result
def run(self):
- """Prints the multi-line string generated by treeview or saves it to a
+ """Print the multi-line string generated by treeview or save it to a
file.
Parameters:
diff --git a/scripts/commonscat.py b/scripts/commonscat.py
index 04569f1..de2ba91 100755
--- a/scripts/commonscat.py
+++ b/scripts/commonscat.py
@@ -246,7 +246,7 @@
self.treat(page)
def treat(self, page):
- """ Loads the given page, does some changes, and saves it. """
+ """ Load the given page, do some changes, and save it. """
if not page.exists():
pywikibot.output(u'Page %s does not exist. Skipping.'
% page.title(asLink=True))
@@ -264,7 +264,7 @@
return
def load(self, page):
- """ Loads the given page, does some changes, and saves it. """
+ """ Load the given page, do some changes, and save it. """
try:
text = page.get()
except pywikibot.NoPage:
diff --git a/scripts/delete.py b/scripts/delete.py
index e287ec9..bbce21b 100644
--- a/scripts/delete.py
+++ b/scripts/delete.py
@@ -59,7 +59,7 @@
self.undelete = undelete
def run(self):
- """ Starts the robot's action:
+ """ Start the robot's action:
Loop through everything in the page generator and delete it.
"""
diff --git a/scripts/flickrripper.py b/scripts/flickrripper.py
index d66902b..a72d150 100644
--- a/scripts/flickrripper.py
+++ b/scripts/flickrripper.py
@@ -119,7 +119,7 @@
def findDuplicateImages(photo=None,
site=pywikibot.Site(u'commons', u'commons')):
- """ Takes the photo, calculates the SHA1 hash and asks the mediawiki api
+ """ Take the photo, calculate the SHA1 hash and ask the mediawiki api
for a list of duplicates.
TODO: Add exception handling, fix site thing
diff --git a/scripts/imagetransfer.py b/scripts/imagetransfer.py
index ec8d992..ee869f4 100644
--- a/scripts/imagetransfer.py
+++ b/scripts/imagetransfer.py
@@ -161,9 +161,9 @@
self.keep_name = keep_name
def transferImage(self, sourceImagePage):
- """Gets a wikilink to an image, downloads it and its description,
- and uploads it to another wikipedia.
- Returns the filename which was used to upload the image
+ """Get a wikilink to an image, download it and its description,
+ and upload it to another wikipedia.
+ Return the filename which was used to upload the image
This function is used by imagetransfer.py and by copy_table.py
"""
diff --git a/scripts/newitem.py b/scripts/newitem.py
index c49b4cf..eefcf4b 100644
--- a/scripts/newitem.py
+++ b/scripts/newitem.py
@@ -52,7 +52,7 @@
self.lastEditBefore = self.repo.getcurrenttime() - timedelta(days=self.lastEdit)
def run(self):
- """ Starts the bot. """
+ """ Start the bot. """
pywikibot.output('Page age is set to %s days so only pages created'
'\nbefore %s will be considered.'
% (self.pageAge, self.pageAgeBefore.isoformat()))
diff --git a/scripts/protect.py b/scripts/protect.py
index c9fc499..9f2c383 100644
--- a/scripts/protect.py
+++ b/scripts/protect.py
@@ -81,7 +81,7 @@
self.move = move
def run(self):
- """ Starts the bot's action.
+ """ Start the bot's action.
Loop through everything in the page generator and (un)protect it.
"""
diff --git a/scripts/reflinks.py b/scripts/reflinks.py
index cbe96fa..089ef3a 100644
--- a/scripts/reflinks.py
+++ b/scripts/reflinks.py
@@ -214,7 +214,7 @@
self.title = None
def refTitle(self):
- """Returns the <ref> with its new title"""
+ """Return the <ref> with its new title"""
return '<ref%s>[%s %s<!-- %s -->]</ref>' % (self.refname, self.link,
self.title,
self.linkComment)
@@ -441,7 +441,7 @@
r'application/(?:xhtml\+xml|xml)|text/(?:ht|x)ml')
def put_page(self, page, new):
- """ Prints diffs between orginal and new (text), puts new text for page
+ """ Print diffs between orginal and new (text), put new text for page
"""
pywikibot.output(u"\n\n>>> \03{lightpurple}%s\03{default} <<<"
@@ -512,7 +512,7 @@
os.unlink(infile)
def run(self):
- """ Runs the Bot """
+ """ Run the Bot """
try:
deadLinks = codecs.open(listof404pages, 'r', 'latin_1').read()
except IOError:
diff --git a/scripts/template.py b/scripts/template.py
index 707716a..02d45f9 100755
--- a/scripts/template.py
+++ b/scripts/template.py
@@ -236,7 +236,7 @@
site, 'template-changing', Param)
def run(self):
- """Starts the robot's action."""
+ """Start the robot's action."""
# regular expression to find the original template.
# {{vfd}} does the same thing as {{Vfd}}, so both will be found.
# The old syntax, {{msg:vfd}}, will also be found.
diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py
index f58c326..3ee013e 100644
--- a/scripts/weblinkchecker.py
+++ b/scripts/weblinkchecker.py
@@ -507,7 +507,7 @@
class History:
- """ Stores previously found dead links. The URLs are dictionary keys, and
+ """ Store previously found dead links. The URLs are dictionary keys, and
values are lists of tuples where each tuple represents one time the URL was
found dead. Tuples have the form (title, date, error) where title is the
wiki page where the URL was found, date is an instance of time, and error is
@@ -617,7 +617,7 @@
return False
def save(self):
- """ Saves the .dat file to disk. """
+ """ Save the .dat file to disk. """
datfile = open(self.datfilename, 'w')
pickle.dump(self.historyDict, datfile)
datfile.close()
diff --git a/tests/date_tests.py b/tests/date_tests.py
index 2483d33..730c5b3 100644
--- a/tests/date_tests.py
+++ b/tests/date_tests.py
@@ -14,7 +14,7 @@
"""Test cases for date library"""
def testMapEntry(self):
- """Tests the validity of the pywikibot.date format maps."""
+ """Test the validity of the pywikibot.date format maps."""
for formatName in date.formats:
step = 1
if formatName in date.decadeFormats:
--
To view, visit https://gerrit.wikimedia.org/r/137091
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8c6e51e02904d499f30f51fe063d1b2e17ea7f67
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Russell Blau <russblau(a)imapmail.org>
Gerrit-Reviewer: Siebrand <siebrand(a)kitano.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: code cleanup, nothing to import
......................................................................
code cleanup, nothing to import
remove obsolete doc strings
Change-Id: I0db93ff68cc1a80bbe4efa2110907dd624cf9f89
---
M pywikibot/data/__init__.py
1 file changed, 1 insertion(+), 4 deletions(-)
Approvals:
Ricordisamoa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/__init__.py b/pywikibot/data/__init__.py
index 93e17a7..5b530da 100644
--- a/pywikibot/data/__init__.py
+++ b/pywikibot/data/__init__.py
@@ -3,11 +3,8 @@
The "data" module provides several physical layers of data access to the wiki.
"""
#
-# (C) Pywikipedia bot team, 2007
+# (C) Pywikibot team, 2007-2014
#
# Distributed under the terms of the MIT license.
#
__version__ = '$Id$'
-
-# Import the classes exposed by this module:
-# TODO
--
To view, visit https://gerrit.wikimedia.org/r/136987
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0db93ff68cc1a80bbe4efa2110907dd624cf9f89
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: Russell Blau <russblau(a)imapmail.org>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: add ability for custom module name in pywikibot.showHelp
......................................................................
add ability for custom module name in pywikibot.showHelp
Change-Id: I37b5f521d508be12bc1a787eb89ebdef10824e63
---
M pywikibot/bot.py
1 file changed, 10 insertions(+), 10 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 2e7e859..2c2e2b5 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -662,14 +662,14 @@
return nonGlobalArgs
-def showHelp(name=""):
- # argument, if given, is ignored
- modname = calledModuleName()
- if not modname:
+def showHelp(module_name=None):
+ if not module_name:
+ module_name = calledModuleName()
+ if not module_name:
try:
- modname = sys.modules['__main__'].main.__module__
+ module_name = sys.modules['__main__'].main.__module__
except NameError:
- modname = "no_module"
+ module_name = "no_module"
globalHelp = u'''
Global arguments available for all bots:
@@ -727,17 +727,17 @@
-<config var>:n You may use all given numeric config variables as option and
modify it with command line.
-''' % modname
+''' % module_name
try:
- module = __import__('%s' % modname)
+ module = __import__('%s' % module_name)
helpText = module.__doc__.decode('utf-8')
if hasattr(module, 'docuReplacements'):
for key, value in module.docuReplacements.items():
helpText = helpText.replace(key, value.strip('\n\r'))
pywikibot.stdout(helpText) # output to STDOUT
except Exception:
- if modname:
- pywikibot.stdout(u'Sorry, no help available for %s' % modname)
+ if module_name:
+ pywikibot.stdout(u'Sorry, no help available for %s' % module_name)
pywikibot.log('showHelp:', exc_info=True)
pywikibot.stdout(globalHelp)
--
To view, visit https://gerrit.wikimedia.org/r/136637
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I37b5f521d508be12bc1a787eb89ebdef10824e63
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Pyfisch <pyfisch(a)gmail.com>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Remove outdated INSTALL instructions
......................................................................
Remove outdated INSTALL instructions
Change-Id: If61688ffa6a5705ceace4a333241721b06e4832b
---
D INSTALL
1 file changed, 0 insertions(+), 21 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index 86a5a28..0000000
--- a/INSTALL
+++ /dev/null
@@ -1,21 +0,0 @@
-To install the Pywikibot framework:
-
-1) Extract/unzip this package to a directory on your computer.
-2) Open a command prompt in that directory, and run the command:
-
- python setup.py install
-
-This will install the package to the "site-packages" directory of your Python
-installation. Linux/Unix users may need to add "sudo" at the beginning of the
-command line to get access to the site-packages directory; or, they can
-install the package to a different location by running:
-
- python setup.py install --home=/path/to/location
-
-where "/path/to/location" is the directory that you want the Pywikibot
-files installed to.
-
-Note: You will need to have an active Internet connection when you run the
-setup script, in case the installer needs to download other modules required
-by the framework.
-
--
To view, visit https://gerrit.wikimedia.org/r/136809
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If61688ffa6a5705ceace4a333241721b06e4832b
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Ladsgroup <ladsgroup(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: Just a hint: use compat2core as a helper script
......................................................................
Just a hint: use compat2core as a helper script
Change-Id: Ic50abd7f111d6f68a6aa4339b2bde90140aee846
---
M README-conversion.txt
1 file changed, 11 insertions(+), 5 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/README-conversion.txt b/README-conversion.txt
index 1ca732d..e229ab0 100644
--- a/README-conversion.txt
+++ b/README-conversion.txt
@@ -14,11 +14,12 @@
scripts to the new interface simply by changing import statements and doing
global search-and-replace on module names, as discussed in this document.
-With pywikipedia scripts were importing "wikipedia" or "pagegenerators"
-libraries; pywikibot is now written as a standard package, and other modules
-are contained within it (e.g., pywikibot.site contains Site classes). However,
-most commonly-used names are imported into the pywikibot namespace, so that
-module names don't need to be used unless specified in the documentation.
+With pywikibot compat branch scripts were importing "wikipedia" or
+"pagegenerators" libraries; pywikibot is now written as a standard package,
+and other modules are contained within it (e.g., pywikibot.site contains Site
+classes). However, most commonly-used names are imported into the pywikibot
+namespace, so that module names don't need to be used unless specified in the
+documentation.
Make sure that the directory that contains the "pywikibot" subdirectory (or
folder) is in sys.path.
@@ -36,6 +37,11 @@
wikipedia.setAction() no longer works; you must revise the script to pass an
explicit edit summary message on each put() or put_async() call.
+There is a helper script which does a lot of changes automatically.
+Just call it:
+pwb.py maintenance/compat2core [<script to convert>]
+and follow the instructions and hints.
+
== Python librairies ==
[Note: the goal will be to package pywikibot with setuptools easy_install,
--
To view, visit https://gerrit.wikimedia.org/r/136722
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic50abd7f111d6f68a6aa4339b2bde90140aee846
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Pyfisch <pyfisch(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>