jenkins-bot has submitted this change and it was merged.
Change subject: [core] replace deprecated getNamespaceIndex() with ns_index()
......................................................................
[core] replace deprecated getNamespaceIndex() with ns_index()
- getNamespaceIndex() is marked as deprecated method.
- some doc cleanups
Change-Id: I96dc118224965696531011d3f3a84dc559784584
---
M scripts/templatecount.py
1 file changed, 7 insertions(+), 6 deletions(-)
Approvals:
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/templatecount.py b/scripts/templatecount.py
index ab70b97..036b012 100644
--- a/scripts/templatecount.py
+++ b/scripts/templatecount.py
@@ -21,13 +21,13 @@
Examples:
-Counts how many times {{ref}} and {{note}} are transcluded in articles.
+Counts how many times {{ref}} and {{note}} are transcluded in articles:
- python templatecount.py -count -namespace:0 ref note
+ templatecount.py -count -namespace:0 ref note
-Lists all the category pages that transclude {{cfd}} and {{cfdu}}.
+Lists all the category pages that transclude {{cfd}} and {{cfdu}}:
- python templatecount.py -list -namespace:14 cfd cfdu
+ templatecount.py -list -namespace:14 cfd cfdu
"""
#
@@ -97,14 +97,15 @@
mysite = pywikibot.Site()
# The names of the templates are the keys, and lists of pages
# transcluding templates are the values.
- mytpl = mysite.getNamespaceIndex(mysite.template_namespace())
+ mytpl = mysite.ns_index(mysite.template_namespace())
for template in templates:
transcludingArray = []
gen = pagegenerators.ReferringPageGenerator(
pywikibot.Page(mysite, template, ns=mytpl),
onlyTemplateInclusion=True)
if namespaces:
- gen = pagegenerators.NamespaceFilterPageGenerator(gen, namespaces)
+ gen = pagegenerators.NamespaceFilterPageGenerator(gen,
+ namespaces)
for page in gen:
transcludingArray.append(page)
yield template, transcludingArray
--
To view, visit
https://gerrit.wikimedia.org/r/186640
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I96dc118224965696531011d3f3a84dc559784584
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>