[tor-dev] RFC: remove TorUtil.Enum

Sean Robinson seankrobinson at gmail.com
Sat Jun 18 23:12:07 UTC 2011

  I have been reviewing the TorCtl package and I will be submitting
tickets (usually with patches) for clean-ups, fixes, etc.  Before I
submit a ticket for removing TorUtil.Enum, I wanted to hear from other
devs.  There are no users of this class within TorCtl, so Enum is now
cruft.  Does anyone have a problem with removing Enum?  If I do not
get negative feedback about this patch, I will submit it later in the

  The following patch is also attached to this message as a gzipped patch file.

diff --git a/TorUtil.py b/TorUtil.py
index 3163d09..1d27144 100644
--- a/TorUtil.py
+++ b/TorUtil.py
@@ -22,7 +22,7 @@ if sys.version_info < (2, 5):
   from hashlib import sha1

-__all__ = ["Enum", "Enum2", "Callable", "sort_list", "quote",
"escape_dots", "unescape_dots",
+__all__ = ["Enum2", "Callable", "sort_list", "quote", "escape_dots",
       "BufSock", "secret_to_key", "urandom_rng", "s2k_gen",
"s2k_check", "plog",
      "ListenSocket", "zprob", "logfile", "loglevel", "loglevels"]

@@ -127,16 +127,6 @@ def read_config(filename):
   loglevel = config.get('TorCtl', 'loglevel')

-class Enum(object):
-  """ Defines an ordered dense name-to-number 1-1 mapping """
-  def __init__(self, start, names):
-    self.nameOf = {}
-    idx = start
-    for name in names:
-      setattr(self,name,idx)
-      self.nameOf[idx] = name
-      idx += 1
 class Enum2(object):
   """ Defines an ordered sparse name-to-number 1-1 mapping """
   def __init__(self, **args):

Sean Robinson
WiFi Radar - http://wifi-radar.berlios.de
Python WiFi - http://pythonwifi.wikispot.org
pymnl - http://pymnl.wikispot.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Remove-TorUtil.Enum.patch.gz
Type: application/x-gzip
Size: 779 bytes
Desc: not available
URL: <http://lists.torproject.org/pipermail/tor-dev/attachments/20110618/e4227fad/attachment.bin>

More information about the tor-dev mailing list