jenkins-bot has submitted this change and it was merged.
Change subject: Fixing D203 error ......................................................................
Fixing D203 error
in PEP257
Change-Id: I0460374f31f205d141946e5d9f6931189024e06e --- M pywikibot/__init__.py M pywikibot/bot.py M pywikibot/botirc.py M pywikibot/exceptions.py M pywikibot/i18n.py M pywikibot/interwiki_graph.py M pywikibot/logentries.py M pywikibot/page.py M pywikibot/pagegenerators.py M pywikibot/site.py M pywikibot/textlib.py M pywikibot/throttle.py M pywikibot/tools.py M pywikibot/version.py M pywikibot/xmlreader.py M setup.py 16 files changed, 66 insertions(+), 0 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved Ricordisamoa: Looks good to me, but someone else must approve jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py index 390432b..1a4101c 100644 --- a/pywikibot/__init__.py +++ b/pywikibot/__init__.py @@ -35,6 +35,7 @@
class Timestamp(datetime.datetime): + """Class for handling Mediawiki timestamps.
This inherits from datetime.datetime, so it can use all of the methods @@ -94,6 +95,7 @@
class Coordinate(object): + """ Class for handling and storing Coordinates. For now its just being used for DataSite, but @@ -209,6 +211,7 @@
class WbTime(object): + """ A Wikibase time representation"""
PRECISION = {'1000000000': 0, '100000000': 1, '10000000': 2, '1000000': 3, '100000': 4, '10000': 5, 'millenia': 6, 'century': 7, 'decade': 8, 'year': 9, 'month': 10, 'day': 11, 'hour': 12, 'minute': 13, 'second': 14} @@ -314,6 +317,7 @@
class WbQuantity(object): + """ A Wikibase quantity representation"""
def __init__(self, amount, unit=None, error=None): diff --git a/pywikibot/bot.py b/pywikibot/bot.py index a41183a..78e291a 100644 --- a/pywikibot/bot.py +++ b/pywikibot/bot.py @@ -107,6 +107,7 @@
class LoggingFormatter(logging.Formatter): + """Format LogRecords for output to file.
This formatter *ignores* the 'newline' key of the LogRecord, because @@ -751,6 +752,7 @@
class Bot(object): + """ Generic Bot to be subclassed """ @@ -834,6 +836,7 @@
class WikidataBot: + """ Generic Wikidata Bot to be subclassed used in claimit.py, coordinate_import.py and harvest_template.py diff --git a/pywikibot/botirc.py b/pywikibot/botirc.py index 9a7073c..b58325a 100644 --- a/pywikibot/botirc.py +++ b/pywikibot/botirc.py @@ -38,6 +38,7 @@
class IRCBot(pywikibot.Bot, SingleServerIRCBot): + """ Generic IRC Bot to be subclassed
diff --git a/pywikibot/exceptions.py b/pywikibot/exceptions.py index 17296a2..fa0469e 100644 --- a/pywikibot/exceptions.py +++ b/pywikibot/exceptions.py @@ -17,6 +17,7 @@
class Error(UnicodeMixin, Exception): + """Wikipedia error""" # NOTE: UnicodeMixin must be the first object Error class is derived from. def __init__(self, arg): @@ -27,6 +28,7 @@
class PageRelatedError(Error): + """Abstract Exception, used when the Exception concerns a particular Page, and when a generic message can be written once for all""" # Preformated UNICODE message where the page title will be inserted @@ -49,29 +51,35 @@
class NoUsername(Error): + """Username is not in user-config.py"""
class NoPage(PageRelatedError): + """Page does not exist""" message = u"Page %s doesn't exist."
class NoSuchSite(Error): + """Site does not exist"""
class IsRedirectPage(PageRelatedError): + """Page is a redirect page""" message = u"Page %s is a redirect page."
class IsNotRedirectPage(PageRelatedError): + """Page is not a redirect page""" message = u"Page %s is not a redirect page."
class CircularRedirect(Error): + """Page is a circular redirect
Exception argument is the redirect target; this may be the same title @@ -82,27 +90,33 @@
class InvalidTitle(Error): + """Invalid page title"""
class LockedPage(PageRelatedError): + """Page is locked""" message = u"Page %s is locked."
class SectionError(Error): + """The section specified by # does not exist"""
class PageNotSaved(Error): + """Saving the page has failed"""
class EditConflict(PageNotSaved): + """There has been an edit conflict while uploading the page"""
class SpamfilterError(PageNotSaved): + """Saving the page has failed because the MediaWiki spam filter detected a blacklisted URL. """ @@ -114,19 +128,23 @@
class ServerError(Error): + """Got unexpected server response"""
class FatalServerError(ServerError): + """A fatal server error that's not going to be corrected by just sending the request again."""
class Server504Error(Error): + """Server timed out with http 504 code"""
class BadTitle(Error): + """Server responded with BadTitle."""
# UserBlocked exceptions should in general not be caught. If the bot has @@ -135,22 +153,27 @@
class UserBlocked(Error): + """Your username or IP has been blocked"""
class PageNotFound(Error): + """Page not found in list"""
class CaptchaError(Error): + """Captcha is asked and config.solve_captcha == False."""
class UploadWarning(Error): + """Upload failed with a warning message (passed as the argument)."""
class AutoblockUser(Error): + """ The class AutoblockUserError is an exception that is raised whenever an action is requested on a virtual autoblock user that's not available @@ -167,4 +190,5 @@
class CoordinateGlobeUnknownException(WikiBaseError, NotImplementedError): + """ This globe is not implemented yet in either WikiBase or pywikibot """ diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py index c204121..fea4130 100644 --- a/pywikibot/i18n.py +++ b/pywikibot/i18n.py @@ -221,6 +221,7 @@
class TranslationError(Error): + """ Raised when no correct translation could be found """ pass
diff --git a/pywikibot/interwiki_graph.py b/pywikibot/interwiki_graph.py index 7e27d01..3fec68b 100644 --- a/pywikibot/interwiki_graph.py +++ b/pywikibot/interwiki_graph.py @@ -19,10 +19,12 @@
class GraphImpossible(Exception): + "Drawing a graph is not possible on your system."
class GraphSavingThread(threading.Thread): + """ Rendering a graph can take extremely long. We use multithreading because of that. diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py index fcdf029..be6d08b 100644 --- a/pywikibot/logentries.py +++ b/pywikibot/logentries.py @@ -17,6 +17,7 @@
class LogDict(dict): + """ Simple custom dictionary that raises a custom KeyError and logs debugging information when a key is missing @@ -28,6 +29,7 @@
class LogEntry(object): + """Generic log entry"""
# Log type expected. None for every type, or one of the (letype) str : @@ -205,6 +207,7 @@
class LogEntryFactory(object): + """ LogEntry Factory
diff --git a/pywikibot/page.py b/pywikibot/page.py index 1f1877b..b19c09a 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -43,6 +43,7 @@ # Page objects (defined here) represent the page itself, including its contents.
class Page(pywikibot.UnicodeMixin, ComparableMixin): + """Page: A MediaWiki page
This object only implements internally methods that do not require @@ -1641,6 +1642,7 @@
class ImagePage(Page): + """A subclass of Page representing an image descriptor wiki page.
Supports the same interface as Page, with the following added methods: @@ -1756,6 +1758,7 @@
class Category(Page): + """A page in the Category: namespace"""
@deprecate_arg("insite", None) @@ -2091,6 +2094,7 @@
class User(Page): + """A class that represents a Wiki user. """
@@ -2391,6 +2395,7 @@
class WikibasePage(Page): + """ The base page for the Wikibase extension. There really should be no need to call this directly @@ -2809,6 +2814,7 @@
class PropertyPage(WikibasePage, Property): + """ Any page in the property namespace Should be created as: @@ -2842,6 +2848,7 @@
class QueryPage(WikibasePage): + """ For future usage, not implemented yet """ @@ -2853,6 +2860,7 @@
class Claim(Property): + """ Claims are standard claims as well as references. """ @@ -3091,6 +3099,7 @@
class Revision(object): + """A structure holding information about a single revision of a Page.""" def __init__(self, revid, timestamp, user, anon=False, comment=u"", text=None, minor=False): @@ -3123,6 +3132,7 @@
class Link(ComparableMixin): + """A MediaWiki link (local or interwiki)
Has the following attributes: diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py index 9a2c6f5..98e292b 100644 --- a/pywikibot/pagegenerators.py +++ b/pywikibot/pagegenerators.py @@ -194,6 +194,7 @@
class GeneratorFactory(object): + """Process command line arguments and return appropriate page generator. This factory is responsible for processing command line arguments that are used by many scripts and that determine which pages to work on. @@ -1221,6 +1222,7 @@
class YahooSearchPageGenerator: + """ To use this generator, install pYsearch """
# values larger than 100 fail @@ -1253,6 +1255,7 @@
class GoogleSearchPageGenerator: + """ To use this generator, you must install the pyGoogle module from http://pygoogle.sf.net/ and get a Google Web API license key from diff --git a/pywikibot/site.py b/pywikibot/site.py index 578febf..b614f1b 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -38,10 +38,12 @@
class PageInUse(pywikibot.Error): + """Page cannot be reserved for writing due to existing lock."""
class LoginStatus(object): + """ Enum for Login statuses.
>>> LoginStatus.NOT_ATTEMPTED @@ -96,6 +98,7 @@
class BaseSite(object): + """Site methods that are independent of the communication interface.""" # to implement a specific interface, define a Site class that inherits # from this @@ -575,6 +578,7 @@
class APISite(BaseSite): + """API interface to MediaWiki site.
Do not use directly; use pywikibot.Site function. diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index df37f95..182359e 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -1134,6 +1134,7 @@ # ---------------------------------------
class tzoneFixedOffset(datetime.tzinfo): + """ Class building tzinfo objects for fixed-offset time zones
@@ -1162,6 +1163,7 @@
class TimeStripper(object): + """ Find timestamp in page text and returns it as timezone aware datetime object """ diff --git a/pywikibot/throttle.py b/pywikibot/throttle.py index 1d8da7a..7957fee 100644 --- a/pywikibot/throttle.py +++ b/pywikibot/throttle.py @@ -28,6 +28,7 @@
class Throttle(object): + """Control rate of access to wiki server
Calling this object blocks the calling thread until at least 'delay' diff --git a/pywikibot/tools.py b/pywikibot/tools.py index 31ca0ef..6f0c26c 100644 --- a/pywikibot/tools.py +++ b/pywikibot/tools.py @@ -18,6 +18,7 @@
class UnicodeMixin(object): + """Mixin class to handle defining the proper __str__/__unicode__ methods in Python 2 or 3. """ @@ -60,6 +61,7 @@
class ThreadedGenerator(threading.Thread): + """Look-ahead generator class.
Runs a generator in a separate thread and queues the results; can @@ -171,6 +173,7 @@
class ThreadList(list): + """A simple threadpool class to limit the number of simultaneous threads.
Any threading.Thread object can be added to the pool using the append() diff --git a/pywikibot/version.py b/pywikibot/version.py index ab455f3..608d7e1 100644 --- a/pywikibot/version.py +++ b/pywikibot/version.py @@ -20,6 +20,7 @@
class ParseError(Exception): + """ Parsing went wrong """
diff --git a/pywikibot/xmlreader.py b/pywikibot/xmlreader.py index 55191ad..1ad4e2e 100644 --- a/pywikibot/xmlreader.py +++ b/pywikibot/xmlreader.py @@ -44,6 +44,7 @@
class XmlEntry: + """ Represents a page. """ @@ -66,6 +67,7 @@
class XmlParserThread(threading.Thread): + """ This XML parser will run as a single thread. This allows the XmlDump generator to yield pages before the parser has finished reading the @@ -83,6 +85,7 @@
class XmlDump(object): + """ Represents an XML dump file. Reads the local file at initialization, parses it, and offers access to the resulting XmlEntries via a generator. diff --git a/setup.py b/setup.py index 357a1fe..069dc46 100644 --- a/setup.py +++ b/setup.py @@ -46,6 +46,7 @@
class pwb_install(install.install): + """ Setuptools' install command subclassed to automatically call `generate_user_files.py` after installing the package.
pywikibot-commits@lists.wikimedia.org