jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1328369?usp=email )
Change subject: Use append for individual list items
......................................................................
Use append for individual list items
Several list additions build temporary one-item lists before extending existing
lists.
Use append to add these ten individual values directly.
Change-Id: I46f860755b753be8131d29b8568287512df7ea3a
---
M pywikibot/bot_choice.py
M pywikibot/diff.py
M pywikibot/scripts/generate_user_files.py
M pywikibot/site/_generators.py
M scripts/interwiki.py
M scripts/solve_disambiguation.py
6 files changed, 19 insertions(+), 18 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/bot_choice.py b/pywikibot/bot_choice.py
index 107fe68..988341e 100644
--- a/pywikibot/bot_choice.py
+++ b/pywikibot/bot_choice.py
@@ -744,11 +744,11 @@
choices = []
for name, choice in self._own_choices:
if getattr(self, 'allow_' + name):
- choices += [choice]
+ choices.append(choice)
if self.context_delta > 0:
- choices += [HighlightContextOption(
+ choices.append(HighlightContextOption(
'more context', 'm', self.current_text, self.context,
- self.context_delta, *self.current_range)]
+ self.context_delta, *self.current_range))
choices += self.additional_choices
return tuple(choices)
diff --git a/pywikibot/diff.py b/pywikibot/diff.py
index e26d526..276fd68 100644
--- a/pywikibot/diff.py
+++ b/pywikibot/diff.py
@@ -487,11 +487,11 @@
else:
mode = '+'
first = self.b[super_hunk[0].b_rng[0]]
- hunk_list += [(status, index,
- Hunk.get_header_text(
- *self._get_context_range(super_hunk),
- affix=''),
- mode, first)]
+ hunk_list.append((
+ status, index,
+ Hunk.get_header_text(
+ *self._get_context_range(super_hunk), affix=''),
+ mode, first))
rng_width = max(len(hunk_list[-1][2]), rng_width)
line_template = ('{0}{1} {2: >'
+ str(int(math.log10(len(super_hunks)) + 1))
diff --git a/pywikibot/scripts/generate_user_files.py
b/pywikibot/scripts/generate_user_files.py
index 678d7d7..9a9dc39 100755
--- a/pywikibot/scripts/generate_user_files.py
+++ b/pywikibot/scripts/generate_user_files.py
@@ -370,8 +370,8 @@
userlist = [_UserItem(main_family, main_code, main_username)]
else:
while True:
- userlist += [_UserItem(*get_site_and_lang(
- main_family, main_code, main_username, force=force))]
+ userlist.append(_UserItem(*get_site_and_lang(
+ main_family, main_code, main_username, force=force)))
if not pywikibot.input_yn('Do you want to add any other projects?',
force=force,
default=False, automatic_quit=False):
diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index 6e35802..11ee418 100644
--- a/pywikibot/site/_generators.py
+++ b/pywikibot/site/_generators.py
@@ -1595,7 +1595,7 @@
}
if patrolled is not None and (
self.has_right('patrol') or self.has_right('patrolmarks')):
- rcgen.request['rcprop'] += ['patrolled']
+ rcgen.request['rcprop'].append('patrolled')
filters['patrolled'] = patrolled
rcgen.request['rcshow'] = api.OptionSet(self, 'recentchanges', 'show',
filters)
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 49570a1..aa8f172 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -751,7 +751,7 @@
"""Add the given translation hints to the todo collection."""
if self.conf.same and self.origin:
if hints:
- hints += ['all:']
+ hints.append('all:')
else:
hints = ['all:']
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index 81484fb..6ab9b17 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -867,13 +867,14 @@
if self.dn_template_str:
# '?', '/' for old choice
- options += [AliasOption(
+ options.append(AliasOption(
f'tag template {self.dn_template_str}',
- ['t', '?', '/'])]
- options += [context_option]
+ ['t', '?', '/']))
+ options.append(context_option)
if not edited:
- options += [ShowPageOption('show disambiguation page', 'd',
- m.start(), disamb_page)]
+ options.append(ShowPageOption(
+ 'show disambiguation page', 'd', m.start(),
+ disamb_page))
options += [
OutputProxyOption('list', 'l',
@@ -881,7 +882,7 @@
AddAlternativeOption('add new', 'a',
SequenceOutputter(self.opt.pos))]
if edited:
- options += [StandardOption('save in this form', 'x')]
+ options.append(StandardOption('save in this form', 'x'))
# TODO: Output context on each question
answer = pywikibot.input_choice('Option', options,
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1328369?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I46f860755b753be8131d29b8568287512df7ea3a
Gerrit-Change-Number: 1328369
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]