[MediaWiki-commits] [Gerrit] pep8-ified userinterfaces - change (pywikibot/core)

2013-08-26 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged.

Change subject: pep8-ified userinterfaces
..


pep8-ified userinterfaces

Change-Id: If5dd6cad8eb9841dfc560842aa2c146849d96823
---
M pywikibot/userinterfaces/cgi_interface.py
M pywikibot/userinterfaces/terminal_interface_base.py
M pywikibot/userinterfaces/terminal_interface_unix.py
M pywikibot/userinterfaces/terminal_interface_win32.py
M pywikibot/userinterfaces/transliteration.py
M pywikibot/userinterfaces/win32_unicode.py
6 files changed, 127 insertions(+), 122 deletions(-)

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



diff --git a/pywikibot/userinterfaces/cgi_interface.py 
b/pywikibot/userinterfaces/cgi_interface.py
index 7cf2fd3..21fd9ff 100644
--- a/pywikibot/userinterfaces/cgi_interface.py
+++ b/pywikibot/userinterfaces/cgi_interface.py
@@ -1,13 +1,14 @@
 import sys
 
+
 class UI:
 def __init__(self):
 pass
 
-def output(self, text, colors = None, newline = True, toStdout = False):
+def output(self, text, colors=None, newline=True, toStdout=False):
 if not toStdout:
 return
 sys.stdout.write(text.encode('UTF-8', 'replace'))
 
-def input(self, question, colors = None):
-self.output(question + ' ', newline = False, showcgi = True)
+def input(self, question, colors=None):
+self.output(question + ' ', newline=False, showcgi=True)
diff --git a/pywikibot/userinterfaces/terminal_interface_base.py 
b/pywikibot/userinterfaces/terminal_interface_base.py
index 3c1caad..84f7102 100755
--- a/pywikibot/userinterfaces/terminal_interface_base.py
+++ b/pywikibot/userinterfaces/terminal_interface_base.py
@@ -7,7 +7,9 @@
 __version__ = '$Id$'
 
 import transliteration
-import traceback, re, sys
+import traceback
+import re
+import sys
 import pywikibot as wikipedia
 from pywikibot import config
 from pywikibot.bot import DEBUG, VERBOSE, INFO, STDOUT, INPUT, WARNING
@@ -40,15 +42,15 @@
 
 class UI:
 def __init__(self):
-self.stdin  = sys.stdin
+self.stdin = sys.stdin
 self.stdout = sys.stdout
 self.stderr = sys.stderr
 self.encoding = config.console_encoding
 self.transliteration_target = config.transliteration_target
-
+
 self.stderr = sys.stderr
 self.stdout = sys.stdout
-
+
 def init_handlers(self, root_logger, default_stream='stderr'):
 Initialize the handlers for user output.
 
@@ -94,7 +96,7 @@
 def printNonColorized(self, text, targetStream):
 # We add *** after the text as a whole if anything needed to be 
colorized.
 lines = text.split('\n')
-for i,line in enumerate(lines):
+for i, line in enumerate(lines):
 if i  0:
 line = \n + line
 line, count = colorTagR.subn('', line)
@@ -103,19 +105,18 @@
 targetStream.write(line.encode(self.encoding, 'replace'))
 
 printColorized = printNonColorized
-
+
 def _print(self, text, targetStream):
 if config.colorized_output:
 self.printColorized(text, targetStream)
 else:
-self.printNonColorized(text, targetStream)
+self.printNonColorized(text, targetStream)
 
 def output(self, text, toStdout=False, targetStream=None):
 
 If a character can't be displayed in the encoding used by the user's
 terminal, it will be replaced with a question mark or by a
 transliteration.
-
 
 if config.transliterate:
 # Encode our unicode string in the encoding used by the user's
@@ -139,10 +140,10 @@
 if codecedText[i] == '?' and text[i] != u'?':
 try:
 transliterated = transliterator.transliterate(
-text[i], default='?', prev=prev, next=text[i+1])
+text[i], default='?', prev=prev, next=text[i + 1])
 except IndexError:
 transliterated = transliterator.transliterate(
-text[i], default = '?', prev=prev, next=' ')
+text[i], default='?', prev=prev, next=' ')
 # transliteration was successful. The replacement
 # could consist of multiple letters.
 # mark the transliterated letters in yellow.
@@ -158,19 +159,19 @@
 transliteratedText += codecedText[i]
 prev = codecedText[i]
 text = transliteratedText
-
+
 if not targetStream:
 if toStdout:
 targetStream = self.stdout
 else:
 targetStream = self.stderr
-
+
 self._print(text, targetStream)
 
 def _raw_input(self):
 return raw_input()
-
-def input(self, question, password = False):
+

[MediaWiki-commits] [Gerrit] pep8-ified userinterfaces - change (pywikibot/core)

2013-08-24 Thread Merlijn van Deen (Code Review)
Merlijn van Deen has uploaded a new change for review.

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


Change subject: pep8-ified userinterfaces
..

pep8-ified userinterfaces

Change-Id: If5dd6cad8eb9841dfc560842aa2c146849d96823
---
M pywikibot/userinterfaces/cgi_interface.py
M pywikibot/userinterfaces/terminal_interface_base.py
M pywikibot/userinterfaces/terminal_interface_unix.py
M pywikibot/userinterfaces/terminal_interface_win32.py
M pywikibot/userinterfaces/transliteration.py
M pywikibot/userinterfaces/win32_unicode.py
6 files changed, 127 insertions(+), 122 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/79/80779/1

diff --git a/pywikibot/userinterfaces/cgi_interface.py 
b/pywikibot/userinterfaces/cgi_interface.py
index 7cf2fd3..21fd9ff 100644
--- a/pywikibot/userinterfaces/cgi_interface.py
+++ b/pywikibot/userinterfaces/cgi_interface.py
@@ -1,13 +1,14 @@
 import sys
 
+
 class UI:
 def __init__(self):
 pass
 
-def output(self, text, colors = None, newline = True, toStdout = False):
+def output(self, text, colors=None, newline=True, toStdout=False):
 if not toStdout:
 return
 sys.stdout.write(text.encode('UTF-8', 'replace'))
 
-def input(self, question, colors = None):
-self.output(question + ' ', newline = False, showcgi = True)
+def input(self, question, colors=None):
+self.output(question + ' ', newline=False, showcgi=True)
diff --git a/pywikibot/userinterfaces/terminal_interface_base.py 
b/pywikibot/userinterfaces/terminal_interface_base.py
index 3c1caad..84f7102 100755
--- a/pywikibot/userinterfaces/terminal_interface_base.py
+++ b/pywikibot/userinterfaces/terminal_interface_base.py
@@ -7,7 +7,9 @@
 __version__ = '$Id$'
 
 import transliteration
-import traceback, re, sys
+import traceback
+import re
+import sys
 import pywikibot as wikipedia
 from pywikibot import config
 from pywikibot.bot import DEBUG, VERBOSE, INFO, STDOUT, INPUT, WARNING
@@ -40,15 +42,15 @@
 
 class UI:
 def __init__(self):
-self.stdin  = sys.stdin
+self.stdin = sys.stdin
 self.stdout = sys.stdout
 self.stderr = sys.stderr
 self.encoding = config.console_encoding
 self.transliteration_target = config.transliteration_target
-
+
 self.stderr = sys.stderr
 self.stdout = sys.stdout
-
+
 def init_handlers(self, root_logger, default_stream='stderr'):
 Initialize the handlers for user output.
 
@@ -94,7 +96,7 @@
 def printNonColorized(self, text, targetStream):
 # We add *** after the text as a whole if anything needed to be 
colorized.
 lines = text.split('\n')
-for i,line in enumerate(lines):
+for i, line in enumerate(lines):
 if i  0:
 line = \n + line
 line, count = colorTagR.subn('', line)
@@ -103,19 +105,18 @@
 targetStream.write(line.encode(self.encoding, 'replace'))
 
 printColorized = printNonColorized
-
+
 def _print(self, text, targetStream):
 if config.colorized_output:
 self.printColorized(text, targetStream)
 else:
-self.printNonColorized(text, targetStream)
+self.printNonColorized(text, targetStream)
 
 def output(self, text, toStdout=False, targetStream=None):
 
 If a character can't be displayed in the encoding used by the user's
 terminal, it will be replaced with a question mark or by a
 transliteration.
-
 
 if config.transliterate:
 # Encode our unicode string in the encoding used by the user's
@@ -139,10 +140,10 @@
 if codecedText[i] == '?' and text[i] != u'?':
 try:
 transliterated = transliterator.transliterate(
-text[i], default='?', prev=prev, next=text[i+1])
+text[i], default='?', prev=prev, next=text[i + 1])
 except IndexError:
 transliterated = transliterator.transliterate(
-text[i], default = '?', prev=prev, next=' ')
+text[i], default='?', prev=prev, next=' ')
 # transliteration was successful. The replacement
 # could consist of multiple letters.
 # mark the transliterated letters in yellow.
@@ -158,19 +159,19 @@
 transliteratedText += codecedText[i]
 prev = codecedText[i]
 text = transliteratedText
-
+
 if not targetStream:
 if toStdout:
 targetStream = self.stdout
 else:
 targetStream = self.stderr
-
+
 self._print(text, targetStream)
 
 def _raw_input(self):
 return raw_input()
-