Xqt has uploaded a new change for review.

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

Change subject: Reorder Option classes
......................................................................

Reorder Option classes

Place ListOption near by its superclass IntegerOoption and ContextOption near
by NestedOption which are both inherited from OutputOptionand  StandardOption.

Change-Id: Ic66d0aba4401ffc5767d9c2d036fed32b7490d2d
---
M pywikibot/bot_choice.py
1 file changed, 29 insertions(+), 29 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/48/224748/1

diff --git a/pywikibot/bot_choice.py b/pywikibot/bot_choice.py
index 3db1958..24a39d4 100755
--- a/pywikibot/bot_choice.py
+++ b/pywikibot/bot_choice.py
@@ -159,6 +159,35 @@
         pywikibot.output(self._output)
 
 
+class ContextOption(OutputOption, StandardOption):
+
+    """An option to show more and more context."""
+
+    def __init__(self, option, shortcut, text, context, delta=100, start=0, 
end=0):
+        """Constructor."""
+        super(ContextOption, self).__init__(option, shortcut, False)
+        self.text = text
+        self.context = context
+        self.delta = delta
+        self.start = start
+        self.end = end
+
+    def result(self, value):
+        """Add the delta to the context and output it."""
+        self.context += self.delta
+        super(ContextOption, self).result(value)
+
+    def output(self):
+        """Output the context."""
+        start = max(0, self.start - self.context)
+        end = min(len(self.text), self.end + self.context)
+        self.output_range(start, end)
+
+    def output_range(self, start_context, end_context):
+        """Output a section from the text."""
+        pywikibot.output(self.text[start_context:end_context])
+
+
 class IntegerOption(Option):
 
     """An option allowing a range of integers."""
@@ -234,35 +263,6 @@
     def result(self, value):
         """Return the value converted into int."""
         return (self.prefix, self.parse(value))
-
-
-class ContextOption(OutputOption, StandardOption):
-
-    """An option to show more and more context."""
-
-    def __init__(self, option, shortcut, text, context, delta=100, start=0, 
end=0):
-        """Constructor."""
-        super(ContextOption, self).__init__(option, shortcut, False)
-        self.text = text
-        self.context = context
-        self.delta = delta
-        self.start = start
-        self.end = end
-
-    def result(self, value):
-        """Add the delta to the context and output it."""
-        self.context += self.delta
-        super(ContextOption, self).result(value)
-
-    def output(self):
-        """Output the context."""
-        start = max(0, self.start - self.context)
-        end = min(len(self.text), self.end + self.context)
-        self.output_range(start, end)
-
-    def output_range(self, start_context, end_context):
-        """Output a section from the text."""
-        pywikibot.output(self.text[start_context:end_context])
 
 
 class ListOption(IntegerOption):

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic66d0aba4401ffc5767d9c2d036fed32b7490d2d
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <i...@gno.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to