mailr17630 - in /trunk/extern/scientific_python/IO: ArrayIO.py FortranFormat.py PDB.py TextFile.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on October 01, 2012 - 22:15:
Author: bugman
Date: Mon Oct  1 22:15:43 2012
New Revision: 17630

URL: http://svn.gna.org/viewcvs/relax?rev=17630&view=rev
Log:
Python 3 - removal of the use of the string.atoi and string.atof functions.

These have been depreciated since Python 2.0!!  They have been replace by the 
int and float
functions.


Modified:
    trunk/extern/scientific_python/IO/ArrayIO.py
    trunk/extern/scientific_python/IO/FortranFormat.py
    trunk/extern/scientific_python/IO/PDB.py
    trunk/extern/scientific_python/IO/TextFile.py

Modified: trunk/extern/scientific_python/IO/ArrayIO.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/extern/scientific_python/IO/ArrayIO.py?rev=17630&r1=17629&r2=17630&view=diff
==============================================================================
--- trunk/extern/scientific_python/IO/ArrayIO.py (original)
+++ trunk/extern/scientific_python/IO/ArrayIO.py Mon Oct  1 22:15:43 2012
@@ -68,7 +68,7 @@
     data = []
     for line in TextFile(filename):
         if line[0] != '#':
-            data.append(map(string.atof, line.split()))
+            data.append(map(float, line.split()))
     a = Numeric.array(data)
     if a.shape[0] == 1 or a.shape[1] == 1:
         a = Numeric.ravel(a)

Modified: trunk/extern/scientific_python/IO/FortranFormat.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/extern/scientific_python/IO/FortranFormat.py?rev=17630&r1=17629&r2=17630&view=diff
==============================================================================
--- trunk/extern/scientific_python/IO/FortranFormat.py (original)
+++ trunk/extern/scientific_python/IO/FortranFormat.py Mon Oct  1 22:15:43 
2012
@@ -174,7 +174,7 @@
                     # e.g.: pdb2myd.ent.Z chain: - model: 0 : CONECT*****
                     # catch this and set value to None
                     try:
-                        value = string.atoi(s)
+                        value = int(s)
                     except:
                         value = None
             elif type == 'D' or type == 'E' or type == 'F' or type == 'G':
@@ -186,7 +186,7 @@
                     value = 0.
                 else:
                     try:
-                        value = string.atof(s)
+                        value = float(s)
                     except:
                         value = None
             if value is not None:
@@ -256,7 +256,7 @@
         while format and format[0] != ')':
             n = 0
             while format[0] in string.digits:
-                n = 10*n + string.atoi(format[0])
+                n = 10*n + int(format[0])
                 format = format[1:]
             if n == 0: n = 1
             type = format[0].upper()
@@ -291,12 +291,12 @@
                 else:
                     dot = field.find('.')
                     if dot > 0:
-                        length = string.atoi(field[:dot])
-                        fraction = string.atoi(field[dot+1:])
+                        length = int(field[:dot])
+                        fraction = int(field[dot+1:])
                         field = (type, length, fraction)
                     else:
                         if field:
-                            length = string.atoi(field)
+                            length = int(field)
                         else:
                             length = 1
                         field = (type, length)

Modified: trunk/extern/scientific_python/IO/PDB.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/extern/scientific_python/IO/PDB.py?rev=17630&r1=17629&r2=17630&view=diff
==============================================================================
--- trunk/extern/scientific_python/IO/PDB.py (original)
+++ trunk/extern/scientific_python/IO/PDB.py Mon Oct  1 22:15:43 2012
@@ -1313,7 +1313,7 @@
         element = data['element']
         if element != '':
             try:
-                string.atoi(element)
+                int(element)
             except ValueError:
                 atom_data['element'] = element
         residue_data = {'residue_name': data['residue_name']}

Modified: trunk/extern/scientific_python/IO/TextFile.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/extern/scientific_python/IO/TextFile.py?rev=17630&r1=17629&r2=17630&view=diff
==============================================================================
--- trunk/extern/scientific_python/IO/TextFile.py (original)
+++ trunk/extern/scientific_python/IO/TextFile.py Mon Oct  1 22:15:43 2012
@@ -13,7 +13,7 @@
 # Use the gzip module for Python version 1.5.2 or higher
 gzip = None
 try:
-    _version = map(string.atoi,
+    _version = map(int,
                    sys.version.split()[0], '.').split()
     if _version >= [1, 5, 2]:
         try:




Related Messages


Powered by MHonArc, Updated Mon Oct 01 22:40:02 2012