jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/562005 )

Change subject: [IMPR] Simlify boolean assignments in Site._post_process
......................................................................

[IMPR] Simlify boolean assignments in Site._post_process

Change-Id: Ie5f34951eeb420cd7f276c1b93e5d7d9be0bf05b
---
M pywikibot/site.py
1 file changed, 4 insertions(+), 10 deletions(-)

Approvals:
  JJMC89: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/site.py b/pywikibot/site.py
index fac1d66..eb5c1ac 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -6,7 +6,7 @@
 groups of wikis on the same topic in different languages.
 """
 #
-# (C) Pywikibot team, 2008-2019
+# (C) Pywikibot team, 2008-2020
 #
 # Distributed under the terms of the MIT license.
 #
@@ -1489,21 +1489,15 @@
         if prop in Siteinfo.BOOLEAN_PROPS.keys():
             # siprop=namespaces and
             # magicwords has properties per item in result
-            if prop == 'namespaces' or prop == 'magicwords':
+            if prop in ('namespaces', 'magicwords'):
                 for index, value in enumerate(data):
                     # namespaces uses a dict, while magicwords uses a list
                     key = index if type(data) is list else value
                     for p in Siteinfo.BOOLEAN_PROPS[prop]:
-                        if p in data[key]:
-                            data[key][p] = True
-                        else:
-                            data[key][p] = False
+                        data[key][p] = p in data[key]
             else:
                 for p in Siteinfo.BOOLEAN_PROPS[prop]:
-                    if p in data:
-                        data[p] = True
-                    else:
-                        data[p] = False
+                    data[p] = p in data

     def _get_siteinfo(self, prop, expiry):
         """

--
To view, visit https://gerrit.wikimedia.org/r/562005
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: Ie5f34951eeb420cd7f276c1b93e5d7d9be0bf05b
Gerrit-Change-Number: 562005
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: JJMC89 <[email protected]>
Gerrit-Reviewer: jenkins-bot (75)
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to