[tor-commits] [stem/master] Enum docs for stem.control.EventType

atagar at torproject.org atagar at torproject.org
Mon Dec 3 02:35:44 UTC 2012


commit d7dc386533f0b7885f2966922b9cb051c1b89384
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Nov 11 12:36:37 2012 -0800

    Enum docs for stem.control.EventType
    
    I had been doing a table for the EventType enum under the add_event_listener()
    method. This made sense and matched with what I'm doing for enumeration
    documentation except that this should be a interlinkable :data: field in our
    header.
---
 stem/control.py |   45 +++++++++++++++++++++++++--------------------
 1 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index 846aba7..1c1139f 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -54,13 +54,31 @@ providing its own for interacting at a higher level.
   
   Enumeration for states that a controller can have.
   
-  ====== ===========
-  State  Description
-  ====== ===========
-  INIT   new control connection
-  RESET  received a reset/sighup signal
-  CLOSED control connection closed
-  ====== ===========
+  ========== ===========
+  State      Description
+  ========== ===========
+  **INIT**   new control connection
+  **RESET**  received a reset/sighup signal
+  **CLOSED** control connection closed
+  ========== ===========
+
+.. data:: EventType (enum)
+  
+  Known types of events that the
+  :func:`~stem.control.Controller.add_event_listener` method of the
+  :class:`~stem.control.Controller` can listen for. Enums are mapped to
+  :class:`~stem.response.events.Event` subclasses as follows...
+  
+  =========== ===========
+  EventType   Event Class
+  =========== ===========
+  **DEBUG**   :class:`stem.response.events.LogEvent`
+  **INFO**    :class:`stem.response.events.LogEvent`
+  **NOTICE**  :class:`stem.response.events.LogEvent`
+  **WARN**    :class:`stem.response.events.LogEvent`
+  **ERR**     :class:`stem.response.events.LogEvent`
+  **BW**      :class:`stem.response.events.BandwidthEvent`
+  =========== ===========
 """
 
 from __future__ import with_statement
@@ -596,19 +614,6 @@ class Controller(BaseController):
         controller.add_event_listener(print_bw, EventType.BW)
         time.sleep(5)
     
-    The EventType enumeration is mapped to event classes as follows...
-    
-    =========== ===========
-    EventType   Event Class
-    =========== ===========
-    **DEBUG**   :class:`stem.response.events.LogEvent`
-    **INFO**    :class:`stem.response.events.LogEvent`
-    **NOTICE**  :class:`stem.response.events.LogEvent`
-    **WARN**    :class:`stem.response.events.LogEvent`
-    **ERR**     :class:`stem.response.events.LogEvent`
-    **BW**      :class:`stem.response.events.BandwidthEvent`
-    =========== ===========
-    
     :param functor listener: function to be called when an event is received
     :param stem.control.EventType events: event types to be listened for
     





More information about the tor-commits mailing list