original_docstring: Returns the header info and geometry for a single shape.
docstring: Returns the header info and geometry for a single shape.
docstring_tokens: Returns the header info and geometry for a single shape .
code: def __shape(self):
          """Returns the header info and geometry for a single shape."""
          f = self.__getFileObj(self.shp)
          record = Shape()
          nParts = nPoints = zmin = zmax = mmin = mmax = None
          (recNum, recLength) = unpack(">2i", f.read(8))
          # Determine the start of the next record
          next = f.tell() + (2 * recLength)
          shapeType = unpack("<i", f.read(4))[0]
          record.shapeType = shapeType
          # For Null shapes create an empty points list for consistency
          if shapeType == 0:
              record.points = []
          # All shape types capable of having a bounding box
          elif shapeType in (3,5,8,13,15,18,23,25,28,31):
              record.bbox = _Array('d', unpack("<4d", f.read(32)))
          # Shape types with parts
          if shapeType in (3,5,13,15,23,25,31):
              nParts = unpack("<i", f.read(4))[0]
          # Shape types with points
          if shapeType in (3,5,8,13,15,18,23,25,28,31):
              nPoints = unpack("<i", f.read(4))[0]
          # Read parts
          if nParts:
              record.parts = _Array('i', unpack("<%si" % nParts, f.read(nParts * 4)))
          # Read part types for Multipatch - 31
          if shapeType == 31:
              record.partTypes = _Array('i', unpack("<%si" % nParts, f.read(nParts * 4)))
          # Read points - produces a list of [x,y] values
          if nPoints:
              flat = unpack("<%sd" % (2 * nPoints), f.read(16*nPoints))
              record.points = list(izip(*(iter(flat),) * 2))
          # Read z extremes and values
          if shapeType in (13,15,18,31):
              (zmin, zmax) = unpack("<2d", f.read(16))
              record.z = _Array('d', unpack("<%sd" % nPoints, f.read(nPoints * 8)))
          # Read m extremes and values
          if shapeType in (13,15,18,23,25,28,31):
              if next - f.tell() >= 16:
                  (mmin, mmax) = unpack("<2d", f.read(16))
              # Measure values less than -10e38 are nodata values according to the spec
              if next - f.tell() >= nPoints * 8:
                  record.m = []
                  for m in _Array('d', unpack("<%sd" % nPoints, f.read(nPoints * 8))):
                      if m > NODATA:
                          record.m.append(m)
                      else:
                          record.m.append(None)
              else:
                  record.m = [None for _ in range(nPoints)]
          # Read a single point
          if shapeType in (1,11,21):
              record.points = [_Array('d', unpack("<2d", f.read(16)))]
          # Read a single Z value
          if shapeType == 11:
              record.z = list(unpack("<d", f.read(8)))
          # Read a single M value
          if shapeType in (21,11):
              if next - f.tell() >= 8:
                  (m,) = unpack("<d", f.read(8))
              else:
                  m = NODATA
              # Measure values less than -10e38 are nodata values according to the spec
              if m > NODATA:
                  record.m = [m]
              else:
                  record.m = [None]
          # Seek to the end of this record as defined by the record header because
          # the shapefile spec doesn't require the actual content to meet the header
          # definition.  Probably allowed for lazy feature deletion. 
          f.seek(next)
          return record
code_tokens: def __shape ( self ) : f = self . __getFileObj ( self . shp ) record = Shape ( ) nParts = nPoints = zmin = zmax = mmin = mmax = None ( recNum , recLength ) = unpack ( ">2i" , f . read ( 8 ) ) next = f . tell ( ) + ( 2 * recLength ) shapeType = unpack ( "<i" , f . read ( 4 ) ) [ 0 ] record . shapeType = shapeType if shapeType == 0 : record . points = [ ] elif shapeType in ( 3 , 5 , 8 , 13 , 15 , 18 , 23 , 25 , 28 , 31 ) : record . bbox = _Array ( 'd' , unpack ( "<4d" , f . read ( 32 ) ) ) if shapeType in ( 3 , 5 , 13 , 15 , 23 , 25 , 31 ) : nParts = unpack ( "<i" , f . read ( 4 ) ) [ 0 ] if shapeType in ( 3 , 5 , 8 , 13 , 15 , 18 , 23 , 25 , 28 , 31 ) : nPoints = unpack ( "<i" , f . read ( 4 ) ) [ 0 ] if nParts : record . parts = _Array ( 'i' , unpack ( "<%si" % nParts , f . read ( nParts * 4 ) ) ) if shapeType == 31 : record . partTypes = _Array ( 'i' , unpack ( "<%si" % nParts , f . read ( nParts * 4 ) ) ) if nPoints : flat = unpack ( "<%sd" % ( 2 * nPoints ) , f . read ( 16 * nPoints ) ) record . points = list ( izip ( * ( iter ( flat ) , ) * 2 ) ) if shapeType in ( 13 , 15 , 18 , 31 ) : ( zmin , zmax ) = unpack ( "<2d" , f . read ( 16 ) ) record . z = _Array ( 'd' , unpack ( "<%sd" % nPoints , f . read ( nPoints * 8 ) ) ) if shapeType in ( 13 , 15 , 18 , 23 , 25 , 28 , 31 ) : if next - f . tell ( ) >= 16 : ( mmin , mmax ) = unpack ( "<2d" , f . read ( 16 ) ) if next - f . tell ( ) >= nPoints * 8 : record . m = [ ] for m in _Array ( 'd' , unpack ( "<%sd" % nPoints , f . read ( nPoints * 8 ) ) ) : if m > NODATA : record . m . append ( m ) else : record . m . append ( None ) else : record . m = [ None for _ in range ( nPoints ) ] if shapeType in ( 1 , 11 , 21 ) : record . points = [ _Array ( 'd' , unpack ( "<2d" , f . read ( 16 ) ) ) ] if shapeType == 11 : record . z = list ( unpack ( "<d" , f . read ( 8 ) ) ) if shapeType in ( 21 , 11 ) : if next - f . tell ( ) >= 8 : ( m , ) = unpack ( "<d" , f . read ( 8 ) ) else : m = NODATA if m > NODATA : record . m = [ m ] else : record . m = [ None ] f . seek ( next ) return record
short_docstring: Returns the header info and geometry for a single shape.
short_docstring_tokens: Returns the header info and geometry for a single shape .
comment: """Returns the header info and geometry for a single shape."""$SEP$# Determine the start of the next record
  $SEP$# For Null shapes create an empty points list for consistency
  $SEP$# All shape types capable of having a bounding box
  $SEP$# Shape types with parts
  $SEP$# Shape types with points
  $SEP$# Read parts
  $SEP$# Read part types for Multipatch - 31
  $SEP$# Read points - produces a list of [x,y] values
  $SEP$# Read z extremes and values
  $SEP$# Read m extremes and values
  $SEP$# Measure values less than -10e38 are nodata values according to the spec
  $SEP$# Read a single point
  $SEP$# Read a single Z value
  $SEP$# Read a single M value
  $SEP$# Measure values less than -10e38 are nodata values according to the spec
  $SEP$# Seek to the end of this record as defined by the record header because
  $SEP$# the shapefile spec doesn't require the actual content to meet the header
  $SEP$# definition.  Probably allowed for lazy feature deletion. 
  