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 <>