Skip to content

DocstringStyle

Bases: Enum

Source code in src/library_analyzer/processing/api/docstring_parsing/_docstring_style.py
class DocstringStyle(Enum):
    # AUTO = "auto",
    PLAINTEXT = "plaintext"
    EPYDOC = "epydoc"
    GOOGLE = "google"
    NUMPY = "numpy"
    REST = "rest"

    def __str__(self) -> str:
        return self.name

    @staticmethod
    def from_string(key: str) -> DocstringStyle:
        try:
            return DocstringStyle[key.upper()]
        except KeyError as err:
            raise ValueError(f"Unknown docstring style: {key}") from err

EPYDOC = 'epydoc' class-attribute instance-attribute

GOOGLE = 'google' class-attribute instance-attribute

NUMPY = 'numpy' class-attribute instance-attribute

PLAINTEXT = 'plaintext' class-attribute instance-attribute

REST = 'rest' class-attribute instance-attribute

__str__()

Source code in src/library_analyzer/processing/api/docstring_parsing/_docstring_style.py
def __str__(self) -> str:
    return self.name

from_string(key) staticmethod

Source code in src/library_analyzer/processing/api/docstring_parsing/_docstring_style.py
@staticmethod
def from_string(key: str) -> DocstringStyle:
    try:
        return DocstringStyle[key.upper()]
    except KeyError as err:
        raise ValueError(f"Unknown docstring style: {key}") from err