Coverage for qutebrowser/browser/webkit/network/filescheme.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2015-2018 Antoni Boucher (antoyo) <bouanto@zoho.com> # # This file is part of qutebrowser. # # qutebrowser is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # qutebrowser is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. # # pylint complains when using .render() on jinja templates, so we make it shut # up for this whole module.
"""Get a list of files filtered by a filter function and sorted by name.
Args: basedir: The parent directory of all files. all_files: The list of files to filter and sort. filterfunc: The filter function.
Return: A list of dicts. Each dict contains the name and absname keys. """
"""Check if the directory is the root directory.
Args: directory: The directory to check.
Return: Whether the directory is a root directory or not. """ # If you're curious as why this works: # dirname('/') = '/' # dirname('/home') = '/' # dirname('/home/') = '/home' # dirname('/home/foo') = '/home' # basically, for files (no trailing slash) it removes the file part, and # for directories, it removes the trailing slash, so the only way for this # to be equal is if the directory is the root directory.
"""Return the parent directory for the given directory.
Args: directory: The path to the directory.
Return: The path to the parent directory. """
"""Get the directory browser web page.
Args: path: The directory path.
Return: The HTML of the web page. """
else:
title="Error while reading directory", url='file:///{}'.format(path), error=str(e))
parent=parent, files=files, directories=directories)
"""Handler for a file:// URL.
Args: request: QNetworkRequest to answer to.
Return: A QNetworkReply for directories, None for files. """ request, data, 'text/html') |