Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/99717


Change subject: [LINT] import needed time module, ignore editor's result (+pep8)
......................................................................

[LINT] import needed time module, ignore editor's result (+pep8)

- time.sleep() needs its module to be imported first
- editarticle.Texeditor's result is not used. So we may call it
  as a procedure and not as a function
- pep8 changes E501

Change-Id: Iab6d4a035a964189f3ad162bd47f926229911004
---
M scripts/blockpageschecker.py
1 file changed, 18 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/17/99717/1

diff --git a/scripts/blockpageschecker.py b/scripts/blockpageschecker.py
index d6f813f..1a55a99 100755
--- a/scripts/blockpageschecker.py
+++ b/scripts/blockpageschecker.py
@@ -64,6 +64,7 @@
 __version__ = '$Id$'
 #
 
+import time
 import re
 import webbrowser
 import pywikibot
@@ -85,8 +86,10 @@
     'en': None,
     'it': [r'\{\{(?:[Tt]emplate:|)[Aa]vvisobloccoparziale(?:|[ 
_]scad\|.*?|\|.*?)\}\}',
            r'\{\{(?:[Tt]emplate:|)[Aa]bp(?:|[ _]scad\|(?:.*?))\}\}'],
-    'fr': [r'\{\{(?:[Tt]emplate:|' + u'[Mm]odèle:' + r'|)[Ss]emi[- 
]?protection(|[^\}]*)\}\}'],
-    'ja': [r'(?<!\<nowiki\>)\{\{(?:[Tt]emplate:|)' + u'半保護' + 
r'(?:[Ss]|)(?:\|.+|)\}\}(?!\<\/nowiki\>)\s*(?:\r\n|)*'],
+    'fr': [r'\{\{(?:[Tt]emplate:|' + u'[Mm]odèle:' +
+           r'|)[Ss]emi[- ]?protection(|[^\}]*)\}\}'],
+    'ja': [r'(?<!\<nowiki\>)\{\{(?:[Tt]emplate:|)' +
+           u'半保護' + r'(?:[Ss]|)(?:\|.+|)\}\}(?!\<\/nowiki\>)\s*(?:\r\n|)*'],
 }
 # Regex to get the total-protection template
 templateTotalProtection = {
@@ -94,23 +97,28 @@
     'it': [r'\{\{(?:[Tt]emplate:|)[Aa]vvisoblocco(?:|[ 
_]scad\|(?:.*?)|minaccia|cancellata)\}\}',
            r'\{\{(?:[Tt]emplate:|)(?:[Cc][Tt]|[Cc]anc fatte|[Cc][Ee])\}\}',
            r'<div class="toccolours[ _]itwiki[ _]template[ 
_]avviso">(?:\s|\n)*?[Qq]uesta pagina'],
-    'fr': [r'\{\{(?:[Tt]emplate:|' + u'[Mm]odèle:' + 
r'|)[Pp]rotection(|[^\}]*)\}\}',
-           r'\{\{(?:[Tt]emplate:|' + u'[Mm]odèle:' + 
r'|)(?:[Pp]age|[Aa]rchive|' + u'[Mm]odèle) protégée' + r'?(|[^\}]*)\}\}'],
-    'ja': [r'(?<!\<nowiki\>)\{\{(?:[Tt]emplate:|)' + u'保護(?:性急|)' + 
r'(?:[Ss]|)(?:\|.+|)\}\}(?!\<\/nowiki\>)\s*(?:\r\n|)*'],
+    'fr': [r'\{\{(?:[Tt]emplate:|' + u'[Mm]odèle:' +
+           r'|)[Pp]rotection(|[^\}]*)\}\}',
+           r'\{\{(?:[Tt]emplate:|' + u'[Mm]odèle:' + 
r'|)(?:[Pp]age|[Aa]rchive|' +
+           u'[Mm]odèle) protégée' + r'?(|[^\}]*)\}\}'],
+    'ja': [r'(?<!\<nowiki\>)\{\{(?:[Tt]emplate:|)' + u'保護(?:性急|)' +
+           r'(?:[Ss]|)(?:\|.+|)\}\}(?!\<\/nowiki\>)\s*(?:\r\n|)*'],
 }
 
 # Regex to get the semi-protection move template
 templateSemiMoveProtection = {
     'en': None,
     'it': [r'\{\{(?:[Tt]emplate:|)[Aa]vvisobloccospostamento(?:|[ 
_]scad\|.*?|\|.*?)\}\}'],
-    'ja': [r'(?<!\<nowiki\>)\{\{(?:[Tt]emplate:|)' + u'移動半保護' + 
r'(?:[Ss]|)(?:\|.+|)\}\}(?!\<\/nowiki\>)\s*(?:\r\n|)*'],
+    'ja': [r'(?<!\<nowiki\>)\{\{(?:[Tt]emplate:|)' + u'移動半保護' +
+           r'(?:[Ss]|)(?:\|.+|)\}\}(?!\<\/nowiki\>)\s*(?:\r\n|)*'],
 }
 
 # Regex to get the total-protection move template
 templateTotalMoveProtection = {
     'en': None,
     'it': [r'\{\{(?:[Tt]emplate:|)[Aa]vvisobloccospostamento(?:|[ 
_]scad\|.*?|\|.*?)\}\}'],
-    'ja': [r'(?<!\<nowiki\>)\{\{(?:[Tt]emplate:|)' + u'移動保護' + 
r'(?:[Ss]|)(?:\|.+|)\}\}(?!\<\/nowiki\>)\s*(?:\r\n|)*'],
+    'ja': [r'(?<!\<nowiki\>)\{\{(?:[Tt]emplate:|)' + u'移動保護' +
+           r'(?:[Ss]|)(?:\|.+|)\}\}(?!\<\/nowiki\>)\s*(?:\r\n|)*'],
 }
 
 # If you use only one template for all the type of protection, put it here.
@@ -199,7 +207,7 @@
     elif quest == 'g':
         from pywikibot import editor as editarticle
         editor = editarticle.TextEditor()
-        text = editor.edit(page.get())
+        editor.edit(page.get())
 
 
 def main():
@@ -290,7 +298,8 @@
         # PreloadingGenerator cannot set correctly page.editRestriction
         # (see bug #1949476 )
         if not page.canBeEdited():
-            pywikibot.output("%s is sysop-protected : this account can't edit 
it! Skipping..." % pagename)
+            pywikibot.output("%s is sysop-protected : this account can't edit "
+                             "it! Skipping..." % pagename)
             continue
         """
         if 'edit' in restrictions.keys():

-- 
To view, visit https://gerrit.wikimedia.org/r/99717
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab6d4a035a964189f3ad162bd47f926229911004
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Mdupont <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to