@@ -52,14 +52,15 @@ def collect(self, identifier: str, config: dict) -> CollectorItem: # noqa: WPS2
5252 final_config = ChainMap (config , self .default_config )
5353 parser_name = final_config ["docstring_style" ]
5454 parser_options = final_config ["docstring_options" ]
55+ parser = parser_name and Parser (parser_name )
5556
5657 just_loaded = False
5758 module_name = identifier .split ("." , 1 )[0 ]
5859 if module_name not in self ._modules_collection :
5960 just_loaded = True
6061 loader = GriffeLoader (
6162 extensions = load_extensions (final_config .get ("extensions" , [])),
62- docstring_parser = Parser ( parser_name ) ,
63+ docstring_parser = parser ,
6364 docstring_options = parser_options ,
6465 modules_collection = self ._modules_collection ,
6566 lines_collection = self ._lines_collection ,
@@ -79,7 +80,7 @@ def collect(self, identifier: str, config: dict) -> CollectorItem: # noqa: WPS2
7980 raise CollectionError (f"{ identifier } could not be found" ) from error
8081
8182 if not just_loaded and doc_object .docstring is not None :
82- doc_object .docstring .parser = parser_name and Parser ( parser_name )
83+ doc_object .docstring .parser = parser
8384 doc_object .docstring .parser_options = parser_options
8485
8586 return doc_object
0 commit comments