]> gitweb.michael.orlitzky.com - dead/census-tools.git/commitdiff
Added the StringUtils module with the is_integer() function.
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 12 Sep 2009 14:48:25 +0000 (10:48 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 12 Sep 2009 14:48:25 +0000 (10:48 -0400)
Imported StringUtils into SummaryFile1.
Removed the InvalidAreaError, since we need to accept areas of zero.

src/StringUtils.py [new file with mode: 0644]
src/SummaryFile1.py

diff --git a/src/StringUtils.py b/src/StringUtils.py
new file mode 100644 (file)
index 0000000..871f3fc
--- /dev/null
@@ -0,0 +1,7 @@
+def is_integer(s):
+    try:
+        x = int(s)
+        return True
+    except:
+        return False
+    
index bd69d0095137d30caff160fbed0cea2567530040..0ad410d0dc4152b6642d96fb10c3b9647e466c3c 100644 (file)
@@ -1,9 +1,10 @@
-import os, GPS, inspect
+import os
+
+import GPS
+import StringUtils
 
-class RecordError(StandardError):
-    pass
 
-class InvalidAreaError(StandardError):
+class RecordError(StandardError):
     pass
 
 class GeoRecord:
@@ -83,9 +84,6 @@ class GeoRecordParser:
             except ValueError:
                 # A value couldn't be converted to the appropriate type.
                 continue
-            except InvalidAreaError:
-                # Something is funny with the geometry.
-                continue
             
         return blocks