diff --git a/shapefile.py b/shapefile.py index c125a909..698fed83 100644 --- a/shapefile.py +++ b/shapefile.py @@ -17,6 +17,8 @@ import array import tempfile import itertools +import datetime +import re # # Constants for shape types @@ -36,10 +38,12 @@ MULTIPATCH = 31 PYTHON3 = sys.version_info[0] == 3 +DATE_EXP = re.compile('\d{4}[-/]\d{2}[-/]\d{2}') if PYTHON3: xrange = range izip = zip + basestring = str else: from itertools import izip @@ -209,10 +213,8 @@ class Reader: but is not required to read the geometry from the .shp file. The "shapefile" argument in the constructor is the name of the file you want to open. - You can instantiate a Reader without specifying a shapefile and then specify one later with the load() method. - Only the shapefile headers are read upon loading. Content within each file is only accessed when required and as efficiently as possible. Shapefiles are usually not large @@ -248,7 +250,7 @@ def __init__(self, *args, **kwargs): self.dbf = kwargs["dbf"] if hasattr(self.dbf, "seek"): self.dbf.seek(0) - if self.shp or self.dbf: + if self.shp or self.dbf: self.load() else: raise ShapefileException("Shapefile Reader requires a shapefile or file-like object.") @@ -373,7 +375,7 @@ def __shape(self): record.m = unpack("