DocstringParser - support python with optimizations on
This commit is contained in:
parent
743d2dc327
commit
c04adb94b2
@ -300,6 +300,11 @@ def init_log(args):
|
||||
log.init_log(args)
|
||||
log.init.debug("Log initialized.")
|
||||
|
||||
def check_optimize_flag():
|
||||
from qutebrowser.utils import log
|
||||
if sys.flags.optimize >= 2:
|
||||
log.init.warning("Running on optimize level higher than 1, "
|
||||
"unexpected behaviors may occur.")
|
||||
|
||||
def earlyinit(args):
|
||||
"""Do all needed early initialization.
|
||||
@ -327,3 +332,4 @@ def earlyinit(args):
|
||||
remove_inputhook()
|
||||
check_libraries(args)
|
||||
check_ssl_support()
|
||||
check_optimize_flag()
|
||||
|
@ -26,7 +26,7 @@ import os.path
|
||||
import collections
|
||||
|
||||
import qutebrowser
|
||||
from qutebrowser.utils import usertypes
|
||||
from qutebrowser.utils import usertypes, log, utils
|
||||
|
||||
|
||||
def is_git_repo():
|
||||
@ -98,6 +98,15 @@ class DocstringParser:
|
||||
self.State.arg_inside: self._parse_arg_inside,
|
||||
self.State.misc: self._skip,
|
||||
}
|
||||
if doc is None:
|
||||
if sys.flags.optimize < 2:
|
||||
log.commands.warning(
|
||||
"Function {}() from {} has no docstring".format(
|
||||
utils.qualname(func),
|
||||
inspect.getsourcefile(func)))
|
||||
self.long_desc = ""
|
||||
self.short_desc = ""
|
||||
return
|
||||
for line in doc.splitlines():
|
||||
handler = handlers[self._state]
|
||||
stop = handler(line)
|
||||
|
Loading…
Reference in New Issue
Block a user