67
67
('doc_dir' , str ),
68
68
('search_path' , List [str ]),
69
69
('interpreter' , str ),
70
- ('modules' , List [str ])])
70
+ ('modules' , List [str ]),
71
+ ('ignore_errors' , bool ),
72
+ ('recursive' , bool )])
71
73
72
74
73
75
def generate_stub_for_module (module : str , output_dir : str , quiet : bool = False ,
@@ -589,6 +591,8 @@ def main() -> None:
589
591
options = parse_options ()
590
592
if not os .path .isdir ('out' ):
591
593
raise SystemExit ('Directory "out" does not exist' )
594
+ if options .recursive and options .no_import :
595
+ raise SystemExit ('recursive stub generation without importing is not currently supported' )
592
596
sigs = {} # type: Any
593
597
class_sigs = {} # type: Any
594
598
if options .doc_dir :
@@ -622,7 +626,7 @@ def parse_options() -> Options:
622
626
pyversion = defaults .PYTHON3_VERSION
623
627
no_import = False
624
628
recursive = False
625
- lenient = False
629
+ ignore_errors = False
626
630
doc_dir = ''
627
631
search_path = [] # type: List[str]
628
632
interpreter = ''
@@ -640,8 +644,8 @@ def parse_options() -> Options:
640
644
args = args [1 :]
641
645
elif args [0 ] == '--recursive' :
642
646
recursive = True
643
- elif args [0 ] == '--lenient ' :
644
- lenient = True
647
+ elif args [0 ] == '--ignore-errors ' :
648
+ ignore_errors = True
645
649
elif args [0 ] == '--py2' :
646
650
pyversion = defaults .PYTHON2_VERSION
647
651
elif args [0 ] == '--no-import' :
@@ -660,7 +664,9 @@ def parse_options() -> Options:
660
664
doc_dir = doc_dir ,
661
665
search_path = search_path ,
662
666
interpreter = interpreter ,
663
- modules = args )
667
+ modules = args ,
668
+ ignore_errors = ignore_errors ,
669
+ recursive = recursive )
664
670
665
671
666
672
def default_python2_interpreter () -> str :
@@ -688,7 +694,7 @@ def usage() -> None:
688
694
Options:
689
695
--py2 run in Python 2 mode (default: Python 3 mode)
690
696
--recursive traverse listed modules to generate inner package modules as well
691
- --lenient ignore exceptions when trying to generate stubs for modules
697
+ --ignore-errors ignore errors when trying to generate stubs for modules
692
698
--no-import don't import the modules, just parse and analyze them
693
699
(doesn't work with C extension modules and doesn't
694
700
respect __all__)
0 commit comments