jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/351008 )
Change subject: flake8: Fix E305 errors and remove it from ignored codes
......................................................................
flake8: Fix E305 errors and remove it from ignored codes
Change-Id: I85c3223a5fc76b614d97c9f9492e8edd36245545
---
M docs/conf.py
M ez_setup.py
M generate_user_files.py
M pwb.py
M pywikibot/__init__.py
M pywikibot/comms/http.py
M pywikibot/compat/catlib.py
M pywikibot/config2.py
M pywikibot/date.py
M pywikibot/fixes.py
M pywikibot/page.py
M pywikibot/pagegenerators.py
M pywikibot/userinterfaces/terminal_interface_win32.py
M pywikibot/userinterfaces/win32_unicode.py
M scripts/add_text.py
M scripts/archivebot.py
M scripts/basic.py
M scripts/capitalize_redirects.py
M scripts/catall.py
M scripts/category_redirect.py
M scripts/cfd.py
M scripts/claimit.py
M scripts/coordinate_import.py
M scripts/cosmetic_changes.py
M scripts/create_categories.py
M scripts/data_ingestion.py
M scripts/djvutext.py
M scripts/fixing_redirects.py
M scripts/flickrripper.py
M scripts/freebasemappingupload.py
M scripts/harvest_template.py
M scripts/illustrate_wikidata.py
M scripts/image.py
M scripts/imagerecat.py
M scripts/imagetransfer.py
M scripts/imageuncat.py
M scripts/isbn.py
M scripts/maintenance/colors.py
M scripts/maintenance/make_i18n_dict.py
M scripts/makecat.py
M scripts/movepages.py
M scripts/noreferences.py
M scripts/nowcommons.py
M scripts/pagefromfile.py
M scripts/panoramiopicker.py
M scripts/patrol.py
M scripts/redirect.py
M scripts/reflinks.py
M scripts/replicate_wiki.py
M scripts/revertbot.py
M scripts/script_wui.py
M scripts/selflink.py
M scripts/states_redirect.py
M scripts/surnames_redirects.py
M scripts/table2wiki.py
M scripts/template.py
M scripts/templatecount.py
M scripts/unlink.py
M scripts/upload.py
M scripts/version.py
M scripts/watchlist.py
M scripts/welcome.py
M tests/basepage_tests.py
M tests/cosmetic_changes_tests.py
M tests/diff_tests.py
M tests/edit_failure_tests.py
M tests/isbn_tests.py
M tests/pagegenerators_tests.py
M tests/protectbot_tests.py
M tests/script_tests.py
M tests/textlib_tests.py
M tests/timestamp_tests.py
M tests/tools_ip_tests.py
M tests/user_tests.py
M tests/wikibase_edit_tests.py
M tox.ini
76 files changed, 85 insertions(+), 7 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/docs/conf.py b/docs/conf.py
index aa07152..17cf9ac 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -282,4 +282,5 @@
"""Implicit Sphinx extension hook."""
app.connect('autodoc-process-docstring', pywikibot_script_docstring_fixups)
+
pywikibot_env()
diff --git a/ez_setup.py b/ez_setup.py
index 9715bdc..41fcdc8 100644
--- a/ez_setup.py
+++ b/ez_setup.py
@@ -411,5 +411,6 @@
archive = download_setuptools(**_download_args(options))
return _install(archive, _build_install_args(options))
+
if __name__ == '__main__':
sys.exit(main())
diff --git a/generate_user_files.py b/generate_user_files.py
index 74837a1..6f1a283 100755
--- a/generate_user_files.py
+++ b/generate_user_files.py
@@ -159,6 +159,7 @@
username = username.replace("'", "\\'")
return fam.name, mylang, username
+
EXTENDED_CONFIG = """# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
@@ -362,5 +363,6 @@
pywikibot.output('user-config.py already exists in the target '
'directory "{0}".'.format(base_dir))
+
if __name__ == '__main__':
main()
diff --git a/pwb.py b/pwb.py
index ca7179f..8a37771 100755
--- a/pwb.py
+++ b/pwb.py
@@ -259,6 +259,7 @@
else:
return False
+
if __name__ == '__main__':
if not main():
print(__doc__)
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index cec265f..250cc8a 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -1158,6 +1158,7 @@
except IndexError:
pass
+
atexit.register(_flush)
@@ -1185,6 +1186,7 @@
page_put_queue.mutex.release()
page_put_queue.put((request, args, kwargs))
+
# queue to hold pending requests
page_put_queue = Queue(config.max_queue_size)
# set up the background thread
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 3006dde..bbf20b3 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -131,6 +131,8 @@
log(message)
log('Network session closed.')
+
+
atexit.register(_flush)
USER_AGENT_PRODUCTS = {
diff --git a/pywikibot/compat/catlib.py b/pywikibot/compat/catlib.py
index 689fb26..346850a 100644
--- a/pywikibot/compat/catlib.py
+++ b/pywikibot/compat/catlib.py
@@ -25,6 +25,7 @@
"""Change the category of the article."""
return article.change_category(oldCat, newCat, comment, sortKey, inPlace)
+
__all__ = ('Category', 'change_category',)
wrapper = ModuleDeprecationWrapper(__name__)
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index fd5a2df..85ad1a7 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -81,6 +81,7 @@
pass
+
# IMPORTANT:
# Do not change any of the variables in this file. Instead, make
# a file user-config.py, and overwrite values in there.
@@ -362,6 +363,7 @@
raise RuntimeError(exc_text)
return base_dir
+
_get_base_dir = get_base_dir # for backward compatibility
_base_dir = get_base_dir()
@@ -1064,6 +1066,7 @@
warn('Configuration variable {0} is defined but unknown. '
'Misspelled?'.format(name), UserWarning)
+
_check_user_config_types(_uc, _glv, _imports)
diff --git a/pywikibot/date.py b/pywikibot/date.py
index c00eaf2..c1e2a49 100644
--- a/pywikibot/date.py
+++ b/pywikibot/date.py
@@ -301,6 +301,7 @@
else:
raise ValueError("string contains regular digits")
+
# Decimal digits used for various matchings
_decimalDigits = '0123456789'
@@ -321,6 +322,7 @@
def romanNumToInt(v):
"""Convert roman numeral to integer."""
return _romanNumbers.index(v)
+
# Each tuple must 3 parts: a list of all possible digits (symbols), encoder
# (from int to a u-string) and decoder (from u-string to an int)
@@ -505,7 +507,7 @@
"""DEPRECATED."""
return _make_parameter(decoder, param)
-#
+
# All years/decades/centuries/millenniums are designed in such a way
# as to allow for easy date to string and string to date conversion.
# For example, using any map with either an integer or a string will produce
@@ -518,7 +520,6 @@
# This is useful when trying to decide if a certain article is a localized date
# or not, or generating dates.
# See dh() for additional information.
-#
formats = {
'MonthName': {
'af': lambda v: slh(v, [u"Januarie", u"Februarie",
u"Maart", u"April",
@@ -2008,9 +2009,8 @@
f = first_lower
return [pattern % f(monthName(lang, m)) for m in range(1, 13)]
-#
+
# Add day of the month formats to the formatting table: "en:May 15"
-#
addFmt2('af', False, u"%%d %s", True)
addFmt2('als', False, u"%%d. %s", True)
addFmt1('an', False, [u"%d de chinero", u"%d de frebero",
u"%d de marzo",
diff --git a/pywikibot/fixes.py b/pywikibot/fixes.py
index 6586cf4..f62e78e 100644
--- a/pywikibot/fixes.py
+++ b/pywikibot/fixes.py
@@ -648,7 +648,7 @@
else:
return False
-#
+
# Load the user fixes file.
filename = config.datafilepath('user-fixes.py')
if _load_file(filename):
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 3794ee0..0f30b58 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -4498,6 +4498,7 @@
return Claim(self.site, self.getID(), datatype=self.type,
*args, **kwargs)
+
# Add PropertyPage to the class attribute "types" after its declaration.
Property.types['wikibase-property'] = PropertyPage
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 7809ee6..0715a75 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -2897,6 +2897,7 @@
WikidataItemGenerator = redirect_func(
WikibaseItemGenerator, old_name='WikidataItemGenerator')
+
if __name__ == "__main__":
pywikibot.output(u'Pagegenerators cannot be run as script - are you '
u'looking for listpages.py?')
diff --git a/pywikibot/userinterfaces/terminal_interface_win32.py
b/pywikibot/userinterfaces/terminal_interface_win32.py
index c2b0299..45ea415 100755
--- a/pywikibot/userinterfaces/terminal_interface_win32.py
+++ b/pywikibot/userinterfaces/terminal_interface_win32.py
@@ -88,6 +88,7 @@
raise EOFError()
return data.strip()
+
if ctypes_found:
Win32UI = Win32CtypesUI
else:
diff --git a/pywikibot/userinterfaces/win32_unicode.py
b/pywikibot/userinterfaces/win32_unicode.py
index d77baf1..f769a91 100755
--- a/pywikibot/userinterfaces/win32_unicode.py
+++ b/pywikibot/userinterfaces/win32_unicode.py
@@ -368,5 +368,6 @@
return stdin, stdout, stderr, argv
+
if OSWIN32:
register_cp65001()
diff --git a/scripts/add_text.py b/scripts/add_text.py
index 2ed3a33..73d3f27 100755
--- a/scripts/add_text.py
+++ b/scripts/add_text.py
@@ -293,5 +293,6 @@
reorderEnabled=reorderEnabled,
create=talkPage)
+
if __name__ == "__main__":
main()
diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index f1da63a..e6c0ca4 100755
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -792,5 +792,6 @@
pywikibot.error(u'Error occurred while processing page %s' % pg)
pywikibot.exception(tb=True)
+
if __name__ == '__main__':
main()
diff --git a/scripts/basic.py b/scripts/basic.py
index 0f3879b..6159d0c 100755
--- a/scripts/basic.py
+++ b/scripts/basic.py
@@ -202,5 +202,6 @@
pywikibot.bot.suggest_help(missing_generator=True)
return False
+
if __name__ == '__main__':
main()
diff --git a/scripts/capitalize_redirects.py b/scripts/capitalize_redirects.py
index 7a7d75d..2d2bdd2 100755
--- a/scripts/capitalize_redirects.py
+++ b/scripts/capitalize_redirects.py
@@ -121,5 +121,6 @@
pywikibot.bot.suggest_help(missing_generator=True)
return False
+
if __name__ == "__main__":
main()
diff --git a/scripts/catall.py b/scripts/catall.py
index 48c9f17..31ee2db 100755
--- a/scripts/catall.py
+++ b/scripts/catall.py
@@ -130,6 +130,7 @@
except pywikibot.IsRedirectPage:
pywikibot.output(u'%s is a redirect' % p.title())
+
if __name__ == "__main__":
try:
main()
diff --git a/scripts/category_redirect.py b/scripts/category_redirect.py
index c559b52..1bfb843 100755
--- a/scripts/category_redirect.py
+++ b/scripts/category_redirect.py
@@ -480,5 +480,6 @@
bot = CategoryRedirectBot(**options)
bot.run()
+
if __name__ == "__main__":
main()
diff --git a/scripts/cfd.py b/scripts/cfd.py
index 5ec80a8..5afc2fc 100755
--- a/scripts/cfd.py
+++ b/scripts/cfd.py
@@ -232,5 +232,6 @@
% (year, month, day))
return oldDay
+
if __name__ == "__main__":
main()
diff --git a/scripts/claimit.py b/scripts/claimit.py
index 19142df..85ef050 100755
--- a/scripts/claimit.py
+++ b/scripts/claimit.py
@@ -222,5 +222,6 @@
bot.run()
return True
+
if __name__ == "__main__":
main()
diff --git a/scripts/coordinate_import.py b/scripts/coordinate_import.py
index 7ed163d..3d971fe 100755
--- a/scripts/coordinate_import.py
+++ b/scripts/coordinate_import.py
@@ -133,5 +133,6 @@
pywikibot.bot.suggest_help(missing_generator=True)
return False
+
if __name__ == "__main__":
main()
diff --git a/scripts/cosmetic_changes.py b/scripts/cosmetic_changes.py
index 9117d5a..b685247 100644
--- a/scripts/cosmetic_changes.py
+++ b/scripts/cosmetic_changes.py
@@ -137,5 +137,6 @@
pywikibot.bot.suggest_help(missing_generator=True)
return False
+
if __name__ == "__main__":
main()
diff --git a/scripts/create_categories.py b/scripts/create_categories.py
index 0696d9e..9701e7b 100755
--- a/scripts/create_categories.py
+++ b/scripts/create_categories.py
@@ -120,5 +120,6 @@
missing_generator=not generator)
return False
+
if __name__ == "__main__":
main()
diff --git a/scripts/data_ingestion.py b/scripts/data_ingestion.py
index e1c9a51..f092829 100755
--- a/scripts/data_ingestion.py
+++ b/scripts/data_ingestion.py
@@ -309,5 +309,6 @@
finally:
f.close()
+
if __name__ == "__main__":
main()
diff --git a/scripts/djvutext.py b/scripts/djvutext.py
index 6a979b5..f27e84c 100644
--- a/scripts/djvutext.py
+++ b/scripts/djvutext.py
@@ -204,6 +204,7 @@
bot = DjVuTextBot(djvu, index_page, pages, **options)
bot.run()
+
if __name__ == '__main__':
try:
main()
diff --git a/scripts/fixing_redirects.py b/scripts/fixing_redirects.py
index d65b9fd..6e58f79 100755
--- a/scripts/fixing_redirects.py
+++ b/scripts/fixing_redirects.py
@@ -218,5 +218,6 @@
suggest_help(missing_generator=True)
return False
+
if __name__ == "__main__":
main()
diff --git a/scripts/flickrripper.py b/scripts/flickrripper.py
index 9fd15da..a941eb5 100755
--- a/scripts/flickrripper.py
+++ b/scripts/flickrripper.py
@@ -546,5 +546,6 @@
pywikibot.output(u'Total photos: ' + str(totalPhotos))
pywikibot.output(u'Uploaded photos: ' + str(uploadedPhotos))
+
if __name__ == "__main__":
main()
diff --git a/scripts/freebasemappingupload.py b/scripts/freebasemappingupload.py
index c9474b5..a773971 100755
--- a/scripts/freebasemappingupload.py
+++ b/scripts/freebasemappingupload.py
@@ -122,5 +122,6 @@
bot = FreebaseMapperRobot(filename)
bot.run()
+
if __name__ == '__main__':
main()
diff --git a/scripts/harvest_template.py b/scripts/harvest_template.py
index 309705e..a431bfd 100755
--- a/scripts/harvest_template.py
+++ b/scripts/harvest_template.py
@@ -49,6 +49,7 @@
else:
raise KeyboardInterrupt
+
signal.signal(signal.SIGINT, _signal_handler)
import pywikibot
@@ -265,5 +266,6 @@
bot = HarvestRobot(generator, template_title, fields)
bot.run()
+
if __name__ == "__main__":
main()
diff --git a/scripts/illustrate_wikidata.py b/scripts/illustrate_wikidata.py
index 243be1c..cb449af 100755
--- a/scripts/illustrate_wikidata.py
+++ b/scripts/illustrate_wikidata.py
@@ -122,5 +122,6 @@
bot.run()
return True
+
if __name__ == "__main__":
main()
diff --git a/scripts/image.py b/scripts/image.py
index c7267f7..f39f16d 100755
--- a/scripts/image.py
+++ b/scripts/image.py
@@ -166,5 +166,6 @@
pywikibot.bot.suggest_help(missing_parameters=['old image'])
return False
+
if __name__ == "__main__":
main()
diff --git a/scripts/imagerecat.py b/scripts/imagerecat.py
index 96d68ff..c7945f7 100755
--- a/scripts/imagerecat.py
+++ b/scripts/imagerecat.py
@@ -493,5 +493,6 @@
categorizeImages(generator, onlyFilter, onlyUncat)
pywikibot.output(u'All done')
+
if __name__ == "__main__":
main()
diff --git a/scripts/imagetransfer.py b/scripts/imagetransfer.py
index 1d5c9d0..b745171 100755
--- a/scripts/imagetransfer.py
+++ b/scripts/imagetransfer.py
@@ -326,5 +326,6 @@
keep_name=keep_name)
bot.run()
+
if __name__ == "__main__":
main()
diff --git a/scripts/imageuncat.py b/scripts/imageuncat.py
index 2e3693c..49d8fc3 100755
--- a/scripts/imageuncat.py
+++ b/scripts/imageuncat.py
@@ -1381,5 +1381,6 @@
addUncat(page)
return True
+
if __name__ == "__main__":
main()
diff --git a/scripts/isbn.py b/scripts/isbn.py
index cfd1fbb..b287dc8 100755
--- a/scripts/isbn.py
+++ b/scripts/isbn.py
@@ -1675,5 +1675,6 @@
pywikibot.bot.suggest_help(missing_generator=True)
return False
+
if __name__ == "__main__":
main()
diff --git a/scripts/maintenance/colors.py b/scripts/maintenance/colors.py
index b388e75..b3258d5 100644
--- a/scripts/maintenance/colors.py
+++ b/scripts/maintenance/colors.py
@@ -44,5 +44,6 @@
pywikibot.output('')
+
if __name__ == '__main__':
main()
diff --git a/scripts/maintenance/make_i18n_dict.py
b/scripts/maintenance/make_i18n_dict.py
index 357401e..828df81 100755
--- a/scripts/maintenance/make_i18n_dict.py
+++ b/scripts/maintenance/make_i18n_dict.py
@@ -160,5 +160,6 @@
s = s.replace(' ' * IDENT, '\t')
json_file.write(s)
+
if __name__ == '__main__':
print(__doc__)
diff --git a/scripts/makecat.py b/scripts/makecat.py
index c5d1462..20b2267 100755
--- a/scripts/makecat.py
+++ b/scripts/makecat.py
@@ -187,6 +187,7 @@
else:
pywikibot.output(u"Not understood.")
+
try:
checked = {}
skipdates = False
diff --git a/scripts/movepages.py b/scripts/movepages.py
index 5a61392..1db3ad6 100755
--- a/scripts/movepages.py
+++ b/scripts/movepages.py
@@ -267,5 +267,6 @@
else:
return True
+
if __name__ == '__main__':
main()
diff --git a/scripts/noreferences.py b/scripts/noreferences.py
index 7735fff..604cc17 100755
--- a/scripts/noreferences.py
+++ b/scripts/noreferences.py
@@ -728,5 +728,6 @@
pywikibot.bot.suggest_help(missing_generator=True)
return False
+
if __name__ == "__main__":
main()
diff --git a/scripts/nowcommons.py b/scripts/nowcommons.py
index 20f64c7..91f213d 100755
--- a/scripts/nowcommons.py
+++ b/scripts/nowcommons.py
@@ -394,5 +394,6 @@
bot = NowCommonsDeleteBot(**options)
bot.run()
+
if __name__ == "__main__":
main()
diff --git a/scripts/pagefromfile.py b/scripts/pagefromfile.py
index e064ff4..509f6bb 100755
--- a/scripts/pagefromfile.py
+++ b/scripts/pagefromfile.py
@@ -341,5 +341,6 @@
bot = PageFromFileRobot(generator=reader, **options)
bot.run()
+
if __name__ == "__main__":
main()
diff --git a/scripts/panoramiopicker.py b/scripts/panoramiopicker.py
index 4c973f1..5d2bbf9 100644
--- a/scripts/panoramiopicker.py
+++ b/scripts/panoramiopicker.py
@@ -387,5 +387,6 @@
pywikibot.output(u'Total photos: ' + str(totalPhotos))
pywikibot.output(u'Uploaded photos: ' + str(uploadedPhotos))
+
if __name__ == "__main__":
main()
diff --git a/scripts/patrol.py b/scripts/patrol.py
index eb5b4a2..7506db2 100755
--- a/scripts/patrol.py
+++ b/scripts/patrol.py
@@ -538,5 +538,6 @@
pywikibot.output(u'%d/%d patrolled'
% (bot.patrol_counter, bot.rc_item_counter))
+
if __name__ == '__main__':
main()
diff --git a/scripts/redirect.py b/scripts/redirect.py
index fabe715..9bd6e7a 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -826,5 +826,6 @@
bot = RedirectRobot(action, **options)
bot.run()
+
if __name__ == '__main__':
main()
diff --git a/scripts/reflinks.py b/scripts/reflinks.py
index fd3352f..c494ab2 100755
--- a/scripts/reflinks.py
+++ b/scripts/reflinks.py
@@ -793,5 +793,6 @@
bot.run()
return True
+
if __name__ == "__main__":
main()
diff --git a/scripts/replicate_wiki.py b/scripts/replicate_wiki.py
index 85b808c..5a8ea13 100755
--- a/scripts/replicate_wiki.py
+++ b/scripts/replicate_wiki.py
@@ -270,5 +270,6 @@
sync.check_namespaces()
sync.generate_overviews()
+
if __name__ == '__main__':
main()
diff --git a/scripts/revertbot.py b/scripts/revertbot.py
index 9f4e06e..1f649fd 100755
--- a/scripts/revertbot.py
+++ b/scripts/revertbot.py
@@ -187,5 +187,6 @@
bot = myRevertBot(site=pywikibot.Site(), user=user, rollback=rollback)
bot.revert_contribs()
+
if __name__ == "__main__":
main()
diff --git a/scripts/script_wui.py b/scripts/script_wui.py
index e024b66..97cd2c8 100755
--- a/scripts/script_wui.py
+++ b/scripts/script_wui.py
@@ -347,5 +347,6 @@
bot.t.cancel()
raise
+
if __name__ == "__main__":
main()
diff --git a/scripts/selflink.py b/scripts/selflink.py
index 116b6a1..adbdebf 100755
--- a/scripts/selflink.py
+++ b/scripts/selflink.py
@@ -106,5 +106,6 @@
bot.run()
return True
+
if __name__ == "__main__":
main()
diff --git a/scripts/states_redirect.py b/scripts/states_redirect.py
index b1a54ee..069c615 100755
--- a/scripts/states_redirect.py
+++ b/scripts/states_redirect.py
@@ -144,5 +144,6 @@
bot = StatesRedirectBot(start, force)
bot.run()
+
if __name__ == "__main__":
main()
diff --git a/scripts/surnames_redirects.py b/scripts/surnames_redirects.py
index 2c17940..2cc8de4 100755
--- a/scripts/surnames_redirects.py
+++ b/scripts/surnames_redirects.py
@@ -127,5 +127,6 @@
else:
pywikibot.bot.suggest_help(missing_generator=True)
+
if __name__ == "__main__":
main()
diff --git a/scripts/table2wiki.py b/scripts/table2wiki.py
index 87aa6dc..9d430d5 100644
--- a/scripts/table2wiki.py
+++ b/scripts/table2wiki.py
@@ -600,5 +600,6 @@
else:
pywikibot.showHelp('table2wiki')
+
if __name__ == "__main__":
main()
diff --git a/scripts/template.py b/scripts/template.py
index b4bd2aa..5fa5b6c 100755
--- a/scripts/template.py
+++ b/scripts/template.py
@@ -361,6 +361,7 @@
bot = TemplateRobot(preloadingGen, templates, site=site, **options)
bot.run()
+
if __name__ == "__main__":
try:
main()
diff --git a/scripts/templatecount.py b/scripts/templatecount.py
index 42422fd..ad00bdf 100755
--- a/scripts/templatecount.py
+++ b/scripts/templatecount.py
@@ -201,5 +201,6 @@
elif operation == "list":
robot.listTemplates(argsList, namespaces)
+
if __name__ == "__main__":
main()
diff --git a/scripts/unlink.py b/scripts/unlink.py
index ef9b7a0..f8f7b1d 100755
--- a/scripts/unlink.py
+++ b/scripts/unlink.py
@@ -171,5 +171,6 @@
pywikibot.bot.suggest_help(missing_parameters=['page title'])
return False
+
if __name__ == "__main__":
main()
diff --git a/scripts/upload.py b/scripts/upload.py
index 2d306e4..d7902df 100755
--- a/scripts/upload.py
+++ b/scripts/upload.py
@@ -192,5 +192,6 @@
summary=summary)
bot.run()
+
if __name__ == "__main__":
main()
diff --git a/scripts/version.py b/scripts/version.py
index 1b7b119..59f3416 100755
--- a/scripts/version.py
+++ b/scripts/version.py
@@ -83,5 +83,6 @@
sysop_name = 'also sysop'
pywikibot.output('\t{0}: {1} ({2})'.format(lang, username,
sysop_name))
+
if __name__ == '__main__':
main()
diff --git a/scripts/watchlist.py b/scripts/watchlist.py
index 931a6be..dfdc6a8 100755
--- a/scripts/watchlist.py
+++ b/scripts/watchlist.py
@@ -120,5 +120,6 @@
except pywikibot.InvalidTitle:
pywikibot.exception()
+
if __name__ == "__main__":
main()
diff --git a/scripts/welcome.py b/scripts/welcome.py
index c151176..cbef2c6 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -876,6 +876,7 @@
pywikibot.output(u'There was no input on the real-time page.')
return list_loaded
+
globalvar = Global()
diff --git a/tests/basepage_tests.py b/tests/basepage_tests.py
index b30c806..99449de 100644
--- a/tests/basepage_tests.py
+++ b/tests/basepage_tests.py
@@ -111,6 +111,7 @@
self.assertFalse(self._page.isCategoryRedirect())
self.assertTrue(self._page.botMayEdit())
+
if __name__ == '__main__': # pragma: no cover
try:
unittest.main()
diff --git a/tests/cosmetic_changes_tests.py b/tests/cosmetic_changes_tests.py
index 02cce31..c5a6397 100644
--- a/tests/cosmetic_changes_tests.py
+++ b/tests/cosmetic_changes_tests.py
@@ -342,6 +342,7 @@
# Once numbering fixes are enabled we can add tests.
+
if __name__ == '__main__': # pragma: no cover
try:
unittest.main()
diff --git a/tests/diff_tests.py b/tests/diff_tests.py
index 26fdb80..ccf5afd 100644
--- a/tests/diff_tests.py
+++ b/tests/diff_tests.py
@@ -260,6 +260,7 @@
mock.assert_any_call(self.diff_by_letter_message)
mock.assert_any_call(self.none_message)
+
if __name__ == '__main__': # pragma: no cover
try:
unittest.main()
diff --git a/tests/edit_failure_tests.py b/tests/edit_failure_tests.py
index f77bdc2..ccaa479 100644
--- a/tests/edit_failure_tests.py
+++ b/tests/edit_failure_tests.py
@@ -181,6 +181,7 @@
'Unsupported URL scheme: wtf',
item.addClaim, claim)
+
if __name__ == '__main__': # pragma: no cover
try:
unittest.main()
diff --git a/tests/isbn_tests.py b/tests/isbn_tests.py
index 57a55c8..5d80170 100644
--- a/tests/isbn_tests.py
+++ b/tests/isbn_tests.py
@@ -256,5 +256,6 @@
"""Avoid that editEntity writes."""
pass
+
if __name__ == '__main__': # pragma: no cover
unittest.main()
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index 4d34212..23b5b3b 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -1386,6 +1386,7 @@
total=5):
assert False # this shouldn't be reached
+
if __name__ == '__main__': # pragma: no cover
try:
unittest.main()
diff --git a/tests/protectbot_tests.py b/tests/protectbot_tests.py
index 6eb7678..6f2ecba 100644
--- a/tests/protectbot_tests.py
+++ b/tests/protectbot_tests.py
@@ -59,6 +59,7 @@
'([Edit=Allow only administrators] (indefinite) [Move=Allow only '
'administrators] (indefinite))')
+
if __name__ == '__main__': # pragma: no cover
try:
unittest.main()
diff --git a/tests/script_tests.py b/tests/script_tests.py
index 6bc8c32..6808946 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -87,6 +87,7 @@
name != exclude]
return scripts
+
script_list = (['login'] +
list_scripts(scripts_path, 'login.py') +
list_scripts(archive_path))
diff --git a/tests/textlib_tests.py b/tests/textlib_tests.py
index c28407b..6b132ca 100644
--- a/tests/textlib_tests.py
+++ b/tests/textlib_tests.py
@@ -1531,6 +1531,7 @@
'foo', ['{{linkfa|en}}\n', '{{linkfa|de}}\n',
'{{linkfa|fr}}\n', '{{linkfa|bar}}']))
+
if __name__ == '__main__': # pragma: no cover
try:
unittest.main()
diff --git a/tests/timestamp_tests.py b/tests/timestamp_tests.py
index 0e26337..2431164 100644
--- a/tests/timestamp_tests.py
+++ b/tests/timestamp_tests.py
@@ -103,6 +103,7 @@
self.assertIsInstance(td, datetime.timedelta)
self.assertEqual(t2 + td, t1)
+
if __name__ == '__main__': # pragma: no cover
try:
unittest.main()
diff --git a/tests/tools_ip_tests.py b/tests/tools_ip_tests.py
index 4bcd31c..3520b64 100644
--- a/tests/tools_ip_tests.py
+++ b/tests/tools_ip_tests.py
@@ -689,6 +689,7 @@
self._test_T105443_failures()
self.assertEqual(self.fail, 0)
+
if __name__ == '__main__': # pragma: no cover
try:
unittest.main()
diff --git a/tests/user_tests.py b/tests/user_tests.py
index 60995e5..6d2940d 100644
--- a/tests/user_tests.py
+++ b/tests/user_tests.py
@@ -77,6 +77,7 @@
self.assertFalse(user.isEmailable())
self.assertIn('invalid', user.getprops())
+
if __name__ == '__main__': # pragma: no cover
try:
unittest.main()
diff --git a/tests/wikibase_edit_tests.py b/tests/wikibase_edit_tests.py
index 20a4a77..f5ffab4 100644
--- a/tests/wikibase_edit_tests.py
+++ b/tests/wikibase_edit_tests.py
@@ -417,6 +417,7 @@
self.assertNotIn('P580', claim.qualifiers.keys())
self.assertNotIn('P88', claim.qualifiers.keys())
+
if __name__ == '__main__': # pragma: no cover
try:
unittest.main()
diff --git a/tox.ini b/tox.ini
index 1684e64..afff122 100644
--- a/tox.ini
+++ b/tox.ini
@@ -143,12 +143,11 @@
# D102: Missing docstring in public method
# D401: First line should be in imperative mood; try rephrasing
# E241: multiple spaces after ':'
-# E305: expected 2 blank lines after class or function definition
# D413: Missing blank line after last section
# D412: No blank lines allowed between a section header and its content
# E731: do not assign a lambda expression, use a def
-ignore =
C401,C402,C405,E402,D105,D211,FI10,FI12,FI13,FI15,FI16,FI17,FI5,H101,H201,H236,H301,H404,H405,I100,I101,N802,N803,N806,D211,D102,D401,E241,E305,D413,D103,D412,E731
+ignore =
C401,C402,C405,E402,D105,D211,FI10,FI12,FI13,FI15,FI16,FI17,FI5,H101,H201,H236,H301,H404,H405,I100,I101,N802,N803,N806,D211,D102,D401,E241,D413,D103,D412,E731
exclude = .tox,.git,./*.egg,ez_setup.py,build,externals,user-config.py,./scripts/i18n/*
min-version = 2.6
max_line_length = 100
--
To view, visit
https://gerrit.wikimedia.org/r/351008
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I85c3223a5fc76b614d97c9f9492e8edd36245545
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>