Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions enum_tools/documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import sys
from enum import Enum, EnumMeta
from textwrap import dedent
from typing import Iterable, List, Optional, Sequence, Tuple
from typing import Iterable, List, Optional, Sequence, Tuple, TypeVar

# 3rd party
import pygments.token # type: ignore
Expand All @@ -49,6 +49,8 @@

INTERACTIVE = bool(getattr(sys, "ps1", sys.flags.interactive))

EnumType = TypeVar("EnumType", bound=EnumMeta)


def get_tokens(line: str) -> List[Tuple]:
"""
Expand All @@ -60,7 +62,7 @@ def get_tokens(line: str) -> List[Tuple]:
return list(_lexer.get_tokens(line))


def document_enum(an_enum: EnumMeta) -> EnumMeta:
def document_enum(an_enum: EnumType) -> EnumType:
"""
Document all members of an enum by adding a comment to the end of each line that starts with ``doc:``.

Expand Down