From: Michael Orlitzky Date: Sat, 12 Sep 2009 14:48:25 +0000 (-0400) Subject: Added the StringUtils module with the is_integer() function. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=75ac117b996561aea48d7c30c2ebdb6db8177c14;p=dead%2Fcensus-tools.git Added the StringUtils module with the is_integer() function. Imported StringUtils into SummaryFile1. Removed the InvalidAreaError, since we need to accept areas of zero. --- diff --git a/src/StringUtils.py b/src/StringUtils.py new file mode 100644 index 0000000..871f3fc --- /dev/null +++ b/src/StringUtils.py @@ -0,0 +1,7 @@ +def is_integer(s): + try: + x = int(s) + return True + except: + return False + diff --git a/src/SummaryFile1.py b/src/SummaryFile1.py index bd69d00..0ad410d 100644 --- a/src/SummaryFile1.py +++ b/src/SummaryFile1.py @@ -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