src/eric7/QScintilla/DocstringGenerator/__init__.py

Wed, 09 Nov 2022 15:05:06 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 09 Nov 2022 15:05:06 +0100
branch
eric7
changeset 9500
5771348ded12
parent 9482
a2bc06a54d9d
child 9653
e67609152c5e
permissions
-rw-r--r--

Corrected some code style issues and changed some suppressed code style issues.

# -*- coding: utf-8 -*-

# Copyright (c) 2021 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Package containing the documentation string generator tool.
"""

from PyQt6.QtCore import QCoreApplication


def getDocstringGenerator(editor):
    """
    Function to get a docstring generator for the given editor.

    @param editor reference to the editor to create a docstring generator for
    @type Editor
    @return reference to the created docstring generator
    @rtype BaseDocstringGenerator
    """
    if editor.isPyFile() or editor.getFileType() in (
        "Python",
        "Python3",
        "MicroPython",
    ):
        from .PyDocstringGenerator import (  # __IGNORE_WARNING_I101__
            PyDocstringGenerator,
        )

        return PyDocstringGenerator(editor)
    else:
        from .BaseDocstringGenerator import (  # __IGNORE_WARNING_I101__
            BaseDocstringGenerator,
        )

        return BaseDocstringGenerator(editor)


def getSupportedDocstringTypes():
    """
    Function to get the supported docstring types/styles.

    @return list of tuples with supported docstring type/style and the
        corresponding display string
    @rtype tuple of (str, str)
    """
    return [
        ("ericdoc", QCoreApplication.translate("DocstringGenerator", "Eric")),
        ("numpydoc", QCoreApplication.translate("DocstringGenerator", "NumPy")),
        ("googledoc", QCoreApplication.translate("DocstringGenerator", "Google")),
        ("sphinxdoc", QCoreApplication.translate("DocstringGenerator", "Sphinx")),
    ]

eric ide

mercurial