eric6/QScintilla/DocstringGenerator/__init__.py

changeset 7998
cd41c844862f
equal deleted inserted replaced
7997:2ca23396c25c 7998:cd41c844862f
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Package containing the documentation string generator tool.
8 """
9
10 from PyQt5.QtCore import QCoreApplication
11
12
13 def getDocstringGenerator(editor):
14 """
15 Function to get a docstring generator for the given editor.
16
17 @param editor reference to the editor to create a docstring generator for
18 @type Editor
19 @return reference to the created docstring generator
20 @rtype BaseDocstringGenerator
21 """
22 if (
23 editor.isPyFile() or
24 editor.getFileType() in ("Python", "Python3", "MicroPython")
25 ):
26 from .PyDocstringGenerator import PyDocstringGenerator
27 return PyDocstringGenerator(editor)
28 else:
29 from .BaseDocstringGenerator import BaseDocstringGenerator
30 return BaseDocstringGenerator(editor)
31
32
33 def getSupportedDocstringTypes():
34 """
35 Function to get the supported docstring types/styles.
36
37 @return list of tuples with supported docstring type/style and the
38 corresponding display string
39 @rtype tuple of (str, str)
40 """
41 return [
42 ("ericdoc",
43 QCoreApplication.translate("DocstringGenerator", "Eric")),
44 ("numpydoc",
45 QCoreApplication.translate("DocstringGenerator", "NumPy")),
46 ("googledoc",
47 QCoreApplication.translate("DocstringGenerator", "Google")),
48 ("sphinxdoc",
49 QCoreApplication.translate("DocstringGenerator", "Sphinx")),
50 ]

eric ide

mercurial