parameters: (upload_file, extension='.shp', tempdir=None)
return_statement: return absolute_base_file
docstring: Unzips a zipfile into a temporary directory and returns the full path of the .shp file inside (if any)
docstring_summary: Unzips a zipfile into a temporary directory and returns the full path of the .shp file inside (if any)
docstring_tokens: Unzips a zipfile into a temporary directory and returns the full path of the . shp file inside ( if any )
function: def unzip_file(upload_file, extension='.shp', tempdir=None):
      """
      Unzips a zipfile into a temporary directory and returns the full path of the .shp file inside (if any)
      """
      absolute_base_file = None
      if tempdir is None:
          tempdir = tempfile.mkdtemp(dir=settings.STATIC_ROOT)
      if not os.path.isdir(tempdir):
          os.makedirs(tempdir)
  
      the_zip = ZipFile(upload_file, allowZip64=True)
      the_zip.extractall(tempdir)
      for item in the_zip.namelist():
          if item.endswith(extension):
              absolute_base_file = os.path.join(tempdir, item)
  
      return absolute_base_file
function_tokens: def unzip_file ( upload_file , extension = '.shp' , tempdir = None ) : absolute_base_file = None if tempdir is None : tempdir = tempfile . mkdtemp ( dir = settings . STATIC_ROOT ) if not os . path . isdir ( tempdir ) : os . makedirs ( tempdir ) the_zip = ZipFile ( upload_file , allowZip64 = True ) the_zip . extractall ( tempdir ) for item in the_zip . namelist ( ) : if item . endswith ( extension ) : absolute_base_file = os . path . join ( tempdir , item ) return absolute_base_file