more typing work

This commit is contained in:
Kovid Goyal
2020-03-12 08:10:51 +05:30
parent 21707171bb
commit 149ae2866a
22 changed files with 395 additions and 291 deletions

View File

@@ -402,6 +402,8 @@ def as_type_stub(seq: OptionSpecSeq, disabled: OptionSpecSeq, class_name: str, e
otype = opt['type'] or 'str'
if otype in ('str', 'int', 'float'):
t = otype
if t == 'str' and defval_for_opt(opt) is None:
t = 'typing.Optional[str]'
elif otype == 'list':
t = 'typing.Sequence[str]'
elif otype in ('choice', 'choices'):