jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/805415 )

Change subject: [IMPR] Decrease complexity im ParamInfo.normalize_paraminfo ()
......................................................................

[IMPR] Decrease complexity im ParamInfo.normalize_paraminfo ()

Change-Id: I936055c0d916034e2844047ae32486d83d80b509
---
M pywikibot/data/api/_paraminfo.py
1 file changed, 3 insertions(+), 6 deletions(-)

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



diff --git a/pywikibot/data/api/_paraminfo.py b/pywikibot/data/api/_paraminfo.py
index a884383..7717547 100644
--- a/pywikibot/data/api/_paraminfo.py
+++ b/pywikibot/data/api/_paraminfo.py
@@ -9,7 +9,7 @@
 
 import pywikibot
 from pywikibot import config
-from pywikibot.backports import Dict
+from pywikibot.backports import Dict, removeprefix
 from pywikibot.tools import itergroup


@@ -394,11 +394,8 @@
                 php_class = mod_data.get('classname')

                 if not name and php_class:
-                    if php_class == 'ApiMain':
-                        name = 'main'
-                    elif php_class == 'ApiPageSet':
-                        name = 'pageset'
-                    else:
+                    name = removeprefix(php_class, 'Api').lower()
+                    if name not in ('main', 'pageset'):
                         pywikibot.warning('Unknown paraminfo module "{}"'
                                           .format(php_class))
                         name = '<unknown>:' + php_class

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/805415
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I936055c0d916034e2844047ae32486d83d80b509
Gerrit-Change-Number: 805415
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to