src/eric7/QScintilla/DocstringGenerator/BaseDocstringGenerator.py

branch
eric7
changeset 10431
64157aeb0312
parent 10078
9ebe2183cf49
child 10439
21c28b0f9e41
diff -r e440aaf179ce -r 64157aeb0312 src/eric7/QScintilla/DocstringGenerator/BaseDocstringGenerator.py
--- a/src/eric7/QScintilla/DocstringGenerator/BaseDocstringGenerator.py	Wed Dec 20 19:28:22 2023 +0100
+++ b/src/eric7/QScintilla/DocstringGenerator/BaseDocstringGenerator.py	Thu Dec 21 12:03:40 2023 +0100
@@ -7,6 +7,7 @@
 Module implementing a docstring generator base class.
 """
 
+import contextlib
 import importlib
 import re
 
@@ -139,6 +140,7 @@
         @param functionInfo reference to the function info object
         @type FunctionInfo
         @param docstringType kind of docstring to be generated
+        @type str
         @return list of docstring lines
         @rtype str
         """
@@ -148,7 +150,7 @@
             "goodledoc": ".GoogledocGenerator",
             "sphinxdoc": ".SphinxdocGenerator",
         }
-        if docstringType in generatorModuleMapping:
+        with contextlib.suppress(KeyError):
             mod = importlib.import_module(
                 generatorModuleMapping[docstringType], __package__
             )

eric ide

mercurial