Downloads all lsun files to directory unless they are there.
184302
def _get_lsun(directory, category, split_name):
  """"""
  generator_utils.maybe_download(directory,
                                 _LSUN_DATA_FILENAME % (category, split_name),
                                 _LSUN_URL % (category, split_name))
729666
def get_files (dirname):
    """"""
    for entry in os.listdir(dirname):
        fullentry = os.path.join(dirname, entry)
        if os.path.islink(fullentry):
            continue
        if os.path.isfile(fullentry):
            yield entry
        elif os.path.isdir(fullentry):
            yield entry+"/"
926474
def choice_download(self):
        
        Download(path="", url=self.dwn_srcs, repo="sbo").start()
        raise SystemExit()
505945
def ensure_dirs(filename):
    """"""
    dirname, _ = os.path.split(filename)
    if dirname and not os.path.exists(dirname):
        os.makedirs(dirname)
1258985
def download(data_dir):
  """"""
  tf.gfile.MakeDirs(data_dir)

  training_file_path = os.path.join(data_dir, TRAINING_FILE)
  if not tf.gfile.Exists(training_file_path):
    _download_and_clean_file(training_file_path, TRAINING_URL)

  eval_file_path = os.path.join(data_dir, EVAL_FILE)
  if not tf.gfile.Exists(eval_file_path):
    _download_and_clean_file(eval_file_path, EVAL_URL)
789411
def download(self, url, path):
        """"""
        # original_url = url
#        print(url)
        qurl = QUrl(url)
        url = to_text_string(qurl.toEncoded(), encoding='utf-8')

        logger.debug(str((url, path)))
        if url in self._workers:
            while not self._workers[url].finished:
                return self._workers[url]

        worker = DownloadWorker(url, path)

        # Check download folder exists
        folder = os.path.dirname(os.path.abspath(path))
        if not os.path.isdir(folder):
            os.makedirs(folder)

        request = QNetworkRequest(qurl)
        self._head_requests[url] = request
        self._paths[url] = path
        self._workers[url] = worker
        self._manager.head(request)
        self._timer.start()

        return worker
312304
public void ensureDomainsFileInstalled() throws IOException{
		// Quick check for availability
		domainsFileLock.readLock().lock();
		logger.trace("LOCK readlock");
		try {
			if( allDomains != null ) {
				return;
			}
		} finally {
			logger.trace("UNLOCK readlock");
			domainsFileLock.readLock().unlock();
		}

		// Download domains
		domainsFileLock.writeLock().lock();
		logger.trace("LOCK writelock");
		try {
			if( !domainsAvailable() ) {
				downloadDomains();
			}
			parseDomains();
		} finally {
			logger.trace("UNLOCK writelock");
			domainsFileLock.writeLock().unlock();
		}
	}
804535
def download(url, dest):
    """"""
    path = os.path.join(dest, url.split('/')[-1])
    r = requests.get(url, stream=True)
    r.raise_for_status()
    with open(path, 'wb') as f:
        for chunk in r.iter_content(chunk_size=1024):
            if chunk:
                f.write(chunk)
    return path
329168
def _fetchFilesFromFolder(self, target, recursive):
        '''
            
        '''
        directory_items = os.walk(target)

        # If recursive is false, fetch only the first tuple
        if not recursive:
            directory_items = [next(directory_items)]

        targets = []
        for dir_name, folders, files in directory_items:
            for f in files:
                targets.append(os.path.join(dir_name, f))

        return targets
575133
def download(self, force=False, silent=False):
        """"""
        def _download():
            if self.url.startswith("http"):
                self._download_http(silent=silent)
            elif self.url.startswith("ftp"):
                self._download_ftp(silent=silent)
            else:
                raise ValueError("Invalid URL %s" % self.url)
            logger.debug("Moving %s to %s" % (
                self._temp_file_name,
                self.destination))
            shutil.move(self._temp_file_name, self.destination)
            logger.debug("Successfully downloaded %s" % self.url)

        try:
            is_already_downloaded = os.path.isfile(self.destination)
            if is_already_downloaded:
                if force:
                    try:
                        os.remove(self.destination)
                    except Exception:
                        logger.error("Cannot delete %s" % self.destination)
                    logger.info(
                        "Downloading %s to %s" % (self.url, self.destination))
                    logger.debug(
                        "Downloading %s to %s" % (self.url,
                                                  self._temp_file_name))
                    _download()
                else:
                    logger.info(("File %s already exist. Use force=True if you"
                                 " would like to overwrite it.") %
                                self.destination)
            else:
                _download()
        finally:
            try:
                os.remove(self._temp_file_name)
            except OSError:
                pass
328437
def fetch(
            self,
            url,
            filename=None,
            decompress=False,
            force=False,
            timeout=None,
            use_wget_if_available=True):
        
        key = (url, decompress)
        if not force and key in self._local_paths:
            path = self._local_paths[key]
            if exists(path):
                return path
            else:
                del self._local_paths[key]
        path = download.fetch_file(
            url,
            filename=filename,
            decompress=decompress,
            subdir=self.subdir,
            force=force,
            timeout=timeout,
            use_wget_if_available=use_wget_if_available)

        self._local_paths[key] = path
        return path
22869
def download(self, paths, tool, language):
        """"""

        if tool not in self.available:
            fatal('{!r} is not installed'.format(tool))

        try:
            from . import plugins
            downloader = plugins.__getattribute__(tool)
        except AttributeError:
            fatal('{!r} is not a supported download tool'.format(tool))

        try:
            if downloader.__code__.co_argcount is 2:
                downloader(paths, language)
            elif downloader.__code__.co_argcount is 1:
                downloader(paths)
        except:  # pylint: disable=bare-except
            if not check_connectivity():
                error('Internet connectivity appears to be disabled')
            else:
                error('{!r} experienced an unknown error'.format(tool))
20391
def _receive(self, root, directory, dirs, files, include, exclude):
        """"""

        self._received += 1

        if not self.symlinks:
            where = root + os.path.sep + directory + os.path.sep
            files = [
                file_name for file_name in files
                if not os.path.islink(where + file_name)
            ]

        include = FileSetState("Include", directory, include, None
                               if include else self.include)
        exclude = FileSetState("Exclude", directory, exclude, None
                               if exclude else self.exclude)

        if exclude.matches_all_files_all_subdirs():
            # Exclude everything and do no traverse any subdirectories
            del dirs[0:]
            matched = set()
        else:
            if include.no_possible_matches_in_subdirs():
                # Do no traverse any subdirectories
                del dirs[0:]
            matched = include.match(set(files))
            matched -= exclude.match(matched)

        return matched, include, exclude
338695
def download_files(self, files):
        
        utils.pending_message(
            "Downloading {nfiles} file{plural}...".format(
                nfiles=len(files),
                plural='s' if len(files) > 1 else ''
            ))

        for file in files:
            if 'file_id' not in file:
                continue

            def build_callback(file):
                """Callback to save a download file result to a file on disk."""
                def file_callback(task):
                    device_name = self.devices[self.device_id]['device_name']
                    path_chunks = file['file_path'].split('/')

                    directory = os.path.join('files', device_name, *path_chunks[:-1])

                    filepath = utils.get_or_create_filepath(file['filename'], directory)

                    with open(filepath, 'wb') as out:
                        out.write(task.result)

                    if settings.getboolean('logging', 'time_profile'):
                        filepath = utils.append_profile_info(filepath, task.timer)

                    with indent(4):
                        utils.print_message(filepath)

                return file_callback

            self.client.download_file(
                account=self.account,
                device=self.device_id,
                file=file['file_id'],
                callback=build_callback(file)
            )
1299750
def download(self, overwrite=True):
        
        if overwrite or not os.path.exists(self.file_path):
            _, f = tempfile.mkstemp()
            try:
                urlretrieve(self.DOWNLOAD_URL, f)
                extract_csv(f, self.file_path)
            finally:
                os.remove(f)
995888
function generateDownloadsDir() {
    // Create temporary directory for file uploads
    let dloads = path.join(path.dirname(require.main.filename), 'download');

    if (!fs.existsSync(dloads)) {
        fs.mkdirSync(dloads);
    }

    let files = fs.readdirSync(dloads);

    for (let ix = 0; ix < files.length; ++ix) {
        fs.unlinkSync(path.join(dloads, files[ix]));
    }

    return dloads;
}
1356187
def check_dirs():
    
    dirs = [MAIN_DIR, TEMP_DIR, DOWNLOAD_DIR, SAVESTAT_DIR]
    for directory in dirs:
        if directory.exists() and not directory.is_dir():
            raise FileExistsError(str(directory.resolve()) + " cannot be used as a directory.")