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

Change subject: [cleanup] Show a FutureWarning for deprecated namespace function
......................................................................

[cleanup] Show a FutureWarning for deprecated namespace function

- namespaces funtion is deprecated for 5 years
- Shorten txt2 assignment: Page.text property return empty string for
  non-existent pages
- use Python 3 syntax

Change-Id: Id1bc22f480cee7fddcaddb6a9e2bcff749f09ac6
---
M scripts/replicate_wiki.py
1 file changed, 3 insertions(+), 8 deletions(-)

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



diff --git a/scripts/replicate_wiki.py b/scripts/replicate_wiki.py
index a73c15d..1d42b26 100755
--- a/scripts/replicate_wiki.py
+++ b/scripts/replicate_wiki.py
@@ -43,8 +43,6 @@
 #
 # Distributed under the terms of the MIT license.
 #
-from __future__ import absolute_import, division, unicode_literals
-
 import sys

 from argparse import ArgumentParser
@@ -56,7 +54,7 @@
 from pywikibot.tools import deprecated
 

-@deprecated('BaseSite.namespaces', since='20150515')
+@deprecated('BaseSite.namespaces', since='20150515', future_warning=True)
 def namespaces(site):
     """Return a dictionary from namespace number to prefix."""
     return {n.id: n.custom_name for n in site.namespaces}
@@ -69,7 +67,7 @@
     return text


-class SyncSites(object):
+class SyncSites:

     """Work is done in here."""

@@ -211,10 +209,7 @@
             else:
                 page2 = Page(site, pagename)

-            if page2.exists():
-                txt2 = page2.text
-            else:
-                txt2 = ''
+            txt2 = page2.text

             if str(site) in config.replicate_replace:
                 txt_new = multiple_replace(txt1,

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/618234
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: Id1bc22f480cee7fddcaddb6a9e2bcff749f09ac6
Gerrit-Change-Number: 618234
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to