Use string.rindex (which is in Python 2.3) instead of my own version. trunk

Tue, 05 May 2009 20:31:53 -0400

author
Brett Smith <brettcsmith@brettcsmith.org>
date
Tue, 05 May 2009 20:31:53 -0400
branch
trunk
changeset 110
6cbe6cb5a903
parent 109
fc00559c4ffa
child 111
09be2149c500

Use string.rindex (which is in Python 2.3) instead of my own version.

scripts/dtrx file | annotate | diff | comparison | revisions
--- a/scripts/dtrx	Tue May 05 20:27:58 2009 -0400
+++ b/scripts/dtrx	Tue May 05 20:31:53 2009 -0400
@@ -30,6 +30,7 @@
 import shutil
 import signal
 import stat
+import string
 import struct
 import subprocess
 import sys
@@ -491,13 +492,6 @@
     list_command = ['7z', 'l']
     border_re = re.compile('^[- ]+$')
 
-    def rindex(line, target):
-        for index in range(-1, -len(line) - 1, -1):
-            if line[index] == target:
-                return len(line) + index
-        raise ValueError("substring not found")
-    rindex = staticmethod(rindex)
-
     def get_filenames(self):
         fn_index = None
         for line in NoPipeExtractor.get_filenames(self):
@@ -505,7 +499,7 @@
                 if fn_index is not None:
                     break
                 else:
-                    fn_index = self.rindex(line, ' ') + 1
+                    fn_index = string.rindex(line, ' ') + 1
             elif fn_index is not None:
                 yield line[fn_index:]
         self.archive.close()

mercurial