jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/516460 )
Change subject: [IMPR] Reduce deprecated stuff in requests-requirements.txt
......................................................................
[IMPR] Reduce deprecated stuff in requests-requirements.txt
The file still needs to be updated on every change of requests dependency. This
patch will move the dependency to setup.py.
The dot installs pywikibot, requests, requests dependencies and requests
security per the specification in setup.py.
Detached from I9cf5fa2acaf65
Bug: T193476
Change-Id: I6618d680fd5d2ce57b1a8c9ee79abf7ab59d20ab
---
M requests-requirements.txt
1 file changed, 4 insertions(+), 5 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/requests-requirements.txt b/requests-requirements.txt
index 36e99b6..6518e15 100644
--- a/requests-requirements.txt
+++ b/requests-requirements.txt
@@ -1,6 +1,5 @@
# This file is DEPRECATED! Use `pip install pywikibot[security]` instead.
-
-requests>=2.20.0
-
-# requests security extra
-requests[security] ; python_full_version > '2.7.6' and python_full_version < '2.7.9'
+#
+# The period below installs pywikibot[security] from setup.py automatically
+# on Python < 2.7.9.
+.
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/516460
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I6618d680fd5d2ce57b1a8c9ee79abf7ab59d20ab
Gerrit-Change-Number: 516460
Gerrit-PatchSet: 9
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/516185 )
Change subject: [bugfix] Add closed_wikis to Family.langs property
......................................................................
[bugfix] Add closed_wikis to Family.langs property
Wikibase items may contain links to closed sites and newly implemented
badges for sitelinks may fail due to closed wikis. Therefore append
closed_wikis to the Family.langs property
Also remove 'beta' appended to languages_by_size. languages_by_size is used
to calculate family.codes; beta is included in test_codes list. Appending it
to languages_by_size duplicates 'beta' in family.codes.
Note: Creating a site for a closed wiki will return a RemovedSite object.
Bug: T225413
Change-Id: Id9f3ca35d6ba634f151543afe749e7521cf163ec
---
M pywikibot/families/wikisource_family.py
M pywikibot/family.py
2 files changed, 5 insertions(+), 2 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/families/wikisource_family.py b/pywikibot/families/wikisource_family.py
index 39d0eb2..9c09d71 100644
--- a/pywikibot/families/wikisource_family.py
+++ b/pywikibot/families/wikisource_family.py
@@ -64,7 +64,7 @@
cls.domains.append(cls.langs['beta'])
return cls.domains
- languages_by_size += ['mul', 'beta']
+ languages_by_size.append('mul')
# Global bot allowed languages on
# https://meta.wikimedia.org/wiki/BPI#Current_implementation
diff --git a/pywikibot/family.py b/pywikibot/family.py
index 1437dd1..1ef3d45 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -1569,8 +1569,11 @@
def langs(cls):
"""Property listing family languages."""
codes = cls.codes
+
if hasattr(cls, 'test_codes'):
- codes = codes + cls.test_codes
+ codes += cls.test_codes
+ if hasattr(cls, 'closed_wikis'):
+ codes += cls.closed_wikis
# shortcut this classproperty
cls.langs = {code: '{0}.{1}'.format(code, cls.domain)
--
To view, visit https://gerrit.wikimedia.org/r/516185
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Id9f3ca35d6ba634f151543afe749e7521cf163ec
Gerrit-Change-Number: 516185
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/508278 )
Change subject: [IMPR] Reduce code complexity of welcome.py
......................................................................
[IMPR] Reduce code complexity of welcome.py
- split main function into parts to reduce code complexity
reported by codeclimate as "critical"
- remove issue_deprecation_warning which is 3 years old and replace it with
a simple warning of unknown option.
Change-Id: I4c23bf754872ba48c496862104bfe48aa37a1e94
---
M scripts/welcome.py
1 file changed, 32 insertions(+), 22 deletions(-)
Approvals:
Lokal Profil: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/welcome.py b/scripts/welcome.py
index df48877..bacf376 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -181,7 +181,7 @@
from pywikibot import config, i18n
from pywikibot.exceptions import HiddenKeyError
from pywikibot.tools.formatter import color_format
-from pywikibot.tools import issue_deprecation_warning, PY2, UnicodeType
+from pywikibot.tools import PY2, UnicodeType
if PY2:
import cPickle as pickle # noqa: N813
@@ -922,9 +922,25 @@
globalvar = Global()
-def main(*args):
- """
- Process command line arguments and invoke bot.
+def _handle_offset(val):
+ """Handle -offset arg."""
+ if not val:
+ val = pywikibot.input(
+ 'Which time offset for new users would you like to use? '
+ '(yyyymmddhhmmss or yyyymmdd)')
+ try:
+ globalvar.offset = pywikibot.Timestamp.fromtimestampformat(val)
+ except ValueError:
+ # upon request, we could check for software version here
+ raise ValueError(fill(
+ 'Mediawiki has changed, -offset:# is not supported anymore, but '
+ '-offset:TIMESTAMP is, assuming TIMESTAMP is yyyymmddhhmmss or '
+ 'yyyymmdd. -timeoffset is now also supported. Please read this '
+ 'script source header for documentation.'))
+
+
+def handle_args(args):
+ """Process command line arguments.
If args is an empty list, sys.argv is used.
@@ -932,7 +948,7 @@
@type args: str
"""
for arg in pywikibot.handle_args(args):
- arg, sep, val = arg.partition(':')
+ arg, _, val = arg.partition(':')
if arg == '-edit':
globalvar.attachEditCount = int(val or pywikibot.input(
'After how many edits would you like to welcome new users? '
@@ -946,20 +962,7 @@
'For how many seconds would you like to bot to sleep before '
'checking again?'))
elif arg == '-offset':
- if not val:
- val = pywikibot.input(
- 'Which time offset for new users would you like to use? '
- '(yyyymmddhhmmss or yyyymmdd)')
- try:
- globalvar.offset = pywikibot.Timestamp.fromtimestampformat(val)
- except ValueError:
- # upon request, we could check for software version here
- raise ValueError(fill(
- 'Mediawiki has changed, -offset:# is not supported '
- 'anymore, but -offset:TIMESTAMP is, assuming TIMESTAMP is '
- 'yyyymmddhhmmss or yyyymmdd. -timeoffset is now also '
- 'supported. Please read this script source header for '
- 'documentation.'))
+ _handle_offset(val)
elif arg == '-file':
globalvar.randomSign = True
globalvar.signFileName = val or pywikibot.input(
@@ -991,10 +994,17 @@
'welcome log?'))
elif arg == '-quiet':
globalvar.quiet = True
- elif arg == '-quick':
- issue_deprecation_warning('The usage of "-quick" option', None, 2,
- since='20160211')
+ else:
+ pywikibot.warning('Unknown option "{}"'.format(arg))
+
+def main(*args):
+ """Invoke bot.
+
+ @param args: command line arguments
+ @type args: str
+ """
+ handle_args(args)
# Filename and Pywikibot path
# file where is stored the random signature index
filename = pywikibot.config.datafilepath('welcome-%s-%s.data'
--
To view, visit https://gerrit.wikimedia.org/r/508278
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I4c23bf754872ba48c496862104bfe48aa37a1e94
Gerrit-Change-Number: 508278
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Lokal Profil <andre.costa(a)wikimedia.se>
Gerrit-Reviewer: jenkins-bot (75)