CVS: tmda/TMDA Util.py,1.104,1.105

"Jason R. Mastaler" <[email protected]>
Newsgroups gmane.mail.spam.tmda.cvs
Message-ID <[email protected]>
Update of /cvsroot/tmda/tmda/TMDA
In directory sc8-pr-cvs1:/tmp/cvs-serv26879/TMDA

Modified Files:
	Util.py 
Log Message:
Replace all remaining uses of the string module with string methods.


Index: Util.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/Util.py,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -r1.104 -r1.105
--- Util.py	22 Sep 2003 23:00:21 -0000	1.104
+++ Util.py	22 Sep 2003 23:15:49 -0000	1.105
@@ -35,7 +35,6 @@
 import re
 import socket
 import stat
-import string
 import sys
 import tempfile
 import time
@@ -266,9 +265,9 @@
         timesecs = time.time()
     timetuple = time.localtime(timesecs)
     tzname = time.tzname[timetuple[-1]]
-    asctime_list = string.split(time.asctime(timetuple))
+    asctime_list = time.asctime(timetuple).split()
     asctime_list.insert(len(asctime_list)-1, tzname)
-    return string.join(asctime_list)
+    return ' '.join(asctime_list)
 
 
 def make_msgid(timesecs=None, pid=None):
@@ -311,14 +310,14 @@
 def file_to_dict(file, dict):
     """Process and add then each line of a textfile to a dictionary."""
     for line in fileinput.input(file):
-        line = string.strip(line)
+        line = line.strip()
         # Comment or blank line?
         if line == '' or line[0] in '#':
             continue
         else:
-            fields = string.split(line)
+            fields = line.split()
             key = fields[0]
-            key = string.lower(key)
+            key = key.lower()
             value = fields[1]
             dict[key] = value
     return dict
@@ -328,14 +327,12 @@
     """Process and then append each line of file to list."""
     list = []
     for line in fileinput.input(file):
-        line = string.strip(line)
+        line = line.strip()
         # Comment or blank line?
         if line == '' or line[0] in '#':
             continue
         else:
-            line = string.expandtabs(line)
-            line = string.split(line, ' #')[0]
-            line = string.strip(line)
+            line = line.expandtabs().split('#')[0].strip()
             list.append(line)
     return list
 
@@ -767,13 +764,13 @@
     the string if it exists (for exp and ext addresses only)."""
     for address in addrs:
         if address:
-            address = string.lower(address)
+            address = address.lower()
             for p in list:
-                stringparts = string.split(p)
+                stringparts = p.split()
                 p = stringparts[0]
                 # Handle special @=domain.dom syntax.
                 try:
-                    at = string.rindex(p, '@')
+                    at = p.rindex('@')
                     atequals = p[at+1] == '='
                 except (ValueError, IndexError):
                     atequals = None

_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.