parameters: (directory, filename, url)
return_statement: return filepath
docstring: Download filename from url unless it's already in directory.
docstring_summary: Download filename from url unless it's already in directory.
docstring_tokens: Download filename from url unless it s already in directory .
function: def maybe_download(directory, filename, url):
    """Download filename from url unless it's already in directory."""
    if not os.path.exists(directory):
      print("Creating directory %s" % directory)
      os.mkdir(directory)
    filepath = os.path.join(directory, filename)
    if not os.path.exists(filepath):
      print("Downloading %s to %s" % (url, filepath))
      filepath, _ = urllib.request.urlretrieve(url, filepath)
      statinfo = os.stat(filepath)
      print("Succesfully downloaded", filename, statinfo.st_size, "bytes")
    return filepath
function_tokens: def maybe_download ( directory , filename , url ) : if not os . path . exists ( directory ) : print ( "Creating directory %s" % directory ) os . mkdir ( directory ) filepath = os . path . join ( directory , filename ) if not os . path . exists ( filepath ) : print ( "Downloading %s to %s" % ( url , filepath ) ) filepath , _ = urllib . request . urlretrieve ( url , filepath ) statinfo = os . stat ( filepath ) print ( "Succesfully downloaded" , filename , statinfo . st_size , "bytes" ) return filepath