jenkins-bot has submitted this change and it was merged.

Change subject: [IMPROV] Added some docstrings
......................................................................


[IMPROV] Added some docstrings

Change-Id: Ie5633447090ddfcf201ed38d7fea111a450c7177
---
M pywikibot/bot.py
M pywikibot/comms/http.py
M pywikibot/compat/catlib.py
M pywikibot/compat/query.py
M pywikibot/diff.py
M pywikibot/families/test_family.py
M pywikibot/page.py
M pywikibot/throttle.py
M pywikibot/tools.py
9 files changed, 32 insertions(+), 0 deletions(-)

Approvals:
  John Vandenberg: Looks good to me, approved
  Unicodesnowman: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index ddfbbc9..21eb4a4 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1133,6 +1133,7 @@
     """
 
     def __init__(self, **kwargs):
+        """Constructor."""
         super(WikidataBot, self).__init__(**kwargs)
         self.site = pywikibot.Site()
         self.repo = self.site.data_repository()
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index ad2e2e8..444f3c7 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -166,6 +166,17 @@
 
 
 def user_agent(site=None, format_string=None):
+    """
+    Generate the user agent string for a given site and format.
+
+    @param site: The site for which this user agent is intended. May be None.
+    @type site: BaseSite
+    @param format_string: The string to which the values will be added using
+        str.format. Is using config.user_agent_format when it is None.
+    @type format_string: basestring
+    @return: The formatted user agent
+    @rtype: unicode
+    """
     values = USER_AGENT_PRODUCTS.copy()
 
     # This is the Pywikibot revision; also map it to {version} at present.
diff --git a/pywikibot/compat/catlib.py b/pywikibot/compat/catlib.py
index d4f7b48..f329b21 100644
--- a/pywikibot/compat/catlib.py
+++ b/pywikibot/compat/catlib.py
@@ -20,6 +20,7 @@
 
 def change_category(article, oldCat, newCat, comment=None, sortKey=None,
                     inPlace=True):
+    """Change the category of the article."""
     return article.change_category(oldCat, newCat, comment, sortKey, inPlace)
 
 __all__ = ('Category', 'change_category',)
diff --git a/pywikibot/compat/query.py b/pywikibot/compat/query.py
index fe02c99..46e9976 100644
--- a/pywikibot/compat/query.py
+++ b/pywikibot/compat/query.py
@@ -23,6 +23,11 @@
 @deprecate_arg("retryCount", None)
 @deprecate_arg("encodeTitle", None)
 def GetData(request, site=None, back_response=False):
+    """
+    Query the server with the given request dict.
+
+    DEPRECATED: Use pywikibot.data.api.Request instead.
+    """
     if site:
         request['site'] = site
 
diff --git a/pywikibot/diff.py b/pywikibot/diff.py
index a93a90b..09fdfdf 100644
--- a/pywikibot/diff.py
+++ b/pywikibot/diff.py
@@ -158,6 +158,7 @@
         return self.b[self.b_rng[0]:self.b_rng[1]]
 
     def __str__(self):
+        """Return the diff as plain text."""
         return u''.join(self.diff_plain_text)
 
     def __repr__(self):
@@ -238,6 +239,7 @@
         return blocks
 
     def print_hunks(self):
+        """Print the headers and diff texts of all hunks to the output."""
         for hunk in self.hunks:
             pywikibot.output(hunk.header + hunk.diff_text)
 
diff --git a/pywikibot/families/test_family.py 
b/pywikibot/families/test_family.py
index 1517af2..2a587c0 100644
--- a/pywikibot/families/test_family.py
+++ b/pywikibot/families/test_family.py
@@ -14,4 +14,5 @@
     langs = {'test': 'test.wikipedia.org'}
 
     def from_url(self, url):
+        """Return None to indicate no code of this family is accepted."""
         return None  # Don't accept this, but 'test' of 'wikipedia'
diff --git a/pywikibot/page.py b/pywikibot/page.py
index eba81a3..d96b8cb 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -576,6 +576,13 @@
             return min(x.revid for x in history)
 
     def previousRevision(self):
+        """
+        Return the revision id for the previous revision.
+
+        DEPRECATED: Use previous_revision_id instead.
+
+        @return: long
+        """
         return self.previous_revision_id
 
     def exists(self):
@@ -3276,6 +3283,7 @@
                 }
 
     def getRedirectTarget(self):
+        """Return the redirect target for this page."""
         target = super(ItemPage, self).getRedirectTarget()
         cmodel = target.content_model
         if cmodel != 'wikibase-item':
diff --git a/pywikibot/throttle.py b/pywikibot/throttle.py
index 5cdc30d..a311a20 100644
--- a/pywikibot/throttle.py
+++ b/pywikibot/throttle.py
@@ -39,6 +39,7 @@
 
     def __init__(self, site, mindelay=None, maxdelay=None, writedelay=None,
                  multiplydelay=True):
+        """Constructor."""
         self.lock = threading.RLock()
         self.mysite = str(site)
         self.ctrlfilename = config.datafilepath('throttle.ctrl')
diff --git a/pywikibot/tools.py b/pywikibot/tools.py
index b12341a..d3112cb 100644
--- a/pywikibot/tools.py
+++ b/pywikibot/tools.py
@@ -90,6 +90,7 @@
         self.version = tuple(components)
 
     def __str__(self):
+        """Return version number with optional "wmf" suffix."""
         vstring = '.'.join(str(v) for v in self.version)
         if self.wmf_version:
             vstring += 'wmf{0}'.format(self.wmf_version)
@@ -406,6 +407,7 @@
     """Return self when called."""
 
     def __call__(self):
+        """Do nothing and just return itself."""
         return self
 
 

-- 
To view, visit https://gerrit.wikimedia.org/r/180691
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie5633447090ddfcf201ed38d7fea111a450c7177
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: Unicodesnowman <[email protected]>
Gerrit-Reviewer: XZise <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to