[IMPR] reduce code complexity of pagegenerators.py
[IMPR] reduce code complexity of pagegenerators.py

Change-Id: I4fa1a4d6c9dc2ae5d425505eb3742d3c512bbfdf

wikimedia/pywikibot-core,wikimedia/pywikibot-core