original_docstring: Writes the specified header type to the specified file-like object.
          Several of the shapefile formats are so similar that a single generic
          method to read or write them is warranted.
docstring: Writes the specified header type to the specified file-like object.
  Several of the shapefile formats are so similar that a single generic
  method to read or write them is warranted.
docstring_tokens: Writes the specified header type to the specified file - like object . Several of the shapefile formats are so similar that a single generic method to read or write them is warranted .
code: def __shapefileHeader(self, fileObj, headerType='shp'):
          """Writes the specified header type to the specified file-like object.
          Several of the shapefile formats are so similar that a single generic
          method to read or write them is warranted."""
          f = self.__getFileObj(fileObj)
          f.seek(0)
          # File code, Unused bytes
          f.write(pack(">6i", 9994,0,0,0,0,0))
          # File length (Bytes / 2 = 16-bit words)
          if headerType == 'shp':
              f.write(pack(">i", self.__shpFileLength()))
          elif headerType == 'shx':
              f.write(pack('>i', ((100 + (self.shpNum * 8)) // 2)))
          # Version, Shape type
          if self.shapeType is None:
              self.shapeType = NULL
          f.write(pack("<2i", 1000, self.shapeType))
          # The shapefile's bounding box (lower left, upper right)
          if self.shapeType != 0:
              try:
                  bbox = self.bbox()
                  if bbox is None:
                      # The bbox is initialized with None, so this would mean the shapefile contains no valid geometries.
                      # In such cases of empty shapefiles, ESRI spec says the bbox values are 'unspecified'.
                      # Not sure what that means, so for now just setting to 0s, which is the same behavior as in previous versions.
                      # This would also make sense since the Z and M bounds are similarly set to 0 for non-Z/M type shapefiles.
                      bbox = [0,0,0,0] 
                  f.write(pack("<4d", *bbox))
              except error:
                  raise ShapefileException("Failed to write shapefile bounding box. Floats required.")
          else:
              f.write(pack("<4d", 0,0,0,0))
          # Elevation
          if self.shapeType in (11,13,15,18):
              # Z values are present in Z type
              zbox = self.zbox()
              if zbox is None:
                  # means we have empty shapefile/only null geoms (see commentary on bbox above)
                  zbox = [0,0]
          else:
              # As per the ESRI shapefile spec, the zbox for non-Z type shapefiles are set to 0s
              zbox = [0,0]
          # Measure
          if self.shapeType in (11,13,15,18,21,23,25,28,31):
              # M values are present in M or Z type
              mbox = self.mbox()
              if mbox is None:
                  # means we have empty shapefile/only null geoms (see commentary on bbox above)
                  mbox = [0,0]
          else:
              # As per the ESRI shapefile spec, the mbox for non-M type shapefiles are set to 0s
              mbox = [0,0]
          # Try writing
          try:
              f.write(pack("<4d", zbox[0], zbox[1], mbox[0], mbox[1]))
          except error:
              raise ShapefileException("Failed to write shapefile elevation and measure values. Floats required.")
code_tokens: def __shapefileHeader ( self , fileObj , headerType = 'shp' ) : f = self . __getFileObj ( fileObj ) f . seek ( 0 ) f . write ( pack ( ">6i" , 9994 , 0 , 0 , 0 , 0 , 0 ) ) if headerType == 'shp' : f . write ( pack ( ">i" , self . __shpFileLength ( ) ) ) elif headerType == 'shx' : f . write ( pack ( '>i' , ( ( 100 + ( self . shpNum * 8 ) ) // 2 ) ) ) if self . shapeType is None : self . shapeType = NULL f . write ( pack ( "<2i" , 1000 , self . shapeType ) ) if self . shapeType != 0 : try : bbox = self . bbox ( ) if bbox is None : bbox = [ 0 , 0 , 0 , 0 ] f . write ( pack ( "<4d" , * bbox ) ) except error : raise ShapefileException ( "Failed to write shapefile bounding box. Floats required." ) else : f . write ( pack ( "<4d" , 0 , 0 , 0 , 0 ) ) if self . shapeType in ( 11 , 13 , 15 , 18 ) : zbox = self . zbox ( ) if zbox is None : zbox = [ 0 , 0 ] else : zbox = [ 0 , 0 ] if self . shapeType in ( 11 , 13 , 15 , 18 , 21 , 23 , 25 , 28 , 31 ) : mbox = self . mbox ( ) if mbox is None : mbox = [ 0 , 0 ] else : mbox = [ 0 , 0 ] try : f . write ( pack ( "<4d" , zbox [ 0 ] , zbox [ 1 ] , mbox [ 0 ] , mbox [ 1 ] ) ) except error : raise ShapefileException ( "Failed to write shapefile elevation and measure values. Floats required." )
short_docstring: Writes the specified header type to the specified file-like object.
short_docstring_tokens: Writes the specified header type to the specified file - like object .
comment: """Writes the specified header type to the specified file-like object.
          Several of the shapefile formats are so similar that a single generic
          method to read or write them is warranted."""$SEP$# File code, Unused bytes
  $SEP$# File length (Bytes / 2 = 16-bit words)
  $SEP$# Version, Shape type
  $SEP$# The shapefile's bounding box (lower left, upper right)
  $SEP$# The bbox is initialized with None, so this would mean the shapefile contains no valid geometries.
  $SEP$# In such cases of empty shapefiles, ESRI spec says the bbox values are 'unspecified'.
  $SEP$# Not sure what that means, so for now just setting to 0s, which is the same behavior as in previous versions.
  $SEP$# This would also make sense since the Z and M bounds are similarly set to 0 for non-Z/M type shapefiles.
  $SEP$# Elevation
  $SEP$# Z values are present in Z type
  $SEP$# means we have empty shapefile/only null geoms (see commentary on bbox above)
  $SEP$# As per the ESRI shapefile spec, the zbox for non-Z type shapefiles are set to 0s
  $SEP$# Measure
  $SEP$# M values are present in M or Z type
  $SEP$# means we have empty shapefile/only null geoms (see commentary on bbox above)
  $SEP$# As per the ESRI shapefile spec, the mbox for non-M type shapefiles are set to 0s
  $SEP$# Try writing
  