Add RepeatingGenerator

In compat, we have many generators such as logpages(),
recentchanges() with parameter `repeat`, while in core
this parameter is missing. RepeatingGenerator is a way
to bring its functionality back.

Change-Id: I3da94de6bec0d5638f7be39597db90f7a1e7bc6d
User-agent graceful degradation

The newly formatted user-agent string is not compliant with RFC 7231,
as it puts the username at the end, when it should be at the beginning
and leaves '(User:)' in the user-agent if the request was not to a site.

Using a default format string of '{script}/{version} ..' is asking for
the end-user to build a uncompliant user-agent.  We should give them
properly formatted products and product comments.

Provide Pywikibot, httplib2 and Python release versions as products,
and provide script_product and script_comments, populated with the
information currently known about the script.

In the user-agent builder, include in the user-agent whichever components
are available at the time of the request, allowing http.py to be used
by version.py without cyclic dependency runtime exceptions.

Avoid percent-encoding or utf-8 encoding the username unless necessary.

Bug: 55016
Bug: 66102
Change-Id: Iedf28f5e0a216ba23a015924e564ae0537e64f0d
Fix wikibase test test_own_client

The test test_own_client was introduced when Wikidata became its
own client.  The test checked whether pywikibot could support this
configuration, but it used an invalid test scenario to do this.
It was introduced in dce03581d4a2f0e52aa5b7a2e2b1e68a5a1b48a1

The Main Page should not be a valid ItemPage title; that is being
fixed in other changes.  The intention was to see whether an item
could be loaded for the normal page object for Main Page.

Change-Id: I21686a13825f547cf1a4ea34dae697139f3e0bbe
Bug 69039 - welcome raises exception if site is not configured

welcome.py checks if site is managed by the script, otherwise exit
without error is site is not managed by the script and show help.

Change-Id: I8a7ce9a6442841a897ec2e4854f5e80bfe5c781f
Merge "Bug 69039 - welcome raises exception if site is not configured"
Use page properties to find if a category is hidden

Bug: 65149

Added also:
     @pywikibot.site.need_version("1.13")
     def isEmptyCategory(self):

     @pywikibot.site.need_version("1.11")
     def isHiddenCategory(self):

New method Page.version() defined in order to use such decorator.

Change-Id: I349559ee93fae1c6f8832581ed774da965740539
Merge "User-agent graceful degradation"
Merge "Use page properties to find if a category is hidden"
MVP: implement Echo support

with a new Notification class in echo.py

and new APISite methods:
 - notifications()
 - notifications_mark_read()

bug: 66275
Change-Id: I25d72ce5f3f3418d8f92e9e41186aaf07fef04ea
Merge "MVP: implement Echo support"
[FEAT] Cosmetic changes: Add option to ignore exceptions

This feature allows to ignore exceptions and continue changing the
current page or skipping it. Part of it (when ignoring a page) might
be applicable to the bot class overall.

Change-Id: I81094d94c32d012aba481a23eba8fe4db3dc5a17
[FEAT] If possible check if AssertEdit available

Previously it assumed the AssertEdit extension is available, when
the extensions weren't cached yet. But because a siteinfo request
does not require an 'edit' action it should be safely possible
to always retrieve the extensions information and always determine
if it's installed or not.

Change-Id: I5ed6a9c4921f5b453eca1eaeae8aa03baa5645a1
Merge "[FEAT] Cosmetic changes: Add option to ignore exceptions"
Merge "[FEAT] If possible check if AssertEdit available"
[FIX] Make the user-agent Python 3 compatible

Python 3 break two things about user-agent:
  - 'encode' returns bytes and not a string, because the encoded
    result isn't used and it's only important that it could be
    encoded the result is discarded
  - The version of the git directory can't be determined, because
    the stdout (and stderr/stdin) are bytes (list of bytes) and
    not strings. Those need to be converted.

Change-Id: I191ab067eb2d8afe4e8f8d73f90408846add713a
Merge "Fix wikibase test test_own_client"
pep257 in pywikibot/families

Change-Id: Iaeb7761baf6f8440f2113d3e688b5c83fc50c6f2
py3 imports and types

- winreg import
- urlencode import
- use bytes() before decoding
- use b'' before doing string operations like startswith

Change-Id: I2f8c2fb06115c735a499d24dd333e3854a4d6cc2
Merge "pep257 in pywikibot/families"
Ignore missing docstring in PEP257

For a while in order to reduce number of errors.
We'll get to them later

Change-Id: I2344b40eda4b437762c4ab48654b246c4db16ebe