jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[IMPR] Shorten expressions

Change-Id: Ia8ada954570734fce64884255733b112e6a4b1e2
---
M pywikibot/cosmetic_changes.py
M pywikibot/data/api/_paraminfo.py
M pywikibot/page/_category.py
M pywikibot/textlib.py
M pywikibot/time.py
M pywikibot/version.py
M scripts/category_redirect.py
M tests/aspects.py
M tests/site_generators_tests.py
M tests/time_tests.py
10 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index 569f081..003d670 100644
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -624,7 +624,7 @@
if hadLeadingSpaces and not newline:
newLink = ' ' + newLink
if hadTrailingSpaces:
- newLink = newLink + ' '
+ newLink += ' '
if newline:
newLink = newline + newLink
return newLink
diff --git a/pywikibot/data/api/_paraminfo.py b/pywikibot/data/api/_paraminfo.py
index 3bd2c1a..87422f4 100644
--- a/pywikibot/data/api/_paraminfo.py
+++ b/pywikibot/data/api/_paraminfo.py
@@ -203,7 +203,7 @@
del failed_modules[:]
yield batch

- modules = modules - set(self._paraminfo)
+ modules -= set(self._paraminfo)
if not modules:
return

diff --git a/pywikibot/page/_category.py b/pywikibot/page/_category.py
index 398cd3c..61f85cb 100644
--- a/pywikibot/page/_category.py
+++ b/pywikibot/page/_category.py
@@ -72,7 +72,7 @@
return

if not isinstance(recurse, bool) and recurse:
- recurse = recurse - 1
+ recurse -= 1

if (not hasattr(self, '_subcats')
or not is_cache_valid(self._subcats, content)):
@@ -226,7 +226,7 @@
return
if recurse:
if not isinstance(recurse, bool) and recurse:
- recurse = recurse - 1
+ recurse -= 1
for subcat in self.subcategories():
for article in subcat.members(
recurse, namespaces, total=total, content=content):
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index ccc45b8..e8e0af3 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -1311,7 +1311,7 @@
site = insite.getSite(code=code)
if site in sites:
del sites[sites.index(site)]
- firstsites = firstsites + [site]
+ firstsites += [site]
sites = firstsites + sites
return sites

diff --git a/pywikibot/time.py b/pywikibot/time.py
index c9bfc57..14f5371 100644
--- a/pywikibot/time.py
+++ b/pywikibot/time.py
@@ -183,7 +183,7 @@
usec = m['u']
usec = int(usec.ljust(6, '0')) if usec else 0
if sec < 0 < usec:
- sec = sec - 1
+ sec -= 1
usec = 1_000_000 - usec

ts = cls(1970, 1, 1) + datetime.timedelta(seconds=sec,
diff --git a/pywikibot/version.py b/pywikibot/version.py
index a95a826..a9b030c 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -401,7 +401,7 @@

# Improve performance by removing builtins from the list if possible.
if builtins is False:
- root_packages = root_packages - builtin_packages
+ root_packages -= builtin_packages

std_lib_packages = []

diff --git a/scripts/category_redirect.py b/scripts/category_redirect.py
index 53db97c..fa2d5aa 100755
--- a/scripts/category_redirect.py
+++ b/scripts/category_redirect.py
@@ -420,7 +420,7 @@
newtext = ('{{%(redirtemp)s|%(ncat)s}}'
% {'redirtemp': self.template_list[0],
'ncat': double.title(with_ns=False)})
- newtext = newtext + oldtext.strip()
+ newtext += oldtext.strip()
try:
cat.text = newtext
cat.save(i18n.twtranslate(self.site,
diff --git a/tests/aspects.py b/tests/aspects.py
index 36709de..ec8266e 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -1303,8 +1303,7 @@
def _execute(self, args, data_in=None, timeout=None, error=None):
site = self.get_site()

- args = args + ['-family:' + site.family.name,
- '-lang:' + site.code]
+ args += ['-family:' + site.family.name, '-lang:' + site.code]

return execute_pwb(args, data_in, timeout, error)

diff --git a/tests/site_generators_tests.py b/tests/site_generators_tests.py
index ba0b11c..3e6d0f5 100644
--- a/tests/site_generators_tests.py
+++ b/tests/site_generators_tests.py
@@ -1961,7 +1961,7 @@
def test_load_from_pageids_iterable_with_duplicate(self):
"""Test loading with duplicate pageids."""
pageids = [page.pageid for page in self.links]
- pageids = pageids + pageids
+ pageids += pageids
gen = self.site.load_pages_from_pageids(pageids)
count = 0
for count, page in enumerate(gen, start=1):
diff --git a/tests/time_tests.py b/tests/time_tests.py
index 1247228..ff208f5 100755
--- a/tests/time_tests.py
+++ b/tests/time_tests.py
@@ -82,7 +82,7 @@
sec, usec = map(int, timestr.split('.'))

if sec < 0 < usec:
- sec = sec - 1
+ sec -= 1
usec = 1000000 - usec

return datetime(1970, 1, 1) + timedelta(seconds=sec, microseconds=usec)

To view, visit change 842448. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ia8ada954570734fce64884255733b112e6a4b1e2
Gerrit-Change-Number: 842448
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged