jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/489187 )
Change subject: [doc] Update licence
......................................................................
[doc] Update licence
Change-Id: I323780b0917572885ac4e5a806ae0b09ae4c8f25
---
M LICENSE
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/LICENSE b/LICENSE
index 62eed72..f29b9c2 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2003-2018 Pywikibot team
+Copyright (c) 2003-2019 Pywikibot team
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
--
To view, visit https://gerrit.wikimedia.org/r/489187
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: I323780b0917572885ac4e5a806ae0b09ae4c8f25
Gerrit-Change-Number: 489187
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
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/489208 )
Change subject: config2.py: Rename some of the private variable
......................................................................
config2.py: Rename some of the private variable
- Rename _uc to _exec_globals. This dict contains the variables that
will be passed to exec function as globals context.
- Rename _glv to _public_globals. This dict contains the global variables
that do not start with a '_' and are not imported.
- Remove the _gl variable and use _public_globals.keys() directly.
- The _tp variable was not used anywhere, remove _tp and loop that was
filling it.
- Use set instead of list when the collection is used for look-up.
Sets are more efficient for look-ups.
Change-Id: I34fb3f8ac2dfb195891efb97b5000e8fbc078b27
---
M pywikibot/config2.py
1 file changed, 22 insertions(+), 25 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 0baeedf..827776e 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -108,10 +108,10 @@
# variables that are intended only for internal use and not to be exported
# to other modules.
-_private_values = ['authenticate', 'proxy', 'db_password']
-_deprecated_variables = ['use_SSL_onlogin', 'use_SSL_always',
+_private_values = {'authenticate', 'proxy', 'db_password'}
+_deprecated_variables = {'use_SSL_onlogin', 'use_SSL_always',
'available_ssl_project', 'fake_user_agent',
- 'special_page_limit']
+ 'special_page_limit'}
# ############# ACCOUNT SETTINGS ##############
@@ -1013,27 +1013,24 @@
# System-level and User-level changes.
# Store current variables and their types.
-_glv = {_key: _val for _key, _val in globals().items()
- if _key[0] != '_' and _key not in _imports}
-_gl = list(_glv.keys())
-_tp = {}
-for _key in _gl:
- _tp[_key] = type(globals()[_key])
+_public_globals = {
+ _key: _val for _key, _val in globals().items()
+ if _key[0] != '_' and _key not in _imports}
# Create an environment for user-config.py which is
# a shallow copy of the core config settings, so that
# we can detect modified config items easily.
-_uc = {}
-for _key, _val in _glv.items():
+_exec_globals = {}
+for _key, _val in _public_globals.items():
if isinstance(_val, dict):
if isinstance(_val, collections.defaultdict):
- _uc[_key] = collections.defaultdict(dict)
+ _exec_globals[_key] = collections.defaultdict(dict)
else:
- _uc[_key] = {}
+ _exec_globals[_key] = {}
if len(_val) > 0:
- _uc[_key].update(_val)
+ _exec_globals[_key].update(_val)
else:
- _uc[_key] = _val
+ _exec_globals[_key] = _val
# Get the user files
if __no_user_config:
@@ -1048,7 +1045,7 @@
if OSWIN32 or _fileuid in [os.getuid(), 0]:
if OSWIN32 or _filemode & 0o02 == 0:
with open(_filename, 'rb') as f:
- exec(compile(f.read(), _filename, 'exec'), _uc)
+ exec(compile(f.read(), _filename, 'exec'), _exec_globals)
else:
warning("Skipped '%(fn)s': writeable by others."
% {'fn': _filename})
@@ -1109,26 +1106,26 @@
.format(name), UserWarning)
-_check_user_config_types(_uc, _glv, _imports)
+_check_user_config_types(_exec_globals, _public_globals, _imports)
# Copy the user config settings into globals
-_modified = [_key for _key in _gl
- if _uc[_key] != globals()[_key]
- or _key in ('usernames', 'sysopnames', 'disambiguation_comment')]
+_modified = {_key for _key in _public_globals.keys()
+ if _exec_globals[_key] != globals()[_key]
+ or _key in {'usernames', 'sysopnames', 'disambiguation_comment'}}
-if ('user_agent_format' in _modified):
+if 'user_agent_format' in _modified:
_right_user_agent_format = re.sub(r'{httplib2(:|})', r'{http_backend\1',
- _uc['user_agent_format'])
- if _right_user_agent_format != _uc['user_agent_format']:
+ _exec_globals['user_agent_format'])
+ if _right_user_agent_format != _exec_globals['user_agent_format']:
warn('`{httplib2}` in user_agent_format is deprecated, '
'will replace `{httplib2}` with `{http_backend}`',
_ConfigurationDeprecationWarning)
- _uc['user_agent_format'] = _right_user_agent_format
+ _exec_globals['user_agent_format'] = _right_user_agent_format
del _right_user_agent_format
for _key in _modified:
- globals()[_key] = _uc[_key]
+ globals()[_key] = _exec_globals[_key]
if _key in _deprecated_variables:
warn('"{0}" present in our user-config.py is no longer a supported '
--
To view, visit https://gerrit.wikimedia.org/r/489208
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: I34fb3f8ac2dfb195891efb97b5000e8fbc078b27
Gerrit-Change-Number: 489208
Gerrit-PatchSet: 3
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(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/489172 )
Change subject: [doc] Update copyright for pywikibot team
......................................................................
[doc] Update copyright for pywikibot team
Change-Id: Id7e45e662d9f1ce0544b21e83287b5e2b5daf760
---
M docs/conf.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
D3r1ck01: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/conf.py b/docs/conf.py
index 52a1f7a..5251c73 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Configuration file for Sphinx."""
#
-# (C) Pywikibot team, 2014-2018
+# (C) Pywikibot team, 2014-2019
#
# Distributed under the terms of the MIT license.
#
@@ -62,7 +62,7 @@
# General information about the project.
project = 'Pywikibot'
-copyright = '2003-2018, Pywikibot team'
+copyright = '2003-2019, Pywikibot team'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
--
To view, visit https://gerrit.wikimedia.org/r/489172
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: Id7e45e662d9f1ce0544b21e83287b5e2b5daf760
Gerrit-Change-Number: 489172
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
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/489169 )
Change subject: [spelling] Fix spelling mistakes
......................................................................
[spelling] Fix spelling mistakes
Change-Id: I4e277c03b394b987624c7ce2b1704acb4f466f34
---
M pywikibot/bot.py
M pywikibot/comms/eventstreams.py
M pywikibot/date.py
M pywikibot/page.py
M pywikibot/tools/djvu.py
M pywikibot/userinterfaces/transliteration.py
M scripts/followlive.py
M scripts/replace.py
M scripts/table2wiki.py
M tests/djvu_tests.py
M tests/site_detect_tests.py
M tests/site_tests.py
12 files changed, 29 insertions(+), 29 deletions(-)
Approvals:
D3r1ck01: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index eebfb10..ae1e335 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -48,7 +48,7 @@
used.
"""
#
-# (C) Pywikibot team, 2008-2018
+# (C) Pywikibot team, 2008-2019
#
# Distributed under the terms of the MIT license.
#
@@ -1071,7 +1071,7 @@
"""
messages = []
if exception:
- messages.append('An error occured: "{}".'.format(exception))
+ messages.append('An error occurred: "{}".'.format(exception))
if missing_generator:
messages.append(
'Unable to execute script because no generator was defined.')
diff --git a/pywikibot/comms/eventstreams.py b/pywikibot/comms/eventstreams.py
index 8181194..710bebd 100644
--- a/pywikibot/comms/eventstreams.py
+++ b/pywikibot/comms/eventstreams.py
@@ -9,7 +9,7 @@
"""
#
# (C) xqt, 2017-2018
-# (C) Pywikibot team, 2017-2018
+# (C) Pywikibot team, 2017-2019
#
# Distributed under the terms of the MIT license.
#
@@ -321,7 +321,7 @@
elif event.event == 'error':
warning('Encountered error: {0}'.format(event.data))
else:
- warning('Unknown event {0} occured.'.format(event.event))
+ warning('Unknown event {0} occurred.'.format(event.event))
else:
debug('{0}: Stopped iterating due to '
'exceeding item limit.'
diff --git a/pywikibot/date.py b/pywikibot/date.py
index 96ec25b..683a37f 100644
--- a/pywikibot/date.py
+++ b/pywikibot/date.py
@@ -7,7 +7,7 @@
# (C) Andre Engels, 2004-2005
# (C) Yuri Astrakhan, 2005-2006 (<Firstname><Lastname>@gmail.com)
# (years/decades/centuries/millenniums str <=> int conversions)
-# (C) Pywikibot team, 2004-2018
+# (C) Pywikibot team, 2004-2019
#
# Distributed under the terms of the MIT license.
#
@@ -376,7 +376,7 @@
Returns a compiled regex object and a list of digit decoders.
"""
if pattern not in _escPtrnCache2:
- newPattern = '^' # begining of the string
+ newPattern = '^' # beginning of the string
strPattern = ''
decoders = []
for s in _reParameters.split(pattern):
@@ -2140,7 +2140,7 @@
waMonthNames = ['djanvî', 'fevrî', 'måss', 'avri', 'may', 'djun', 'djulete',
'awousse', 'setimbe', 'octôbe', 'nôvimbe', 'decimbe']
-# For month names begining with a consonant...
+# For month names beginning with a consonant...
for i in (0, 1, 2, 4, 5, 6, 8, 10, 11):
formats[dayMnthFmts[i]]['wa'] = eval(
'lambda m: multi(m, ['
@@ -2150,7 +2150,7 @@
'(lambda v: dh_dayOfMnth(v, "%%d di %s"), alwaysTrue)])'
% (waMonthNames[i], waMonthNames[i], waMonthNames[i]))
-# For month names begining with a vowel...
+# For month names beginning with a vowel...
for i in (3, 7, 9):
formats[dayMnthFmts[i]]['wa'] = eval(
'lambda m: multi(m, ['
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 1fbd1c2..f3c1421 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -2722,7 +2722,7 @@
return sha1 == revision.sha1
else:
pywikibot.warning(
- 'Unsuccesfull request (%s): %s' % (req.status, req.uri))
+ 'Unsuccessfull request (%s): %s' % (req.status, req.uri))
return False
def globalusage(self, total=None):
diff --git a/pywikibot/tools/djvu.py b/pywikibot/tools/djvu.py
index 381d816..67a28e2 100644
--- a/pywikibot/tools/djvu.py
+++ b/pywikibot/tools/djvu.py
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
"""Wrapper around djvulibre to access djvu files properties and content."""
#
-# (C) Pywikibot team, 2015-2018
+# (C) Pywikibot team, 2015-2019
#
# Distributed under the terms of the MIT license.
#
@@ -63,7 +63,7 @@
"""Wrapper around djvulibre to access djvu files properties and content.
- Perform file existance checks.
+ Perform file existence checks.
Control characters in djvu text-layer are converted for convenience
(see http://djvu.sourceforge.net/doc/man/djvused.html for control chars
diff --git a/pywikibot/userinterfaces/transliteration.py b/pywikibot/userinterfaces/transliteration.py
index 1aae431..739e2c4 100644
--- a/pywikibot/userinterfaces/transliteration.py
+++ b/pywikibot/userinterfaces/transliteration.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Module to transliterate text."""
#
-# (C) Pywikibot team, 2006-2018
+# (C) Pywikibot team, 2006-2019
#
# Distributed under the terms of the MIT license.
#
@@ -119,7 +119,7 @@
'х': 'kh', 'Ц': 'C', 'ц': 'c', 'Ч': 'Ch', 'ч': 'ch', 'Ш': 'Sh', 'ш': 'sh',
'Щ': 'Shch', 'щ': 'shch', 'Ь': "'", 'ь': "'", 'Ъ': '"', 'ъ': '"',
'Ю': 'Yu', 'ю': 'yu', 'Я': 'Ya', 'я': 'ya', 'Х': 'Kh', 'Χ': 'Kh',
- # Additional Cyrillic letters, most occuring in only a few languages
+ # Additional Cyrillic letters, most occurring in only a few languages
'Ы': 'Y', 'ы': 'y', 'Ё': 'Ë', 'ё': 'ë', 'Э': 'È', 'Ѐ': 'È', 'э': 'è',
'ѐ': 'è', 'І': 'I', 'і': 'i', 'Ї': 'Ji', 'ї': 'ji', 'Є': 'Je', 'є': 'je',
'Ґ': 'G', 'Ҝ': 'G', 'ґ': 'g', 'ҝ': 'g', 'Ђ': 'Dj', 'ђ': 'dj', 'Љ': 'Lj',
diff --git a/scripts/followlive.py b/scripts/followlive.py
index e18b5ad..f4abc3f 100644
--- a/scripts/followlive.py
+++ b/scripts/followlive.py
@@ -458,7 +458,7 @@
{'content': self.content}))
except pywikibot.EditConflict:
pywikibot.output(
- 'An edit conflict occured! Automatically retrying')
+ 'An edit conflict occurred! Automatically retrying')
self.handle_bad_page(self)
return
if answer == '':
@@ -526,7 +526,7 @@
@type page: pywikibot.Page
@ivar date: creation date
@type date: str in ISO8601 format
- @ivar length: content lenght
+ @ivar length: content length
@type length: int
@ivar user: creator of page
@type user: pywikibot.User
diff --git a/scripts/replace.py b/scripts/replace.py
index 9275494..cb625fa 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -137,7 +137,7 @@
"""
#
# (C) Daniel Herding, 2004-2012
-# (C) Pywikibot team, 2004-2018
+# (C) Pywikibot team, 2004-2019
#
# Distributed under the terms of the MIT license.
#
@@ -672,7 +672,7 @@
return new_text
def _count_changes(self, page, err):
- """Count succesfully changed pages; log changed titles for display."""
+ """Count successfully changed pages; log changed titles for display."""
# This is an async put callback
if not isinstance(err, Exception):
self.changed_pages += 1
@@ -890,7 +890,7 @@
'text-contains': [],
'inside': [],
'inside-tags': [],
- 'require-title': [], # using a seperate requirements dict needs some
+ 'require-title': [], # using a separate requirements dict needs some
} # major refactoring of code.
# Should the elements of 'replacements' and 'exceptions' be interpreted
diff --git a/scripts/table2wiki.py b/scripts/table2wiki.py
index 5926835..97e9f93 100644
--- a/scripts/table2wiki.py
+++ b/scripts/table2wiki.py
@@ -103,7 +103,7 @@
If the table already is a
wiki table or contains a nested wiki table, tries to beautify it.
- Returns the converted table, the number of warnings that occured and
+ Returns the converted table, the number of warnings that occurred and
a list containing these warnings.
Hint: if you give an entire page text as a parameter instead of a table
only, this function will convert all HTML tables and will also try to
@@ -177,7 +177,7 @@
r'\r\n! \g<header>\r\n', new_table)
if n > 0:
warning_messages.append(
- 'WARNING: found <th> without </th>. ({0} occurences)\n'
+ 'WARNING: found <th> without </th>. ({0} occurrences)\n'
.format(n))
warnings += n
@@ -187,7 +187,7 @@
r'\n!\g<attr> | \g<header>\r\n', new_table)
if n > 0:
warning_messages.append(
- 'WARNING: found <th ...> without </th>. ({0} occurences\n)'
+ 'WARNING: found <th ...> without </th>. ({0} occurrences\n)'
.format(n))
warnings += n
@@ -222,7 +222,7 @@
r'\r\n| \g<cell>\r\n', new_table)
if n > 0:
warning_messages.append(
- '<td> used where </td> was expected. ({0} occurences)\n'
+ '<td> used where </td> was expected. ({0} occurrences)\n'
.format(n))
warnings += n
@@ -233,7 +233,7 @@
if n > 0:
warning_messages.append(
"WARNING: (sorry, bot code unreadable (1). I don't know why "
- 'this warning is given.) ({0} occurences)\n'.format(n))
+ 'this warning is given.) ({0} occurrences)\n'.format(n))
# fail save. sometimes people forget </td>
# <td> without arguments, with missing </td>
@@ -441,7 +441,7 @@
Convert all HTML tables in text to wiki syntax.
Returns the converted text, the number of converted tables and the
- number of warnings that occured.
+ number of warnings that occurred.
"""
text = self.markActiveTables(text)
diff --git a/tests/djvu_tests.py b/tests/djvu_tests.py
index ffc65bb..f4d833a 100644
--- a/tests/djvu_tests.py
+++ b/tests/djvu_tests.py
@@ -3,7 +3,7 @@
"""Unit tests for djvu.py."""
#
-# (C) Pywikibot team, 2015-2018
+# (C) Pywikibot team, 2015-2019
#
# Distributed under the terms of the MIT license.
#
@@ -73,7 +73,7 @@
else:
self.assertEqual(djvu.__unicode__(), expected)
- def test_file_existance(self):
+ def test_file_existence(self):
"""Test file existence checks."""
djvu = DjVuFile(self.file_djvu)
self.assertEqual(os.path.abspath(self.file_djvu), djvu.file)
diff --git a/tests/site_detect_tests.py b/tests/site_detect_tests.py
index 076393f..ec15e58 100644
--- a/tests/site_detect_tests.py
+++ b/tests/site_detect_tests.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Test for site detection."""
#
-# (C) Pywikibot team, 2014-2018
+# (C) Pywikibot team, 2014-2019
#
# Distributed under the terms of the MIT license.
#
@@ -266,7 +266,7 @@
def test_musicbrainz(self):
"""Test http://musicbrainz.org/doc/ which has a page 'api.php'.
- Possible false positive caused by the existance of a page called
+ Possible false positive caused by the existence of a page called
http://musicbrainz.org/doc/api.php.
"""
self.assertNoSite('http://musicbrainz.org/doc/$1')
diff --git a/tests/site_tests.py b/tests/site_tests.py
index e42bee2..86b654f 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -2699,7 +2699,7 @@
total=5))
def test_backlinks_redirects_length(self):
- """Test backlinks redirects lenght."""
+ """Test backlinks redirects length."""
self.assertEqual(len(self.backlinks), 1)
self.assertEqual(len(self.references), 1)
self.assertEqual(len(self.nofollow), 1)
--
To view, visit https://gerrit.wikimedia.org/r/489169
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: I4e277c03b394b987624c7ce2b1704acb4f466f34
Gerrit-Change-Number: 489169
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
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/489142 )
Change subject: config2.py: Remove an unnecessary for loop
......................................................................
config2.py: Remove an unnecessary for loop
_fns is either empty or has a single item. Only run the block of code
if it is not empty and using its only _filename.
Change-Id: I4c1f07405c868d02ca009808cd95d44bbd214f9e
---
M pywikibot/config2.py
1 file changed, 1 insertion(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 8b42641..0baeedf 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -1039,10 +1039,8 @@
if __no_user_config:
if __no_user_config != '2':
warning('Skipping loading of user-config.py.')
- _fns = []
else:
- _fns = [os.path.join(base_dir, 'user-config.py')]
-for _filename in _fns:
+ _filename = os.path.join(base_dir, 'user-config.py')
if os.path.exists(_filename):
_filestatus = os.stat(_filename)
_filemode = _filestatus[0]
--
To view, visit https://gerrit.wikimedia.org/r/489142
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: I4c1f07405c868d02ca009808cd95d44bbd214f9e
Gerrit-Change-Number: 489142
Gerrit-PatchSet: 1
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
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/482535 )
Change subject: [bugfix] import MWSite in generate_family_file.py when needed
......................................................................
[bugfix] import MWSite in generate_family_file.py when needed
generate_family_files_tests.py needs MWSite being imported but it wasn't
since the import was only done when started as script.
Now import the MWSite class when the FamilyFileGenerator class is created.
Bug: T212998
Change-Id: I57c5258913f9b14e3e73de0d05077c873da9c328
---
M generate_family_file.py
1 file changed, 10 insertions(+), 7 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/generate_family_file.py b/generate_family_file.py
index a73e3ec..97eac88 100755
--- a/generate_family_file.py
+++ b/generate_family_file.py
@@ -3,7 +3,7 @@
"""This script generates a family file from a given URL."""
#
# (C) Merlijn van Deen, 2010-2013
-# (C) Pywikibot team, 2010-2018
+# (C) Pywikibot team, 2010-2019
#
# Distributed under the terms of the MIT license
#
@@ -16,6 +16,7 @@
import sys
from os import environ, getenv
+
# creating & retrieving urls
if sys.version_info[0] > 2:
from urllib.parse import urlparse
@@ -30,6 +31,12 @@
def __init__(self, url=None, name=None, dointerwiki=None):
"""Initializer."""
+ # from pywikibot.site_detect import MWSite
+ # when required but disable user-config checks
+ # so the family can be created first,
+ # and then used when generating the user-config
+ self.Wiki = _import_with_no_user_config(
+ 'pywikibot.site_detect').site_detect.MWSite
if url is None:
url = raw_input('Please insert URL to wiki: ')
if name is None:
@@ -45,7 +52,7 @@
"""Main method, generate family file."""
print('Generating family file from ' + self.base_url)
- w = Wiki(self.base_url)
+ w = self.Wiki(self.base_url)
self.wikis[w.lang] = w
print('\n=================================='
'\nAPI url: {w.api}'
@@ -104,7 +111,7 @@
print(' * %s... ' % (lang['prefix']), end='')
if lang['prefix'] not in self.wikis:
try:
- self.wikis[lang['prefix']] = Wiki(lang['url'])
+ self.wikis[lang['prefix']] = self.Wiki(lang['url'])
print('downloaded')
except Exception as e:
print(e)
@@ -211,10 +218,6 @@
if __name__ == '__main__':
- # Disable user-config checks so the family can be created first,
- # and then used when generating the user-config
- Wiki = _import_with_no_user_config(
- 'pywikibot.site_detect').site_detect.MWSite
if len(sys.argv) != 3:
print("""
Usage: {module} <url> <short name>
--
To view, visit https://gerrit.wikimedia.org/r/482535
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: I57c5258913f9b14e3e73de0d05077c873da9c328
Gerrit-Change-Number: 482535
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: 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)