Extract web pages from file system from given path
16203
public function extract()
    {
        $iterator = new \RecursiveDirectoryIterator($this->path);
        $iterator = new \RecursiveIteratorIterator($iterator);

        $pages = [];
        $files = iterator_to_array($iterator);
        $files = array_filter($files, function($file)
        {
            return $file->isFile();
        });
        
        foreach($files as $path)
        {
            $pages[$this->exclude($path)] = compact('path');
        }
        
        return $pages;
    }
1259654
def get_wf_from_path(self, path):
        
        with open(path) as fp:
            content = fp.read()
        return [(os.path.basename(os.path.splitext(path)[0]), content), ]
1275671
function extractPathParams(pattern, path) {
    const regex = new RegExp(pattern);
    const matches = regex.exec(path);
    if (!matches) {
        return [];
    }
    else {
        const groups = [...matches];
        // remove first result since its not a capture group
        groups.shift();
        return groups;
    }
}
1075074
function _getFiles (route) {
  const dir = route[0]
  const prefix = route.splice(1).join('/')

  return _browseDir(dir)
    .map(file => require(file))
    .reduce((acc, routes) => acc.concat(routes), [])
    .map(routes => _normalizeUrl(routes, prefix))
}
49884
def path_dirs(urls):
    '''
    
    '''
    path_dirs = StringCounter()
    for url in urls:
        for path_dir in filter(None, urlparse(url).path.split('/')):
            path_dirs[path_dir] += urls[url]
    return path_dirs
550559
def read(fname, URL, URLImage):
    """"""
    readme = open(path.join(path.dirname(__file__), fname)).read()
    if hasattr(readme, 'decode'):
        # In Python 3, turn bytes into str.
        readme = readme.decode('utf8')
    # turn relative links into absolute ones
    readme = re.sub(r'`<([^>]*)>`__',
                    r'`\1 <' + URL + r"/blob/master/\1>`__",
                    readme)
    readme = re.sub(r"\.\. image:: /", ".. image:: " + URLImage + "/", readme)

    return readme
630541
def download_and_unpack(self, url, *paths, **kw):
        
        with self.temp_download(url, 'ds.zip', log=kw.pop('log', None)) as zipp:
            with TemporaryDirectory() as tmpdir:
                with zipfile.ZipFile(zipp.as_posix()) as zipf:
                    for path in paths:
                        zipf.extract(as_posix(path), path=tmpdir.as_posix())
                        copy(tmpdir.joinpath(path), self)
398330
def _get_file_from_url(url):
        """"""
        path = urlparse(url).path
        if not path:
            raise ValueError("Could not extract path from URL '{0}'".format(url))
        name = os.path.basename(path)
        if not name:
            raise ValueError("Could not extract file name from path '{0}'".format(path))
        return name
1226382
def fromfile(cls, path):
        
        parser = etree.XMLParser(remove_blank_text=True)

        return cls.fromtree(etree.parse(path, parser=parser))
431206
def get_file_contents(file_path):
  """"""
  full_path = os.path.join(package_dir, file_path)
  return open(full_path, 'r').read()
1238477
def extract_alzip (archive, compression, cmd, verbosity, interactive, outdir):
    """"""
    return [cmd, '-d', outdir, archive]
467214
def relpath(path, start=posixpath.curdir):
    """"""
    if not path:
        raise ValueError("no path specified")

    start_list = posixpath.abspath(start).split(posixpath.sep)
    path_list = posixpath.abspath(path).split(posixpath.sep)

    # Work out how much of the filepath is shared by start and path.
    i = len(posixpath.commonprefix([start_list, path_list]))

    rel_list = [posixpath.pardir] * (len(start_list) - i) + path_list[i:]
    if not rel_list:
        return posixpath.curdir
    return posixpath.join(*rel_list)
136749
def read
      serialized = File.read(path)
      extract_links(JSON.parse(serialized)).flatten.each_slice(4).to_a
    end
1263617
def local_data(path):
    """"""
    dirs = [os.path.join(path, item) for item in os.listdir(path)]
    names, sizes, files = zip(*[(dir.split('/')[-1], str(get_size(dir)),
                                 '##'.join([file for file in os.listdir(dir)]))
                                for dir in dirs])
    return zip(names, dirs, sizes, files)
700347
function getRouteFiles (pathName) {
    var items = fs.readdirSync(pathName);
    var files = [];

    items.forEach(function(itemName) {
        var fullName = path.join(pathName, itemName);
        var fsStat = fs.statSync(fullName);

        // If directory, then scan for "routes.js"
        if (fsStat.isDirectory()) {
            getRouteFiles(fullName).forEach(function(a) {
                files.push(a);
            });
        } else if (fsStat.isFile() && itemName === 'routes.js') {
            // routes.js found, append to list
            files.push(fullName);
        }
    });

    return files;
}
1018718
def _extract_file(zip_fp, info, path):
    """"""
    zip_fp.extract(info.filename, path=path)
    out_path = os.path.join(path, info.filename)

    perm = info.external_attr >> 16
    perm |= stat.S_IREAD  # make sure we're not accidentally setting this to 0
    os.chmod(out_path, perm)
1181756
public static String[] extractBinaryResourceInfo(String path) {

		String[] resourceInfo = new String[2];
		String resourcePath = path;
		if (resourcePath.startsWith(JawrConstant.URL_SEPARATOR)) {
			resourcePath = resourcePath.substring(1);
		}

		Matcher matcher = CACHE_BUSTER_PATTERN.matcher(resourcePath);
		StringBuffer result = new StringBuffer();
		if (matcher.find()) {
			matcher.appendReplacement(result,
					StringUtils.isEmpty(matcher.group(GENERATED_BINARY_WEB_RESOURCE_PREFIX_INDEX))
							? CACHE_BUSTER_STANDARD_BINARY_WEB_RESOURCE_REPLACE_PATTERN
							: CACHE_BUSTER_GENERATED_BINARY_WEB_RESOURCE_REPLACE_PATTERN);
			resourceInfo[0] = result.toString();
			resourceInfo[1] = matcher.group(1);
		} else {
			resourceInfo[0] = path;
		}

		return resourceInfo;
	}