jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Improved flake8/flake8-docstring handling
......................................................................
[FIX] Improved flake8/flake8-docstring handling
In 5426720bfe83e37aec032e8afcd9470294293ac4 the textlib redirects
have been dynamically deprecated, but because flake8 is unable to
detect that __all__ gets concatinated a workaround was used which
'fixed' flake8. But pep257 throws an AllError as soon as __all__
appears somewhere else. pep257 also throws an AllError, when the
content of the list doesn't begin in the same line as the __all__.
This also fixes the warning pep257 returned, when __all__ wasn't
a tuple in tests/__init__.
Change-Id: I6dc66f0082ae594c63b99c8c022ab38cdc705dec
---
M pywikibot/__init__.py
M tests/__init__.py
2 files changed, 21 insertions(+), 20 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 6804291..add9a33 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -57,28 +57,29 @@
'replaceCategoryInPlace', 'compileLinkR',
'extract_templates_and_params',
)
-__all__ = (
- 'config', 'ui', 'UnicodeMixin', 'translate',
- 'Page', 'FilePage', 'ImagePage', 'Category',
'Link', 'User',
- 'ItemPage', 'PropertyPage', 'Claim', 'TimeStripper',
- 'html2unicode', 'url2unicode', 'unicode2html',
- 'stdout', 'output', 'warning', 'error',
'critical', 'debug', 'exception',
- 'input', 'inputChoice', 'handleArgs', 'showHelp',
'ui', 'log',
- 'calledModuleName', 'Bot', 'WikidataBot',
- 'Error', 'InvalidTitle', 'BadTitle', 'NoPage',
'SectionError',
- 'NoSuchSite', 'NoUsername', 'UserBlocked',
- 'PageRelatedError', 'IsRedirectPage', 'IsNotRedirectPage',
- 'PageNotSaved', 'UploadWarning', 'LockedPage',
'EditConflict',
- 'ServerError', 'FatalServerError', 'Server504Error',
- 'CaptchaError', 'SpamfilterError', 'CircularRedirect',
- 'WikiBaseError', 'CoordinateGlobeUnknownException',
- 'QuitKeyboardInterrupt',
-)
+# pep257 doesn't understand when the first entry is on the next line
+__all__ = ('config', 'ui', 'UnicodeMixin', 'translate',
+ 'Page', 'FilePage', 'ImagePage', 'Category',
'Link', 'User',
+ 'ItemPage', 'PropertyPage', 'Claim',
'TimeStripper',
+ 'html2unicode', 'url2unicode', 'unicode2html',
+ 'stdout', 'output', 'warning', 'error',
'critical', 'debug', 'exception',
+ 'input', 'inputChoice', 'handleArgs',
'showHelp', 'ui', 'log',
+ 'calledModuleName', 'Bot', 'WikidataBot',
+ 'Error', 'InvalidTitle', 'BadTitle', 'NoPage',
'SectionError',
+ 'NoSuchSite', 'NoUsername', 'UserBlocked',
+ 'PageRelatedError', 'IsRedirectPage',
'IsNotRedirectPage',
+ 'PageNotSaved', 'UploadWarning', 'LockedPage',
'EditConflict',
+ 'ServerError', 'FatalServerError', 'Server504Error',
+ 'CaptchaError', 'SpamfilterError',
'CircularRedirect',
+ 'WikiBaseError', 'CoordinateGlobeUnknownException',
+ 'QuitKeyboardInterrupt',
+ )
# flake8 is unable to detect concatenation in the same operation
# like:
# ) + textlib_methods
+# pep257 also doesn't support __all__ multiple times in a document
# so instead use this trick
-globals()['__all__'] = __all__ + textlib_methods
+globals()['__all__'] = globals()['__all__'] + textlib_methods
for _name in textlib_methods:
target = getattr(textlib, _name)
diff --git a/tests/__init__.py b/tests/__init__.py
index 96c3f95..4670c9b 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -9,8 +9,8 @@
import os
import sys
-__all__ = ['httplib2', 'OrderedDict', '_cache_dir',
'TestRequest',
- 'patch_request', 'unpatch_request']
+__all__ = ('httplib2', 'OrderedDict', '_cache_dir',
'TestRequest',
+ 'patch_request', 'unpatch_request')
# Verify that the unit tests have a base working environment:
# - httplib2 is mandatory
--
To view, visit
https://gerrit.wikimedia.org/r/157765
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6dc66f0082ae594c63b99c8c022ab38cdc705dec
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Nullzero <nullzero.free(a)gmail.com>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>