jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/467076 )
Change subject: [fix] Fixed cleanup regression error
......................................................................
[fix] Fixed cleanup regression error
Fix regression TypeError, "pg" is a page object and
not a string.
Bug: T206912
Change-Id: I10815cf1a1212e786702ba325dd30e9ef0c6a4ae
---
M scripts/archivebot.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index e501dd8..8028f5f 100755
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -785,7 +785,7 @@
pagelist.append(pywikibot.Page(site, pagename, ns=3))
pagelist = sorted(pagelist)
for pg in iter(pagelist):
- pywikibot.output('Processing ' + pg)
+ pywikibot.output('Processing {}'.format(pg))
# Catching exceptions, so that errors in one page do not bail out
# the entire process
try:
--
To view, visit https://gerrit.wikimedia.org/r/467076
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: I10815cf1a1212e786702ba325dd30e9ef0c6a4ae
Gerrit-Change-Number: 467076
Gerrit-PatchSet: 2
Gerrit-Owner: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/464956 )
Change subject: [cleanup] minor cleanup of scripts/category.py
......................................................................
[cleanup] minor cleanup of scripts/category.py
- some minor grammatical cleanup.
- typo fix in some cases.
Periods added to @param anotation as there are actual
statements describing the params but for @type, these
are just return types so no period needed.
Change-Id: I9fcbb0b9fd077bfe6b539ed20ec197362f7c7860
---
M scripts/category.py
1 file changed, 51 insertions(+), 52 deletions(-)
Approvals:
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/category.py b/scripts/category.py
index 049aaec..2ba64b6 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -1,26 +1,26 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
-Scripts to manage categories.
+Script to manage categories.
Syntax:
python pwb.py category action [-option]
where action can be one of these:
- * add - mass-add a category to a list of pages
- * remove - remove category tag from all pages in a category
- * move - move all pages in a category to another category
- * tidy - tidy up a category by moving its pages into subcategories
- * tree - show a tree of subcategories of a given category
- * listify - make a list of all of the articles that are in a category
+ * add - mass-add a category to a list of pages.
+ * remove - remove category tag from all pages in a category.
+ * move - move all pages in a category to another category.
+ * tidy - tidy up a category by moving its pages into subcategories.
+ * tree - show a tree of subcategories of a given category.
+ * listify - make a list of all of the articles that are in a category.
and option can be one of these:
Options for "add" action:
- * -person - sort persons by their last name
- * -create - If a page doesn't exist, do not skip it, create it instead
- * -redirect - Follow redirects
+ * -person - Sort persons by their last name.
+ * -create - If a page doesn't exist, do not skip it, create it instead.
+ * -redirect - Follow redirects.
If action is "add", the following options are supported:
@@ -47,8 +47,8 @@
* -hist - Creates a nice wikitable on the talk page of target category
that contains detailed page history of the source category.
- * -nodelete - Don't delete the old category after move
- * -nowb - Don't update the wikibase repository
+ * -nodelete - Don't delete the old category after move.
+ * -nowb - Don't update the wikibase repository.
* -allowsplit - If that option is not set, it only moves the talk and main
page together.
* -mvtogether - Only move the pages/subcategories of a category, if the
@@ -68,16 +68,16 @@
Options for several actions:
- * -rebuild - reset the database
+ * -rebuild - Reset the database.
* -from: - The category to move from (for the move option)
Also, the category to remove from in the remove option
- Also, the category to make a list of in the listify option
- * -to: - The category to move to (for the move option)
- - Also, the name of the list to make in the listify option
+ Also, the category to make a list of in the listify option.
+ * -to: - The category to move to (for the move option).
+ - Also, the name of the list to make in the listify option.
NOTE: If the category names have spaces in them you may need to use
a special syntax in your shell so that the names aren't treated as
separate parameters. For instance, in BASH, use single quotes,
- e.g. -from:'Polar bears'
+ e.g. -from:'Polar bears'.
* -batch - Don't prompt to delete emptied categories (do it
automatically).
* -summary: - Pick a custom edit summary for the bot.
@@ -85,7 +85,7 @@
rearranging them.
* -recurse - Recurse through all subcategories of categories.
* -pagesonly - While removing pages from a category, keep the subpage links
- and do not remove them
+ and do not remove them.
* -match - Only work on pages whose titles match the given regex (for
move and remove actions).
* -depth: - The max depth limit beyond which no subcategories will be
@@ -190,9 +190,9 @@
"""
Return page to be categorized by type.
- @param page: Existing, missing or redirect page to be processed
+ @param page: Existing, missing or redirect page to be processed.
@type page: pywikibot.Page
- @return: Page to be categorized
+ @return: Page to be categorized.
@rtype: pywikibot.Page or None
"""
if page.exists():
@@ -239,11 +239,11 @@
Also the doc page can be changed by doc template parameter.
- TODO: decide if/how to enable/disable this feature
+ TODO: decide if/how to enable/disable this feature.
- @param page: Page to be processed
+ @param page: Page to be processed.
@type page: pywikibot.Page
- @return: Page to be categorized
+ @return: Page to be categorized.
@rtype: pywikibot.Page
"""
includeonly = []
@@ -322,8 +322,8 @@
def getSubcats(self, supercat):
"""Return the list of subcategories for a given supercategory.
- Saves this list in a temporary database so that it won't be loaded from
- the server next time it's required.
+ Saves this list in a temporary database so that it won't be loaded
+ from the server next time it's required.
"""
self._load()
# if we already know which subcategories exist here
@@ -339,11 +339,11 @@
def getArticles(self, cat):
"""Return the list of pages for a given category.
- Saves this list in a temporary database so that it won't be loaded from
- the server next time it's required.
+ Saves this list in a temporary database so that it won't be loaded
+ from the server next time it's required.
"""
self._load()
- # if we already know which articles exist here
+ # if we already know which articles exist here.
if cat in self.catContentDB:
return self.catContentDB[cat][1]
else:
@@ -356,7 +356,7 @@
def getSupercats(self, subcat):
"""Return the supercategory (or a set of) for a given subcategory."""
self._load()
- # if we already know which subcategories exist here
+ # if we already know which subcategories exist here.
if subcat in self.superclassDB:
return self.superclassDB[subcat]
else:
@@ -421,13 +421,13 @@
def sorted_by_last_name(self, catlink, pagelink):
"""Return a Category with key that sorts persons by their last name.
- Parameters: catlink - The Category to be linked
- pagelink - the Page to be placed in the category
+ Parameters: catlink - The Category to be linked.
+ pagelink - the Page to be placed in the category.
Trailing words in brackets will be removed. Example: If
category_name is 'Author' and pl is a Page to [[Alexandre Dumas
(senior)]], this function will return this Category:
- [[Category:Author|Dumas, Alexandre]]
+ [[Category:Author|Dumas, Alexandre]].
"""
page_name = pagelink.title()
@@ -980,16 +980,16 @@
helping you to find out what the page is about and in which other
categories it currently is.
- @param cat_title: a title of the category to process
+ @param cat_title: a title of the category to process.
@type: str
- @param cat_db: a CategoryDatabase object
+ @param cat_db: a CategoryDatabase object.
@type: CategoryDatabase object
- @param namespaces: namespaces to focus on
+ @param namespaces: namespaces to focus on.
@type: iterable of pywikibot.Namespace
- @param comment: a custom summary for edits
+ @param comment: a custom summary for edits.
@type: str
"""
@@ -1018,13 +1018,13 @@
NOTE: current_cat is only used for internal recursion. You
should always use current_cat = original_cat.
- @param member: a page to process
+ @param member: a page to process.
@type: pywikibot.Page
- @param original_cat: original category to replace
+ @param original_cat: original category to replace.
@type: pywikibot.Category
- @param current_cat: a category which is questioned
+ @param current_cat: a category which is questioned.
@type: pywikibot.Category
"""
class CatContextOption(ContextOption):
@@ -1052,14 +1052,13 @@
Output categories in one or two columns.
Determine whether the list contains long or short
- category titles and output category titles
- as enumerated options.
+ category titles and output category titles as enumerated
+ options.
- @param cat_list: sorted iterable of category titles
- to output
+ @param cat_list: sorted iterable of category titles to output.
@type: iterable of str
- @param prefix: a prefix to assigned number index
+ @param prefix: a prefix to assigned number index.
@type: str
"""
# can we can output in two columns?
@@ -1102,14 +1101,14 @@
pywikibot.output(color_format(
'>>> {lightpurple}{0}{default} <<<', member.title()))
- # determine a reasonable amount of context
+ # determine a reasonable amount of context.
try:
full_text = member.get()
except pywikibot.NoPage:
pywikibot.output('Page {} not found.'.format(member.title()))
return
- # skip initial templates, images and coments for articles
+ # skip initial templates, images and coments for articles.
if member.namespace() == member.site.namespaces.MAIN:
excludes = ('template', 'file', 'comment')
regexes = textlib._get_regexes(excludes, member.site)
@@ -1228,7 +1227,7 @@
def teardown(self):
"""Cleanups after run operation."""
if self._generator_completed and not self._treat_counter:
- pywikibot.output('There are no pages or files in category {}'
+ pywikibot.output('There are no pages or files in category {}.'
.format(self.cat_title))
def treat(self, page):
@@ -1243,7 +1242,7 @@
Parameters:
* catTitle - The category which will be the tree's root.
- * catDB - A CategoryDatabase object
+ * catDB - A CategoryDatabase object.
* maxDepth - The limit beyond which no subcategories will be listed.
This also guarantees that loops in the category structure
won't be a problem.
@@ -1268,9 +1267,9 @@
up to level maxDepth. Recursively calls itself.
Parameters:
- * cat - the Category of the node we're currently opening
- * currentDepth - the current level in the tree (for recursion)
- * parent - the Category of the category we're coming from
+ * cat - the Category of the node we're currently opening.
+ * currentDepth - the current level in the tree (for recursion).
+ * parent - the Category of the category we're coming from.
"""
result = '#' * currentDepth
@@ -1330,7 +1329,7 @@
If args is an empty list, sys.argv is used.
- @param args: command line arguments
+ @param args: command line arguments.
@type args: unicode
"""
from_given = False
--
To view, visit https://gerrit.wikimedia.org/r/464956
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: I9fcbb0b9fd077bfe6b539ed20ec197362f7c7860
Gerrit-Change-Number: 464956
Gerrit-PatchSet: 2
Gerrit-Owner: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.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/465339 )
Change subject: Localisation updates from https://translatewiki.net.
......................................................................
Localisation updates from https://translatewiki.net.
Change-Id: Ic1cb786ebb607c54dc4bdb0d0c84ffd58b91bc99
---
M category/cs.json
M category/sv.json
2 files changed, 4 insertions(+), 0 deletions(-)
Approvals:
L10n-bot: Looks good to me, approved
jenkins-bot: Verified
diff --git a/category/cs.json b/category/cs.json
index 94d4a79..73461c7 100644
--- a/category/cs.json
+++ b/category/cs.json
@@ -17,6 +17,8 @@
"category-replacing": "Robot: nahrazení kategorie %(oldcat)s za %(newcat)s",
"category-section-title": "Historie verzí bývalé %(oldcat)s",
"category-strip-cfd-templates": "Robot: odstranění šablony Přejmenovat kategorii po přesunu",
+ "category-strip-sort-keys": "Robot: odstranění šablony klíčů řazení po přesunu",
+ "category-strip-both": "Robot: odstranění šablony Přejmenovat kategorii a klíčů řazení po přesunu",
"category-version-history": "Robot: ukládání historie verzí bývalé %(oldcat)s",
"category-was-disbanded": "Robot: vyprázdnění kategorie",
"category-was-moved": "Robot: přesun kategorie na [[:Kategorie:%(newcat)s|%(title)s]]"
diff --git a/category/sv.json b/category/sv.json
index a45ac52..eda4d9f 100644
--- a/category/sv.json
+++ b/category/sv.json
@@ -17,6 +17,8 @@
"category-replacing": "Bot: Ersätter kategorin %(oldcat)s med %(newcat)s",
"category-section-title": "Sidhistorik från tidigare %(oldcat)s",
"category-strip-cfd-templates": "Bot: Tar bort raderingsmallar för genomförd åtgärd",
+ "category-strip-sort-keys": "Bot: Tar bort sorteringsnycklar för genomförd åtgärd",
+ "category-strip-both": "Bot: Tar bort CFD-mallar och sorteringsnycklar för genomförd åtgärd",
"category-version-history": "Bot: Sparar versionshistorik från tidigare %(oldcat)s",
"category-was-disbanded": "Bot: Kategorin upplöstes",
"category-was-moved": "Bot: Kategori flyttades till [[:Category:%(newcat)s|%(title)s]]"
--
To view, visit https://gerrit.wikimedia.org/r/465339
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/i18n
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic1cb786ebb607c54dc4bdb0d0c84ffd58b91bc99
Gerrit-Change-Number: 465339
Gerrit-PatchSet: 1
Gerrit-Owner: L10n-bot <l10n-bot(a)translatewiki.net>
Gerrit-Reviewer: L10n-bot <l10n-bot(a)translatewiki.net>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/465040 )
Change subject: Fix output about API and MediaWiki version
......................................................................
Fix output about API and MediaWiki version
Word "api" changed to "API"
Change-Id: I9314de6a955fb69005f61d22744e5c163952d0f2
---
M generate_family_file.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/generate_family_file.py b/generate_family_file.py
index ab575bf..a73e3ec 100755
--- a/generate_family_file.py
+++ b/generate_family_file.py
@@ -48,7 +48,7 @@
w = Wiki(self.base_url)
self.wikis[w.lang] = w
print('\n=================================='
- '\napi url: {w.api}'
+ '\nAPI url: {w.api}'
'\nMediaWiki version: {w.version}'
'\n==================================\n'.format(w=w))
--
To view, visit https://gerrit.wikimedia.org/r/465040
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: I9314de6a955fb69005f61d22744e5c163952d0f2
Gerrit-Change-Number: 465040
Gerrit-PatchSet: 1
Gerrit-Owner: Zoranzoki21 <zorandori4444(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/465115 )
Change subject: [bugfix] Show what page by which user is going to be patrolled
......................................................................
[bugfix] Show what page by which user is going to be patrolled
- partially reverts cad9b0b00dc1
Bug: T206428
Change-Id: I7378ad0c572c5d2cb3151b392e915a887bcd70a5
---
M scripts/patrol.py
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/patrol.py b/scripts/patrol.py
index 8d97ace..e72e7ad 100755
--- a/scripts/patrol.py
+++ b/scripts/patrol.py
@@ -310,9 +310,9 @@
self.load_whitelist()
self.repeat_start_ts = time.time()
- if self.getOption('ask'):
- verbose_output('User {0} has created or modified page {1}'
- .format(username, title))
+ if pywikibot.config.verbose_output or self.getOption('ask'):
+ pywikibot.output('User {0} has created or modified page {1}'
+ .format(username, title))
if self.getOption('autopatroluserns') and (page['ns'] == 2 or
page['ns'] == 3):
--
To view, visit https://gerrit.wikimedia.org/r/465115
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: I7378ad0c572c5d2cb3151b392e915a887bcd70a5
Gerrit-Change-Number: 465115
Gerrit-PatchSet: 2
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/465021 )
Change subject: http.py: Make sure the cookie file is created with the right permissions
......................................................................
http.py: Make sure the cookie file is created with the right permissions
pywikibot.tools:
- Add `create` as new argument for file_mode_checker. It'll create an
empty file with appropriate permissions if True.
pywikibot.comms.http:
- There is no need to check and fix file permissions on every load and
save. Do it only once before creating the cookie_jar object.
Use the new capability of file_mode_checker to do so.
- Deprecate PywikibotCookieJar class.
- Now that we are directly using LWPCookieJar, `cookie_jar.load()` won't
raise IOError anymore (IOError used to be raised by file_mode_checker).
Remove IOError from the except clause of `cookie_jar.load()`.
Bug: T206387
Change-Id: I769c85be9523bfcc9912954b6afc8bdfb7e09f22
---
M pywikibot/comms/http.py
M pywikibot/tools/__init__.py
2 files changed, 24 insertions(+), 6 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index a497ac6..893942e 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -68,6 +68,7 @@
_logger = 'comm.http'
+# Should be marked as deprecated after PywikibotCookieJar is removed.
def mode_check_decorator(func):
"""Decorate load()/save() CookieJar methods."""
def wrapper(cls, **kwargs):
@@ -84,7 +85,12 @@
# in PY2 cookielib.LWPCookieJar is not a new-style class.
class PywikibotCookieJar(cookielib.LWPCookieJar, object):
- """CookieJar which checks file permissions."""
+ """DEPRECATED. CookieJar which checks file permissions."""
+
+ @deprecated(since='20181007')
+ def __init__(self, *args, **kwargs):
+ """Initialize the class."""
+ super(PywikibotCookieJar, self).__init__(*args, **kwargs)
@mode_check_decorator
def load(self, **kwargs):
@@ -97,10 +103,12 @@
super(PywikibotCookieJar, self).save()
-cookie_jar = PywikibotCookieJar(config.datafilepath('pywikibot.lwp'))
+cookie_file_path = config.datafilepath('pywikibot.lwp')
+file_mode_checker(cookie_file_path, create=True)
+cookie_jar = cookielib.LWPCookieJar(cookie_file_path)
try:
cookie_jar.load()
-except (IOError, cookielib.LoadError):
+except cookielib.LoadError:
debug('Loading cookies failed.', _logger)
else:
debug('Loaded cookies from file.', _logger)
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index af948fc..73a0baf 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -1997,17 +1997,27 @@
return open_archive(filename, use_extension=use_extension)
-def file_mode_checker(filename, mode=0o600, quiet=False):
+def file_mode_checker(filename, mode=0o600, quiet=False, create=False):
"""Check file mode and update it, if needed.
@param filename: filename path
@type filename: basestring
@param mode: requested file mode
@type mode: int
-
+ @param quiet: warn about file mode change if False.
+ @type quiet: bool
+ @param create: create the file if it does not exist already
+ @type create: bool
+ @raise IOError: The file does not exist and `create` is False.
"""
+ try:
+ st_mode = os.stat(filename).st_mode
+ except OSError: # file does not exist
+ if not create:
+ raise
+ os.close(os.open(filename, os.O_CREAT | os.O_EXCL, mode))
+ return
warn_str = 'File {0} had {1:o} mode; converted to {2:o} mode.'
- st_mode = os.stat(filename).st_mode
if stat.S_ISREG(st_mode) and (st_mode - stat.S_IFREG != mode):
os.chmod(filename, mode)
# re-read and check changes
--
To view, visit https://gerrit.wikimedia.org/r/465021
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: I769c85be9523bfcc9912954b6afc8bdfb7e09f22
Gerrit-Change-Number: 465021
Gerrit-PatchSet: 3
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/464761 )
Change subject: Fix message about help which parameters should be used for creating family file
......................................................................
Fix message about help which parameters should be used for creating family file
Let's show where will be file placed.
Change-Id: Ic81974654ca16b3fe9f977fb42f3640ca7e3e833
---
M generate_family_file.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/generate_family_file.py b/generate_family_file.py
index 63eba9e..ab575bf 100755
--- a/generate_family_file.py
+++ b/generate_family_file.py
@@ -219,7 +219,7 @@
print("""
Usage: {module} <url> <short name>
Example: {module} https://www.mywiki.bogus/wiki/Main_Page mywiki
-This will create the file families{sep}mywiki_family.py"""
+This will create the file mywiki_family.py in pywikibot{sep}families"""
.format(module=sys.argv[0].strip('.' + os.sep),
sep=os.sep))
--
To view, visit https://gerrit.wikimedia.org/r/464761
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: Ic81974654ca16b3fe9f977fb42f3640ca7e3e833
Gerrit-Change-Number: 464761
Gerrit-PatchSet: 8
Gerrit-Owner: Zoranzoki21 <zorandori4444(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: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/464943 )
Change subject: Change default file mode for private files to 600
......................................................................
Change default file mode for private files to 600
Previous mode was 700, which caused the user-password.py to be
"executable" in theory. As it have no shebang, kernel won't know
how to execute that script.
Bug: T206385
Change-Id: If8a940ea6588abbb08cf8fefd0a646db80081efb
---
M pywikibot/config2.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Dvorapa: Looks good to me, but someone else must approve
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 2301de9..0dafa88 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -269,7 +269,7 @@
# stat.S_IROTH 0o004 read permission for others
# stat.S_IWOTH 0o002 write permission for others
# stat.S_IXOTH 0o001 execute permission for others
-private_files_permission = stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR
+private_files_permission = stat.S_IRUSR | stat.S_IWUSR
# Allow user to stop warnings about file security
# by setting this to true.
--
To view, visit https://gerrit.wikimedia.org/r/464943
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: If8a940ea6588abbb08cf8fefd0a646db80081efb
Gerrit-Change-Number: 464943
Gerrit-PatchSet: 1
Gerrit-Owner: Urbanecm <martin.urbanec(a)wikimedia.cz>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
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/464777 )
Change subject: tox.ini: Use the default max_line_length
......................................................................
tox.ini: Use the default max_line_length
Fix the remaining E501 (line too long) errors.
ui_tests.py:
replace "easy_install --upgrade \
https://pywinauto.googlecode.com/files/pywinauto-0.4.2.zipeasy_install \
--upgrade https://pywinauto.googlecode.com/files/pywinauto-0.4.2.zip"
comment with "pip install -U pywinauto". It's not clear why the a
specific version was recommended. setup.py uses the latest version.
setup.py:
Remove the "FIXME: tests/ui_tests.py suggests pywinauto 0.4.2" comment.
Change-Id: I788b09ac54779ec46c6fad17911ed634c20b4d4a
---
M docs/conf.py
M pwb.py
M setup.py
M tests/page_tests.py
M tests/tools_chars_tests.py
M tests/tools_tests.py
M tests/ui_tests.py
M tests/utils.py
M tests/wikibase_edit_tests.py
M tests/wikibase_tests.py
M tests/xmlreader_tests.py
M tox.ini
12 files changed, 53 insertions(+), 35 deletions(-)
Approvals:
Dvorapa: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/conf.py b/docs/conf.py
index 079af53..14f7986 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -8,7 +8,7 @@
# Pywikibot documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 5 15:50:05 2014.
#
-# This file is execfile()d with the current directory set to its containing dir.
+# This file is execfile()d with the current dir set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
diff --git a/pwb.py b/pwb.py
index c77ebdb..26d6d66 100755
--- a/pwb.py
+++ b/pwb.py
@@ -185,8 +185,8 @@
run_python_file(os.path.join(_pwb_dir, 'generate_user_files.py'),
['generate_user_files.py'],
['generate_user_files.py'])
- # because we have loaded pywikibot without user-config.py loaded, we need to re-start
- # the entire process. Ask the user to do so.
+ # because we have loaded pywikibot without user-config.py loaded,
+ # we need to re-start the entire process. Ask the user to do so.
print('Now, you have to re-execute the command to start your script.')
sys.exit(1)
diff --git a/setup.py b/setup.py
index 6de8817..9800e7e 100644
--- a/setup.py
+++ b/setup.py
@@ -105,7 +105,8 @@
# The main pywinauto repository doesnt support Python 3.
# The repositories used below have a Python 3 compliant setup.py
dependency_links = [
- 'git+https://github.com/AlereDevices/lunatic-python.git#egg=lunatic-python',
+ 'git+https://github.com/AlereDevices/lunatic-python.git#egg='
+ 'lunatic-python',
'hg+https://bitbucket.org/TJG/pywin32#egg=pywin32',
'git+https://github.com/vasily-v-ryabov/pywinauto-64#egg=pywinauto',
]
@@ -163,7 +164,6 @@
# Microsoft makes available a compiler for Python 2.7
# http://www.microsoft.com/en-au/download/details.aspx?id=44266
if os.name == 'nt' and os.environ.get('PYSETUP_TEST_NO_UI', '0') != '1':
- # FIXME: tests/ui_tests.py suggests pywinauto 0.4.2
# which isnt provided on pypi.
test_deps += ['pywin32', 'pywinauto>=0.4.0']
diff --git a/tests/page_tests.py b/tests/page_tests.py
index acb37d7..4cc8062 100644
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -476,7 +476,8 @@
"""Test the integration with Extension:Disambiguator."""
site = self.get_site()
if not site.has_extension('Disambiguator'):
- raise unittest.SkipTest('Disambiguator extension not loaded on test site')
+ raise unittest.SkipTest(
+ 'Disambiguator extension not loaded on test site')
pg = pywikibot.Page(site, 'Random')
pg._pageprops = {'disambiguation', ''}
self.assertTrue(pg.isDisambig())
diff --git a/tests/tools_chars_tests.py b/tests/tools_chars_tests.py
index 72ee4f9..cab060c 100644
--- a/tests/tools_chars_tests.py
+++ b/tests/tools_chars_tests.py
@@ -24,8 +24,10 @@
def test_replace(self):
"""Test replace_invisible."""
- self.assertEqual(chars.replace_invisible('Hello world!'), 'Hello world!')
- self.assertEqual(chars.replace_invisible('\u200eRTL\u200f'), '<200e>RTL<200f>')
+ self.assertEqual(
+ chars.replace_invisible('Hello world!'), 'Hello world!')
+ self.assertEqual(
+ chars.replace_invisible('\u200eRTL\u200f'), '<200e>RTL<200f>')
def test_contains(self):
"""Test contains_invisible."""
diff --git a/tests/tools_tests.py b/tests/tools_tests.py
index 58c7ae3..20ff4f1 100644
--- a/tests/tools_tests.py
+++ b/tests/tools_tests.py
@@ -73,8 +73,9 @@
'pywikibot.tools.ContextManagerWrapper is deprecated.'):
wrapper = tools.ContextManagerWrapper(self.DummyClass())
self.assertFalse(wrapper.closed)
- with self.assertRaisesRegex(ZeroDivisionError,
- '(integer division or modulo by zero|division by zero)'):
+ with self.assertRaisesRegex(
+ ZeroDivisionError,
+ '(integer division or modulo by zero|division by zero)'):
with wrapper:
1 / 0
self.assertTrue(wrapper.closed)
@@ -108,13 +109,16 @@
def test_open_archive_normal(self):
"""Test open_archive with no compression in the standard library."""
- self.assertEqual(self._get_content(self.base_file), self.original_content)
+ self.assertEqual(
+ self._get_content(self.base_file), self.original_content)
def test_open_archive_bz2(self):
"""Test open_archive with bz2 compressor in the standard library."""
- self.assertEqual(self._get_content(self.base_file + '.bz2'), self.original_content)
- self.assertEqual(self._get_content(self.base_file + '.bz2', use_extension=False),
- self.original_content)
+ self.assertEqual(
+ self._get_content(self.base_file + '.bz2'), self.original_content)
+ self.assertEqual(
+ self._get_content(self.base_file + '.bz2', use_extension=False),
+ self.original_content)
@require_modules('bz2file')
def test_open_archive_with_bz2file(self):
@@ -146,7 +150,8 @@
def test_open_archive_gz(self):
"""Test open_archive with gz compressor in the standard library."""
- self.assertEqual(self._get_content(self.base_file + '.gz'), self.original_content)
+ self.assertEqual(
+ self._get_content(self.base_file + '.gz'), self.original_content)
def test_open_archive_7z(self):
"""Test open_archive with 7za if installed."""
@@ -154,7 +159,8 @@
subprocess.Popen(['7za'], stdout=subprocess.PIPE).stdout.close()
except OSError:
raise unittest.SkipTest('7za not installed')
- self.assertEqual(self._get_content(self.base_file + '.7z'), self.original_content)
+ self.assertEqual(
+ self._get_content(self.base_file + '.7z'), self.original_content)
self.assertRaisesRegex(OSError,
'Unexpected STDERR output from 7za ',
self._get_content,
@@ -225,7 +231,8 @@
self.assertRaisesRegex(ValueError,
'Magic number detection only when reading',
tools.open_archive,
- '/dev/null', 'wb', False) # writing without extension
+ # writing without extension
+ '/dev/null', 'wb', False)
def test_binary_mode(self):
"""Test that it uses binary mode."""
@@ -283,7 +290,8 @@
def test_conflict(self):
"""Test that it detects conflicts."""
self.assertRaisesRegex(
- ValueError, '42', tools.merge_unique_dicts, self.dct1, **{'42': 'bad'})
+ ValueError, '42', tools.merge_unique_dicts, self.dct1,
+ **{'42': 'bad'})
self.assertRaisesRegex(
ValueError, '42', tools.merge_unique_dicts, self.dct1, self.dct1)
self.assertRaisesRegex(
@@ -329,7 +337,8 @@
"""Test marker is shown with start and stop with kwargs."""
start = 1
stop = 3
- it = list(tools.islice_with_ellipsis(self.it, start, stop, marker='new'))
+ it = list(tools.islice_with_ellipsis(
+ self.it, start, stop, marker='new'))
self.assertEqual(len(it), stop - start + 1) # +1 to consider marker.
self.assertEqual(it[:-1], self.it[start:stop])
self.assertNotEqual(it[-1], '…')
@@ -551,7 +560,7 @@
for _ in self.decs:
self.assertEqual(id(next(deduper)), deduped.pop())
self.assertRaises(StopIteration, next, deduper)
- # No. of Decimal with distinct ids != no. of Decimal with distinct value.
+ # len(Decimal with distinct ids) != len(Decimal with distinct value).
deduper_ids = list(tools.filter_unique(self.decs, key=id))
self.assertNotEqual(len(deduper_ids), len(set(deduper_ids)))
diff --git a/tests/ui_tests.py b/tests/ui_tests.py
index 7fc1934..09d1cc0 100644
--- a/tests/ui_tests.py
+++ b/tests/ui_tests.py
@@ -9,11 +9,11 @@
#
# Windows UI tests have to be run using the tests\ui_tests.bat helper script.
# This will set PYTHONPATH and PYWIKIBOT_DIR, and then run the tests. Do not
-# touch mouse or keyboard while the tests are running, as this might disturb the
-# interaction tests.
+# touch mouse or keyboard while the tests are running, as this might disturb
+# the interaction tests.
#
-# The Windows tests were developed on a Dutch Windows 7 OS. You might need to adapt the
-# helper functions in TestWindowsTerminalUnicode for other versions.
+# The Windows tests were developed on a Dutch Windows 7 OS. You might need to
+# adapt the helper functions in TestWindowsTerminalUnicode for other versions.
#
# For the Windows-based tests, you need the following packages installed:
# - pywin32, for clipboard access, which can be downloaded here:
@@ -21,7 +21,7 @@
# make sure to download the package for the correct python version!
#
# - pywinauto, to send keys to the terminal, which can be installed using:
-# easy_install --upgrade https://pywinauto.googlecode.com/files/pywinauto-0.4.2.zip
+# pip install -U pywinauto
#
#
from __future__ import absolute_import, division, unicode_literals
diff --git a/tests/utils.py b/tests/utils.py
index e9b7cf9..ff13b92 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -420,7 +420,8 @@
aliases = []
for alias in ('PrefixIndex', ):
# TODO: Not all follow that scheme (e.g. "BrokenRedirects")
- aliases.append({'realname': alias.capitalize(), 'aliases': [alias]})
+ aliases.append(
+ {'realname': alias.capitalize(), 'aliases': [alias]})
self._siteinfo._cache['specialpagealiases'] = (aliases, True)
self._msgcache = {'*': 'dummy entry', 'hello': 'world'}
diff --git a/tests/wikibase_edit_tests.py b/tests/wikibase_edit_tests.py
index 497cfa1..ee082d7 100644
--- a/tests/wikibase_edit_tests.py
+++ b/tests/wikibase_edit_tests.py
@@ -73,7 +73,8 @@
if 'P115' in item.claims:
item.removeClaims(item.claims['P115'])
- claim = pywikibot.page.Claim(testsite, 'P115', datatype='wikibase-item')
+ claim = pywikibot.page.Claim(
+ testsite, 'P115', datatype='wikibase-item')
target = pywikibot.ItemPage(testsite, 'Q271')
claim.setTarget(target)
@@ -94,7 +95,8 @@
to_remove.append({'id': claim.toJSON()['id'], 'remove': ''})
item.editEntity({'claims': to_remove})
- claim = pywikibot.page.Claim(testsite, 'P115', datatype='wikibase-item')
+ claim = pywikibot.page.Claim(
+ testsite, 'P115', datatype='wikibase-item')
target = pywikibot.ItemPage(testsite, 'Q271')
claim.setTarget(target)
item.editEntity({'claims': [claim.toJSON()]})
@@ -225,7 +227,8 @@
item = self._clean_item(testsite, 'P271')
# set new claim
- claim = pywikibot.page.Claim(testsite, 'P271', datatype='monolingualtext')
+ claim = pywikibot.page.Claim(
+ testsite, 'P271', datatype='monolingualtext')
target = pywikibot.WbMonolingualText(text='Test this!', language='en')
claim.setTarget(target)
item.addClaim(claim)
@@ -378,7 +381,8 @@
if 'P115' in item.claims:
item.removeClaims(item.claims['P115'])
- claim = pywikibot.page.Claim(testsite, 'P115', datatype='wikibase-item')
+ claim = pywikibot.page.Claim(
+ testsite, 'P115', datatype='wikibase-item')
target = pywikibot.ItemPage(testsite, 'Q271')
claim.setTarget(target)
item.addClaim(claim)
diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index 6ec66a4..c979a41 100644
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -1445,7 +1445,8 @@
wikidata = self.get_repo()
claim = pywikibot.Claim(wikidata, 'P569')
self.assertEqual(claim.type, 'time')
- claim.setTarget(pywikibot.WbTime(year=2001, month=1, day=1, site=wikidata))
+ claim.setTarget(pywikibot.WbTime(
+ year=2001, month=1, day=1, site=wikidata))
self.assertEqual(claim.target.year, 2001)
self.assertEqual(claim.target.month, 1)
self.assertEqual(claim.target.day, 1)
@@ -1676,7 +1677,8 @@
"""Test PreloadingEntityGenerator with ReferringPageGenerator."""
site = self.get_site('wikidata')
instance_of_page = pywikibot.Page(site, 'Property:P31')
- ref_gen = pagegenerators.ReferringPageGenerator(instance_of_page, total=5)
+ ref_gen = pagegenerators.ReferringPageGenerator(
+ instance_of_page, total=5)
gen = pagegenerators.PreloadingEntityGenerator(ref_gen)
self.assertTrue(all(isinstance(item, ItemPage) for item in gen))
diff --git a/tests/xmlreader_tests.py b/tests/xmlreader_tests.py
index 75bc121..ebd84ba 100644
--- a/tests/xmlreader_tests.py
+++ b/tests/xmlreader_tests.py
@@ -56,7 +56,8 @@
"""Test XmlDump correctly parsing whether a page is a redirect."""
pages = self._get_entries('article-pyrus.xml', allrevisions=True)
pages = [r for r in
- xmlreader.XmlDump(join_xml_data_path('article-pyrus.xml')).parse()]
+ xmlreader.XmlDump(
+ join_xml_data_path('article-pyrus.xml')).parse()]
self.assertTrue(pages[0].isredirect)
def _compare(self, previous, variant, all_revisions):
diff --git a/tox.ini b/tox.ini
index eef3f32..0dabaff 100644
--- a/tox.ini
+++ b/tox.ini
@@ -138,7 +138,6 @@
ignore = D105,D211,FI12,FI13,FI15,FI16,FI17,FI5,H101,H236,H301,H404,H405,H903,D401,D413,D412,P101,P102,P103,W503
exclude = .tox,.git,./*.egg,ez_setup.py,build,externals,user-config.py,./scripts/i18n/*,scripts/userscripts/*
min-version = 2.7
-max_line_length = 100
accept-encodings = utf-8
require-code = true
classmethod-decorators = classmethod,classproperty
@@ -276,7 +275,6 @@
[pep8]
exclude = .tox,.git,./*.egg,ez_setup.py,build,externals,user-config.py,./scripts/i18n/*,scripts/userscripts/*
-max_line_length = 100
[pep257]
# see explanations above
--
To view, visit https://gerrit.wikimedia.org/r/464777
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: I788b09ac54779ec46c6fad17911ed634c20b4d4a
Gerrit-Change-Number: 464777
Gerrit-PatchSet: 1
Gerrit-Owner: 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)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/463735 )
Change subject: [tests] Set fast_finish: true
......................................................................
[tests] Set fast_finish: true
Immediately finish build once one of the jobs fails to decrease test time
Bug: T186323
Change-Id: I7131fd0bb74029088673c01c2ee0f9725efcff36
---
M .appveyor.yml
1 file changed, 1 insertion(+), 0 deletions(-)
Approvals:
Dvorapa: Looks good to me, but someone else must approve
Framawiki: Looks good to me, but someone else must approve
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.appveyor.yml b/.appveyor.yml
index f0d2506..23c5f08 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -15,6 +15,7 @@
PYSETUP_TEST_EXTRAS: "1"
matrix:
+ fast_finish: true
# Test the lowest supported release of each major Python version.
--
To view, visit https://gerrit.wikimedia.org/r/463735
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: I7131fd0bb74029088673c01c2ee0f9725efcff36
Gerrit-Change-Number: 463735
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
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/463984 )
Change subject: [fix] Fix typo in login.py script
......................................................................
[fix] Fix typo in login.py script
Word should be "current" and not "curren".
Change-Id: I170d0693d733abcd8dbb635fc8f2bc54e0648132
---
M scripts/login.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/login.py b/scripts/login.py
index 161f17f..eb277cf 100755
--- a/scripts/login.py
+++ b/scripts/login.py
@@ -16,7 +16,7 @@
-all Try to log in on all sites where a username is defined in
user-config.py.
- -logout Log out of the curren site. Combine with -all to log out of
+ -logout Log out of the current site. Combine with -all to log out of
all sites, or with -family and -lang to log out of a specific
site.
--
To view, visit https://gerrit.wikimedia.org/r/463984
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: I170d0693d733abcd8dbb635fc8f2bc54e0648132
Gerrit-Change-Number: 463984
Gerrit-PatchSet: 2
Gerrit-Owner: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
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/463954 )
Change subject: [cleanup] cleanup docs/conf.py
......................................................................
[cleanup] cleanup docs/conf.py
- remove preleading "u" from strings
- make sure lines do not exceed 79 chars
Bug: T89589
Change-Id: I6f80256592df6281b5e267d4980bd864049bb771
---
M docs/conf.py
1 file changed, 17 insertions(+), 15 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/conf.py b/docs/conf.py
index c78193d..079af53 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -30,13 +30,13 @@
sys.path.insert(0, repo_dir)
os.chdir(repo_dir)
-# -- General configuration -----------------------------------------------------
+# -- General configuration ----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.0'
-# Add any Sphinx extension module names here, as strings. They can be extensions
-# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc',
'sphinx_epytext',
'sphinx.ext.todo',
@@ -87,7 +87,8 @@
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
-# The reST default role (used for this markup: `text`) to use for all documents.
+# The reST default role (used for this markup: `text`) to use for all
+# documents.
default_role = 'code'
# If true, '()' will be appended to :func: etc. cross-reference text.
@@ -108,7 +109,7 @@
# modindex_common_prefix = []
-# -- Options for HTML output ---------------------------------------------------
+# -- Options for HTML output --------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
@@ -188,15 +189,16 @@
htmlhelp_basename = 'Pywikibotdoc'
-# -- Options for LaTeX output --------------------------------------------------
+# -- Options for LaTeX output -------------------------------------------------
latex_elements = {}
# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title, author, documentclass [howto/manual]).
+# (source start file, target name, title, author, documentclass
+# [howto/manual]).
latex_documents = [
- ('index', 'Pywikibot.tex', u'Pywikibot Documentation',
- u'Pywikibot team', 'manual'),
+ ('index', 'Pywikibot.tex', 'Pywikibot Documentation',
+ 'Pywikibot team', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@@ -220,27 +222,27 @@
# latex_domain_indices = True
-# -- Options for manual page output --------------------------------------------
+# -- Options for manual page output -------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
- ('index', 'pywikibot', u'Pywikibot Documentation',
- [u'Pywikibot team'], 1)
+ ('index', 'pywikibot', 'Pywikibot Documentation',
+ ['Pywikibot team'], 1)
]
# If true, show URL addresses after external links.
# man_show_urls = False
-# -- Options for Texinfo output ------------------------------------------------
+# -- Options for Texinfo output -----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
- ('index', 'Pywikibot', u'Pywikibot Documentation',
- u'Pywikibot team', 'Pywikibot', 'One line description of project.',
+ ('index', 'Pywikibot', 'Pywikibot Documentation',
+ 'Pywikibot team', 'Pywikibot', 'One line description of project.',
'Miscellaneous'),
]
--
To view, visit https://gerrit.wikimedia.org/r/463954
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: I6f80256592df6281b5e267d4980bd864049bb771
Gerrit-Change-Number: 463954
Gerrit-PatchSet: 1
Gerrit-Owner: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick(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/463599 )
Change subject: scripts/imagecopy.py: Do not create Uploadbot.localskips.txt on loading
......................................................................
scripts/imagecopy.py: Do not create Uploadbot.localskips.txt on loading
Only create the file if the module is being run as the main module.
Bug: T205772
Change-Id: Ifd8be27b5f2a213c94b1db96ede7fa48ade8fbd6
---
M scripts/imagecopy.py
1 file changed, 9 insertions(+), 7 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/imagecopy.py b/scripts/imagecopy.py
index 21f78ec..4e8f70f 100644
--- a/scripts/imagecopy.py
+++ b/scripts/imagecopy.py
@@ -372,12 +372,13 @@
return pageText
-# -label ok skip view
-# textarea
-archivo = config.datafilepath('Uploadbot.localskips.txt')
-if not path.exists(archivo):
- with open(archivo, 'w') as tocreate:
- tocreate.write('{{NowCommons')
+def load_global_archivo():
+ """Load/create Uploadbot.localskips.txt and save the path in `archivo`."""
+ global archivo
+ archivo = config.datafilepath('Uploadbot.localskips.txt')
+ if not path.exists(archivo):
+ with open(archivo, 'w') as tocreate:
+ tocreate.write('{{NowCommons')
def getautoskip():
@@ -495,7 +496,6 @@
def main(*args):
"""Process command line arguments and invoke bot."""
- imagepage = None
always = False
category = ''
delete_after_done = False
@@ -518,6 +518,8 @@
pywikibot.bot.suggest_help(missing_generator=True)
return False
+ load_global_archivo()
+
for page in pregenerator:
skip = False
if page.exists() and page.namespace() == 6 \
--
To view, visit https://gerrit.wikimedia.org/r/463599
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: Ifd8be27b5f2a213c94b1db96ede7fa48ade8fbd6
Gerrit-Change-Number: 463599
Gerrit-PatchSet: 4
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/463792 )
Change subject: [tests] Give a hint which page is failing in tests_protectedpages_create
......................................................................
[tests] Give a hint which page is failing in tests_protectedpages_create
Bug: T205883
Change-Id: I45d2a2154be7d96235e9addf16d28dae76cc15d8
---
M tests/site_tests.py
1 file changed, 4 insertions(+), 1 deletion(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 3fe987e..dc62322 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -1034,7 +1034,10 @@
pages = list(self.get_site().protectedpages(type='create', total=10))
for page in pages:
- self.assertFalse(page.exists())
+ self.assertFalse(
+ page.exists(),
+ '\n{page} does unexpectedly exit on site {page.site}'
+ .format(page=page))
self.assertLessEqual(len(pages), 10)
def test_protectedpages_edit(self):
--
To view, visit https://gerrit.wikimedia.org/r/463792
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: I45d2a2154be7d96235e9addf16d28dae76cc15d8
Gerrit-Change-Number: 463792
Gerrit-PatchSet: 1
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/463720 )
Change subject: [cleanup] cleanup exceptions.py & login.py in pywikibot/
......................................................................
[cleanup] cleanup exceptions.py & login.py in pywikibot/
- remove preleading harmless "u" from comments
- remove some very old commented out code
Change-Id: I3d6dff28e7105eefe5f326165a18cab09998b4d6
---
M pywikibot/exceptions.py
M pywikibot/login.py
2 files changed, 1 insertion(+), 13 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/exceptions.py b/pywikibot/exceptions.py
index 98e4fd5..92a0a2e 100644
--- a/pywikibot/exceptions.py
+++ b/pywikibot/exceptions.py
@@ -143,7 +143,7 @@
# Preformatted UNICODE message where the page title will be inserted
# Override this in subclasses.
- # u"Oh noes! Page %s is too funky, we should not delete it ;("
+ # 'Oh noes! Page %s is too funky, we should not delete it ;('
message = None
def __init__(self, page, message=None):
diff --git a/pywikibot/login.py b/pywikibot/login.py
index a17c230..0f54a60 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -335,18 +335,6 @@
return False
self.storecookiedata(cookiedata)
pywikibot.log('Should be logged in now')
-# # Show a warning according to the local bot policy
-# FIXME: disabled due to recursion; need to move this to the Site object
-# after login
-# if not self.botAllowed():
-# logger.error(
-# u"Username '%(name)s' is not listed on [[%(page)s]]."
-# % {'name': self.username,
-# 'page': botList[self.site.family.name][self.site.code]})
-# logger.error(
-# "Please make sure you are allowed to use the robot before actually using it!"
-# )
-# return False
return True
def showCaptchaWindow(self, url):
--
To view, visit https://gerrit.wikimedia.org/r/463720
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: I3d6dff28e7105eefe5f326165a18cab09998b4d6
Gerrit-Change-Number: 463720
Gerrit-PatchSet: 3
Gerrit-Owner: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick(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)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/463660 )
Change subject: [compat2core] Fix regressions of multiple Page methods
......................................................................
[compat2core] Fix regressions of multiple Page methods
The following methods' behavior differs between compat and core:
- templates()
- templatesWithParams()
- linkedPages()
Warnings were added to README-conversion.txt and compat2core.py. Every
incorrect (not-working compat-like) usage across scripts was fixed.
Solve_disambiguation.py slicing problem was splitted into a separate patch.
Bug: T58188
Bug: T186394
Change-Id: If0abe8ad1653e2bc0786cf48dea214d5b94d1cbc
---
M README-conversion.txt
M scripts/commonscat.py
M scripts/imagecopy_self.py
M scripts/imagerecat.py
M scripts/maintenance/compat2core.py
M scripts/solve_disambiguation.py
6 files changed, 29 insertions(+), 14 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/README-conversion.txt b/README-conversion.txt
index 4363efa..9618a07 100644
--- a/README-conversion.txt
+++ b/README-conversion.txt
@@ -91,9 +91,13 @@
The following methods have had their outputs changed:
- getVersionHistory(): Returns a pywikibot.Timestamp object instead of a MediaWiki one
+- templates(): Returns a list of Page objects of templates. In compat we have
+ a list of template title strings.
- templatesWithParams(): Returns a list of tuples with two items. The first item is
a Page object of the template, the second is a list of parameters. In compat we have
a list of tuples with two items. The first item is the template title.
+- linkedPages(): Returns a PageGenerator of Page objects of link targets.
+ In compat we have a list of link target strings.
=== FilePage objects ===
diff --git a/scripts/commonscat.py b/scripts/commonscat.py
index 8b4062a..38c3a76 100755
--- a/scripts/commonscat.py
+++ b/scripts/commonscat.py
@@ -488,7 +488,8 @@
pywikibot.log('getCommonscat: The category is a redirect')
return self.checkCommonscatLink(
commonsPage.getRedirectTarget().title(with_ns=False))
- elif 'Category redirect' in commonsPage.templates():
+ elif (pywikibot.Page(commonsPage.site,
+ 'Template:Category redirect') in commonsPage.templates()):
pywikibot.log(
'getCommonscat: The category is a category redirect')
for template in commonsPage.templatesWithParams():
diff --git a/scripts/imagecopy_self.py b/scripts/imagecopy_self.py
index 4730d16..3718367 100644
--- a/scripts/imagecopy_self.py
+++ b/scripts/imagecopy_self.py
@@ -384,10 +384,11 @@
"""
for template in imagepage.templates():
- if template in skipTemplates[imagepage.site.lang]:
+ template_title = template.title(with_ns=False)
+ if template_title in skipTemplates[imagepage.site.lang]:
pywikibot.output(
'Found {} which is on the template skip list'
- .format(template))
+ .format(template_title))
return True
return False
diff --git a/scripts/imagerecat.py b/scripts/imagerecat.py
index 8af4a9a..cdc9c57 100755
--- a/scripts/imagerecat.py
+++ b/scripts/imagerecat.py
@@ -86,7 +86,9 @@
imagepage = pywikibot.FilePage(page.site, page.title())
pywikibot.output('Working on ' + imagepage.title())
- if onlyUncat and not('Uncategorized' in imagepage.templates()):
+ if (onlyUncat and not pywikibot.Page(
+ imagepage.site, 'Template:Uncategorized')
+ in imagepage.templates()):
pywikibot.output('No Uncategorized template found')
else:
currentCats = getCurrentCats(imagepage)
diff --git a/scripts/maintenance/compat2core.py b/scripts/maintenance/compat2core.py
index 4caf605..c4b64ce 100755
--- a/scripts/maintenance/compat2core.py
+++ b/scripts/maintenance/compat2core.py
@@ -117,12 +117,17 @@
'by a direct site request'),
('.verbose',
'verbose_output need "from pywikibot import config" first'),
+ ('templates(',
+ 'returns a list of templage page objects, not a list of template titles.'
+ '\nPlease refer README-conversion.txt and the documentation.'),
('templatesWithParams(',
'the first item of each template info is a Page object of the template,\n'
'not the title. '
'Please refer README-conversion.txt and the documentation.'),
- ('templates(',
- 'returns a list of template title not a list of templage page objects.'),
+ ('linkedPages(',
+ 'returns a PageGenerator of page objects of link targets, not a list\n'
+ 'of link target strings. Please refer README-conversion.txt\n'
+ 'and the documentation.'),
)
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index a262d54..378e921 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -1039,15 +1039,17 @@
"""
if disambPage.isRedirectPage() and not self.primary:
- if (disambPage.site.lang in self.primary_redir_template
- and self.primary_redir_template[disambPage.site.lang]
- in disambPage.templates()):
+ primary = i18n.translate(disambPage.site,
+ self.primary_redir_template)
+ if primary:
+ primary_page = pywikibot.Page(disambPage.site,
+ 'Template:' + primary)
+ if primary and primary_page in disambPage.templates():
baseTerm = disambPage.title()
- for template in disambPage.templatesWithParams():
- if template[0] == self.primary_redir_template[
- disambPage.site.lang] \
- and len(template[1]) > 0:
- baseTerm = template[1][1]
+ for template, params in disambPage.templatesWithParams():
+ if params and template == primary_page:
+ baseTerm = params[1]
+ break
disambTitle = primary_topic_format[self.mylang] % baseTerm
try:
disambPage2 = pywikibot.Page(
--
To view, visit https://gerrit.wikimedia.org/r/463660
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: If0abe8ad1653e2bc0786cf48dea214d5b94d1cbc
Gerrit-Change-Number: 463660
Gerrit-PatchSet: 5
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Liuxinyu970226 <541329866(a)qq.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)