Fix src2asciidoc

This commit is contained in:
Florian Bruhin 2016-05-10 20:26:54 +02:00
parent 1d5fc4a140
commit 2fc4f408cd
2 changed files with 13 additions and 12 deletions

View File

@ -194,7 +194,7 @@ class Command:
raise TypeError("{}: functions with varkw arguments are not " raise TypeError("{}: functions with varkw arguments are not "
"supported!".format(self.name[0])) "supported!".format(self.name[0]))
def _get_arg_info(self, param): def get_arg_info(self, param):
"""Get an ArgInfo tuple for the given inspect.Parameter.""" """Get an ArgInfo tuple for the given inspect.Parameter."""
return self._qute_args.get(param.name, ArgInfo()) return self._qute_args.get(param.name, ArgInfo())
@ -223,7 +223,7 @@ class Command:
Return: Return:
True if the parameter is special, False otherwise. True if the parameter is special, False otherwise.
""" """
arg_info = self._get_arg_info(param) arg_info = self.get_arg_info(param)
if arg_info.count: if arg_info.count:
if param.default is inspect.Parameter.empty: if param.default is inspect.Parameter.empty:
raise TypeError("{}: handler has count parameter " raise TypeError("{}: handler has count parameter "
@ -318,7 +318,7 @@ class Command:
""" """
args = [] args = []
name = arg_name(param.name) name = arg_name(param.name)
arg_info = self._get_arg_info(param) arg_info = self.get_arg_info(param)
if arg_info.flag is not None: if arg_info.flag is not None:
shortname = arg_info.flag shortname = arg_info.flag
@ -467,7 +467,7 @@ class Command:
return args, kwargs return args, kwargs
for i, param in enumerate(signature.parameters.values()): for i, param in enumerate(signature.parameters.values()):
arg_info = self._get_arg_info(param) arg_info = self.get_arg_info(param)
if i == 0 and self._instance is not None: if i == 0 and self._instance is not None:
# Special case for 'self'. # Special case for 'self'.
self._get_self_arg(win_id, param, args) self._get_self_arg(win_id, param, args)

View File

@ -218,14 +218,15 @@ def _get_command_doc_count(cmd, parser):
Yield: Yield:
Strings which should be added to the docs. Strings which should be added to the docs.
""" """
if cmd.count_arg is not None: for param in inspect.signature(cmd.handler).parameters.values():
if cmd.get_arg_info(param).count:
yield "" yield ""
yield "==== count" yield "==== count"
try: try:
yield parser.arg_descs[cmd.count_arg] yield parser.arg_descs[param.name]
except KeyError as e: except KeyError as e:
raise KeyError("No description for count arg {!r} of command " raise KeyError("No description for count arg {!r} of command "
"{!r}!".format(cmd.count_arg, cmd.name)) from e "{!r}!".format(param.name, cmd.name)) from e
def _get_command_doc_notes(cmd): def _get_command_doc_notes(cmd):