This commit is contained in:
Florian Bruhin 2014-09-08 07:44:32 +02:00
parent 5e6150e665
commit 381b06e967
6 changed files with 21 additions and 10 deletions

View File

@ -53,4 +53,4 @@ defining-attr-methods=__init__,__new__,setUp
max-args=10
[TYPECHECK]
ignored-classes=WebElementWrapper
ignored-classes=WebElementWrapper,AnsiCodes

View File

@ -670,7 +670,7 @@ class CommandDispatcher:
@cmdutils.register(instance='mainwindow.tabs.cmd', name='help',
completion=[usertypes.Completion.helptopic])
def show_help(self, topic):
"""Show help about a command or setting.
r"""Show help about a command or setting.
Args:
topic: The topic to show help for.

View File

@ -54,7 +54,7 @@ class Command:
completion, modes, not_modes, needs_js, is_debug, parser,
type_conv, opt_args, pos_args):
# I really don't know how to solve this in a better way, I tried.
# pylint: disable=too-many-arguments
# pylint: disable=too-many-arguments,too-many-locals
self.name = name
self.split = split
self.hide = hide

View File

@ -167,7 +167,6 @@ class CommandCompletionModel(basecompletion.BaseCompletionModel):
self.new_item(cat, name, desc)
class HelpCompletionModel(basecompletion.BaseCompletionModel):
"""A CompletionModel filled with help topics."""
@ -180,6 +179,7 @@ class HelpCompletionModel(basecompletion.BaseCompletionModel):
self._init_settings()
def _init_commands(self):
"""Fill completion with :command entries."""
assert cmdutils.cmd_dict
cmdlist = []
for obj in set(cmdutils.cmd_dict.values()):
@ -193,6 +193,7 @@ class HelpCompletionModel(basecompletion.BaseCompletionModel):
self.new_item(cat, name, desc)
def _init_settings(self):
"""Fill completion with section->option entries."""
cat = self.new_category("Settings")
for sectname, sectdata in configdata.DATA.items():
for optname in sectdata.keys():

View File

@ -35,10 +35,9 @@ import colorama as col
sys.path.insert(0, os.getcwd())
import qutebrowser
# We import qutebrowser.app so all @cmdutils-register decorators are run.
import qutebrowser.app
from qutebrowser import qutebrowser as qutequtebrowser
from qutebrowser import qutebrowser
from qutebrowser.commands import cmdutils
from qutebrowser.config import configdata
from qutebrowser.utils import utils
@ -70,6 +69,7 @@ class UsageFormatter(argparse.HelpFormatter):
result = "'{}'".format(default_metavar)
def fmt(tuple_size):
"""Format the result according to the tuple size."""
if isinstance(result, tuple):
return result
else:
@ -99,7 +99,7 @@ def _open_file(name, mode='w'):
return open(name, mode, newline='\n', encoding='utf-8')
def _get_cmd_syntax(name, cmd):
def _get_cmd_syntax(_name, cmd):
"""Get the command syntax for a command.
We monkey-patch the parser's formatter_class here to use our UsageFormatter
@ -369,7 +369,7 @@ def regenerate_authors(filename):
def regenerate_manpage(filename):
"""Update manpage OPTIONS using an argparse parser."""
# pylint: disable=protected-access
parser = qutequtebrowser.get_argparser()
parser = qutebrowser.get_argparser()
groups = []
# positionals, optionals and user-defined groups
for group in parser._action_groups:
@ -388,6 +388,12 @@ def regenerate_manpage(filename):
def call_asciidoc(src, dst):
"""Call asciidoc for the given files.
Args:
src: The source .asciidoc file.
dst: The destination .html file, or None to auto-guess.
"""
print("{}Calling asciidoc for {}...{}".format(
col.Fore.CYAN, os.path.basename(src), col.Fore.RESET))
args = ['asciidoc']
@ -401,7 +407,8 @@ def call_asciidoc(src, dst):
sys.exit(1)
if __name__ == '__main__':
def main():
"""Regenerate all documentation."""
print("{}Generating asciidoc files...{}".format(
col.Fore.CYAN, col.Fore.RESET))
regenerate_manpage('doc/qutebrowser.1.asciidoc')
@ -416,3 +423,6 @@ if __name__ == '__main__':
('README.asciidoc', None)]
for src, dst in asciidoc_files:
call_asciidoc(src, dst)
if __name__ == '__main__':
main()

View File

@ -18,7 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
# pylint: disable=broad-except, no-member
# pylint: disable=broad-except
""" Run different codecheckers over a codebase.