http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11466
Revision: 11466 Author: xqt Date: 2013-04-27 07:06:02 +0000 (Sat, 27 Apr 2013) Log Message: ----------- POP8 changes, reoder imports
Modified Paths: -------------- trunk/pywikipedia/maintenance/setmail.py
Modified: trunk/pywikipedia/maintenance/setmail.py =================================================================== --- trunk/pywikipedia/maintenance/setmail.py 2013-04-27 06:54:52 UTC (rev 11465) +++ trunk/pywikipedia/maintenance/setmail.py 2013-04-27 07:06:02 UTC (rev 11466) @@ -2,24 +2,28 @@ """ This tool sets an email address on all bot accounts and email confirms them. """ # -# (C) Pywikipedia bot team, 2013 +# (C) Pywikipedia bot team, 2007-2013 # # Distributed under the terms of the MIT license. # __version__ = '$Id$' #
-import sys, os, getpass -sys.path.insert(1, '..') - -import poplib -import wikipedia, config -import preferences +import getpass +import os import re +import sys import urllib2 +import poplib
+import preferences +sys.path.insert(1, '..') +import wikipedia +import config + + def confirm(link): - req = urllib2.Request(link, headers = {'User-Agent': wikipedia.useragent}) + req = urllib2.Request(link, headers={'User-Agent': wikipedia.useragent}) u = urllib2.urlopen(req) u.close()
@@ -36,14 +40,17 @@ if not port: port = 110 ssl = wikipedia.inputChoice('SSL? ', ['no', 'yes'], - ['n', 'y'], (port == 995) and 'y' or 'n') == 'y' + ['n', 'y'], + (port == 995) and 'y' or 'n') == 'y' username = wikipedia.input('User?') password = wikipedia.input('Password?', True) - do_delete = wikipedia.inputChoice('Delete confirmed mails?', ['yes', 'no'], ['y', 'n'], 'y') == 'y' + do_delete = wikipedia.inputChoice('Delete confirmed mails?', ['yes', 'no'], + ['y', 'n'], 'y') == 'y'
if email: - preferences.set_all(['wpUserEmail', 'wpEmailFlag', 'wpOpenotifusertalkpages'], - [email, True, False], verbose = True) + preferences.set_all(['wpUserEmail', 'wpEmailFlag', + 'wpOpenotifusertalkpages'], + [email, True, False], verbose=True)
if ssl: pop = poplib.POP3_SSL(host, port) @@ -69,4 +76,3 @@ elif do_delete: pop.dele(i) pop.quit() -
pywikipedia-svn@lists.wikimedia.org