parameters: (self, url, to_dir="", md5_checksum="")
return_statement: return to_path
docstring: print("starting download")
          try:
              file = open(to_path, "wb")
              req = urllib2.urlopen(url)
              try:
                  while True:
                      buffer = req.read(1024*100)
                      print("read: ", len(buffer))
                      if not buffer:
                          break
                      file.write( buffer )
              finally:
                  print("closing ....")
                  req.close()
                  file.close()
          except urllib2.URLError as e:
              raise Exception('%s - %s' % (e,url))
  
          print("... done download")
docstring_summary: print("starting download")
          try:
              file = open(to_path, "wb")
              req = urllib2.urlopen(url)
              try:
                  while True:
                      buffer = req.read(1024*100)
                      print("read: ", len(buffer))
                      if not buffer:
                          break
                      file.write( buffer )
              finally:
                  print("closing ....")
                  req.close()
                  file.close()
          except urllib2.URLError as e:
              raise Exception('%s - %s' % (e,url))
docstring_tokens: print ( starting download ) try : file = open ( to_path wb ) req = urllib2 . urlopen ( url ) try : while True : buffer = req . read ( 1024 * 100 ) print ( read : len ( buffer )) if not buffer : break file . write ( buffer ) finally : print ( closing .... ) req . close () file . close () except urllib2 . URLError as e : raise Exception ( %s - %s % ( e url ))
function: def download(self, url, to_dir="", md5_checksum=""):
  
          print("DEPRECATED")
  
          filename = os.path.basename(url)
  
          # download to the current project
          if not to_dir:
              to_dir = self.get_tmpdir()
  
          # make sure the directory exists
          if not os.path.exists(to_dir):
              os.makedirs(to_dir)
  
          to_path = "%s/%s" % (to_dir, filename)
  
  
          # check if this file is already downloaded.  if so, skip
          if os.path.exists(to_path):
              # if it exists, check the MD5 checksum
              if md5_checksum:
                  f = open(to_path, 'rb')
                  CHUNK = 1024*1024
                  m = get_md5()
                  while 1:
                      chunk = f.read(CHUNK)
                      if not chunk:
                          break
                      m.update(chunk)
                  f.close()
                  md5_local = m.hexdigest()
  
                  # only return if the md5 checksums are the same
                  if md5_checksum == md5_local:
                      print("skipping '%s', already exists" % to_path)
                      return to_path
  
          f = urllib.urlopen(url)
          file = open(to_path, "wb")
          file.write( f.read() )
          file.close()
          f.close()
  
          """
          print("starting download")
          try:
              file = open(to_path, "wb")
              req = urllib2.urlopen(url)
              try:
                  while True:
                      buffer = req.read(1024*100)
                      print("read: ", len(buffer))
                      if not buffer:
                          break
                      file.write( buffer )
              finally:
                  print("closing ....")
                  req.close()
                  file.close()
          except urllib2.URLError as e:
              raise Exception('%s - %s' % (e,url))
  
          print("... done download")
          """
  
  
          return to_path
function_tokens: def download ( self , url , to_dir = "" , md5_checksum = "" ) : print ( "DEPRECATED" ) filename = os . path . basename ( url ) # download to the current project if not to_dir : to_dir = self . get_tmpdir ( ) # make sure the directory exists if not os . path . exists ( to_dir ) : os . makedirs ( to_dir ) to_path = "%s/%s" % ( to_dir , filename ) # check if this file is already downloaded.  if so, skip if os . path . exists ( to_path ) : # if it exists, check the MD5 checksum if md5_checksum : f = open ( to_path , 'rb' ) CHUNK = 1024 * 1024 m = get_md5 ( ) while 1 : chunk = f . read ( CHUNK ) if not chunk : break m . update ( chunk ) f . close ( ) md5_local = m . hexdigest ( ) # only return if the md5 checksums are the same if md5_checksum == md5_local : print ( "skipping '%s', already exists" % to_path ) return to_path f = urllib . urlopen ( url ) file = open ( to_path , "wb" ) file . write ( f . read ( ) ) file . close ( ) f . close ( ) return to_path