src/eric7/QScintilla/DocstringGenerator/__init__.py

Wed, 13 Jul 2022 14:55:47 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 13 Jul 2022 14:55:47 +0200
branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9482
a2bc06a54d9d
permissions
-rw-r--r--

Reformatted the source code using the 'Black' utility.

7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
8881
54e42bc2437a Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
3 # Copyright (c) 2021 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Package containing the documentation string generator tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
10 from PyQt6.QtCore import QCoreApplication
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 def getDocstringGenerator(editor):
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 """
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 Function to get a docstring generator for the given editor.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
16
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 @param editor reference to the editor to create a docstring generator for
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 @type Editor
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 @return reference to the created docstring generator
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 @rtype BaseDocstringGenerator
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
22 if editor.isPyFile() or editor.getFileType() in (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
23 "Python",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
24 "Python3",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
25 "MicroPython",
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 ):
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 from .PyDocstringGenerator import PyDocstringGenerator
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
28
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 return PyDocstringGenerator(editor)
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 else:
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 from .BaseDocstringGenerator import BaseDocstringGenerator
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
32
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 return BaseDocstringGenerator(editor)
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 def getSupportedDocstringTypes():
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 """
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 Function to get the supported docstring types/styles.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
39
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 @return list of tuples with supported docstring type/style and the
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 corresponding display string
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 @rtype tuple of (str, str)
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 """
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 return [
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
45 ("ericdoc", QCoreApplication.translate("DocstringGenerator", "Eric")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
46 ("numpydoc", QCoreApplication.translate("DocstringGenerator", "NumPy")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
47 ("googledoc", QCoreApplication.translate("DocstringGenerator", "Google")),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
48 ("sphinxdoc", QCoreApplication.translate("DocstringGenerator", "Sphinx")),
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 ]

eric ide

mercurial