|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2021 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Package containing the documentation string generator tool. |
|
8 """ |
|
9 |
|
10 from PyQt6.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 ] |