original_docstring: Download a list of URLs, using a cookie file.
docstring: Download a list of URLs, using a cookie file.
docstring_tokens: Download a list of URLs using a cookie file .
code: def download_files(url_list, cookie):
      """Download a list of URLs, using a cookie file."""
      #   The download base URL
      dl_base = 'http://genome.jgi.doe.gov'
      #   For each URL...
      for u, m in url_list:
          #   A flag for if we have successfully gotten the file. If the file
          #   passes the MD5 check, we'll flip this to true.
          pass_check = False
          while not pass_check:
              #   The local name to save it as
              local_name = u.split('/')[-1]
              #   And build the command to download it
              cmd = [
                  'curl',
                  dl_base + u,
                  '-b',
                  cookie.name,
                  '-o',
                  local_name
                  ]
              #   Then download it
              sys.stderr.write('Downloading ' + u + ' ...')
              p = subprocess.Popen(
                  cmd,
                  shell=False,
                  stdout=subprocess.PIPE,
                  stderr=subprocess.PIPE
                  )
              out, err = p.communicate()
              sys.stderr.write(' Done!\n')
              #   Check the MD5
              sys.stderr.write('Checking MD5 of ' + local_name + ' ...')
              calc_md5 = calculate_md5(local_name)
              if m == calc_md5:
                  sys.stderr.write(' Pass!\n')
                  pass_check = True
              else:
                  sys.stderr.write(' Failed integrity check, re-downloading.\n')
                  os.remove(local_name)
      return
code_tokens: def download_files ( url_list , cookie ) : dl_base = 'http://genome.jgi.doe.gov' for u , m in url_list : pass_check = False while not pass_check : local_name = u . split ( '/' ) [ - 1 ] cmd = [ 'curl' , dl_base + u , '-b' , cookie . name , '-o' , local_name ] sys . stderr . write ( 'Downloading ' + u + ' ...' ) p = subprocess . Popen ( cmd , shell = False , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) out , err = p . communicate ( ) sys . stderr . write ( ' Done!\n' ) sys . stderr . write ( 'Checking MD5 of ' + local_name + ' ...' ) calc_md5 = calculate_md5 ( local_name ) if m == calc_md5 : sys . stderr . write ( ' Pass!\n' ) pass_check = True else : sys . stderr . write ( ' Failed integrity check, re-downloading.\n' ) os . remove ( local_name ) return
short_docstring: Download a list of URLs, using a cookie file.
short_docstring_tokens: Download a list of URLs using a cookie file .
comment: """Download a list of URLs, using a cookie file."""$SEP$#   The download base URL$SEP$#   For each URL...$SEP$#   A flag for if we have successfully gotten the file. If the file$SEP$#   passes the MD5 check, we'll flip this to true.$SEP$#   The local name to save it as$SEP$#   And build the command to download it$SEP$#   Then download it$SEP$#   Check the MD5