[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Move event_summary() to control module
commit 5fff8a45d81d8edb5ec3dbff19df3125da88429d
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Fri May 20 08:32:23 2016 -0700
Move event_summary() to control module
Gave this a bit more thought and I was wrong to suggest putting this in
response/events.py. The response module is internal - we don't tell users it
exists so we shouldn't put callable functions in there. The control module
already includes an enum of all the event types so this actually isn't such a
bad fit.
---
stem/control.py | 12 ++++++++++++
stem/response/events.py | 12 ------------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/stem/control.py b/stem/control.py
index 3243d1c..0ed7e8d 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -261,6 +261,7 @@ import stem.descriptor.reader
import stem.descriptor.router_status_entry
import stem.descriptor.server_descriptor
import stem.exit_policy
+import stem.manual
import stem.response
import stem.response.events
import stem.socket
@@ -475,6 +476,17 @@ def with_default(yields = False):
return decorator
+def event_summary(event):
+ """
+ Provides a description for Tor events.
+
+ :param str event: the event for which a description is needed
+
+ :returns: str The event description
+ """
+ return stem.manual._config().get('event.description.%s' % event.lower(), '')
+
+
class BaseController(object):
"""
Controller for the tor process. This is a minimal base class for other
diff --git a/stem/response/events.py b/stem/response/events.py
index 50051c0..35cc98f 100644
--- a/stem/response/events.py
+++ b/stem/response/events.py
@@ -8,7 +8,6 @@ import time
import stem
import stem.control
import stem.descriptor.router_status_entry
-import stem.manual
import stem.response
import stem.version
@@ -1322,17 +1321,6 @@ def _parse_cell_type_mapping(mapping):
return results
-def event_summary(event):
- """
- Provides a description for Tor events.
-
- :param str event: the event for which a description is needed
-
- :returns: str The event description
- """
- return stem.manual._config().get('event.description.%s' % event.lower(), '')
-
-
EVENT_TYPE_TO_CLASS = {
'ADDRMAP': AddrMapEvent,
'AUTHDIR_NEWDESCS': AuthDirNewDescEvent,
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits