]> gitweb.michael.orlitzky.com - dead/census-tools.git/blobdiff - src/SummaryFile1.py
Added the StringUtils module with the is_integer() function.
[dead/census-tools.git] / src / SummaryFile1.py
index 3c82186474108e72908d3d3ded341d48470c1409..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:
     pass
 
 class GeoRecord:
@@ -11,7 +12,7 @@ class GeoRecord:
     This class wraps one record in an SF1 geo file.
     """
 
     This class wraps one record in an SF1 geo file.
     """
 
-    MinimumLineLength = 400
+    MINIMUM_LINE_LENGTH = 400
 
 
 class Block:
 
 
 class Block:
@@ -83,9 +84,6 @@ class GeoRecordParser:
             except ValueError:
                 # A value couldn't be converted to the appropriate type.
                 continue
             except ValueError:
                 # A value couldn't be converted to the appropriate type.
                 continue
-            except InvalidAreaError:
-                # Something is funny with the geometry.
-                continue
             
         return blocks
 
             
         return blocks
 
@@ -98,8 +96,8 @@ class GeoRecordParser:
         allow the GeoRecord class to parse the data meaningfully and
         throw an error if something doesn't look right.
         """
         allow the GeoRecord class to parse the data meaningfully and
         throw an error if something doesn't look right.
         """
-        if (len(line) < GeoRecord.MinimumLineLength):
-            raise RecordError("The input line is too short. The SF1 specification requires a line length of %d characters; this line contains only %d characters" % (GeoRecord.MinimumLineLength, len(line)))
+        if (len(line) < GeoRecord.MINIMUM_LINE_LENGTH):
+            raise RecordError("The input line is too short. The SF1 specification requires a line length of %d characters; this line contains only %d characters" % (GeoRecord.MINIMUM_LINE_LENGTH, len(line)))
         
         record = GeoRecord()
 
         
         record = GeoRecord()