[Scipy-svn] r3523 - in trunk/scipy/weave: . tests
scipy-svn at scipy.org
scipy-svn at scipy.org
Tue Nov 13 00:59:04 EST 2007
Author: jarrod.millman
Date: 2007-11-12 23:59:01 -0600 (Mon, 12 Nov 2007)
New Revision: 3523
Modified:
trunk/scipy/weave/blitz_tools.py
trunk/scipy/weave/inline_tools.py
trunk/scipy/weave/tests/test_numpy_scalar_spec.py
Log:
use builtin string methods rather than the string module
Modified: trunk/scipy/weave/blitz_tools.py
===================================================================
--- trunk/scipy/weave/blitz_tools.py 2007-11-13 05:54:51 UTC (rev 3522)
+++ trunk/scipy/weave/blitz_tools.py 2007-11-13 05:59:01 UTC (rev 3523)
@@ -1,5 +1,4 @@
import parser
-import string
import sys
import ast_tools
import slice_handler
@@ -91,18 +90,18 @@
# be included in the generated code.
# These could all alternatively be done to the ast in
# build_slice_atom()
- expr = string.replace(expr,'slice(_beg,_end)', '_all' )
- expr = string.replace(expr,'slice', 'blitz::Range' )
- expr = string.replace(expr,'[','(')
- expr = string.replace(expr,']', ')' )
- expr = string.replace(expr,'_stp', '1' )
+ expr = expr.replace('slice(_beg,_end)', '_all' )
+ expr = expr.replace('slice', 'blitz::Range' )
+ expr = expr.replace('[','(')
+ expr = expr.replace(']', ')' )
+ expr = expr.replace)'_stp', '1' )
# Instead of blitz::fromStart and blitz::toEnd. This requires
# the following in the generated code.
# Range _beg = blitz::fromStart;
# Range _end = blitz::toEnd;
- #expr = string.replace(expr,'_beg', 'blitz::fromStart' )
- #expr = string.replace(expr,'_end', 'blitz::toEnd' )
+ #expr = expr.replace('_beg', 'blitz::fromStart' )
+ #expr = expr.replace('_end', 'blitz::toEnd' )
return expr + ';\n'
Modified: trunk/scipy/weave/inline_tools.py
===================================================================
--- trunk/scipy/weave/inline_tools.py 2007-11-13 05:54:51 UTC (rev 3522)
+++ trunk/scipy/weave/inline_tools.py 2007-11-13 05:59:01 UTC (rev 3523)
@@ -1,8 +1,8 @@
# should re-write compiled functions to take a local and global dict
# as input.
-import sys,os
+import sys
+import os
import ext_tools
-import string
import catalog
import common_info
@@ -60,21 +60,21 @@
arg_strings = []
for arg in self.arg_specs:
arg_strings.append(arg.declaration_code(inline=1))
- code = string.join(arg_strings,"")
+ code = arg_strings.join("")
return code
def arg_cleanup_code(self):
arg_strings = []
for arg in self.arg_specs:
arg_strings.append(arg.cleanup_code())
- code = string.join(arg_strings,"")
+ code = arg_strings.join("")
return code
def arg_local_dict_code(self):
arg_strings = []
for arg in self.arg_specs:
arg_strings.append(arg.local_dict_code())
- code = string.join(arg_strings,"")
+ code = arg_strings.join("")
return code
Modified: trunk/scipy/weave/tests/test_numpy_scalar_spec.py
===================================================================
--- trunk/scipy/weave/tests/test_numpy_scalar_spec.py 2007-11-13 05:54:51 UTC (rev 3522)
+++ trunk/scipy/weave/tests/test_numpy_scalar_spec.py 2007-11-13 05:59:01 UTC (rev 3523)
@@ -1,5 +1,6 @@
import time
-import os,sys
+import os
+import sys
# Note: test_dir is global to this file.
# It is made by setup_test_location()
@@ -25,10 +26,9 @@
return m
def remove_whitespace(in_str):
- import string
- out = string.replace(in_str," ","")
- out = string.replace(out,"\t","")
- out = string.replace(out,"\n","")
+ out = in_str.replace(" ","")
+ out = out.replace("\t","")
+ out = out.replace("\n","")
return out
def print_assert_equal(test_string,actual,desired):
More information about the Scipy-svn
mailing list