File: enums.py

package info (click to toggle)
python-pdoc 16.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,080 kB
  • sloc: python: 5,260; javascript: 1,156; makefile: 18; sh: 3
file content (34 lines) | stat: -rw-r--r-- 683 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import enum


class EnumDemo(enum.Enum):
    """
    This is an example of an Enum.

    As usual, you can link to individual properties: `GREEN`.
    """

    RED = 1
    """I am the red."""
    GREEN = 2
    """I am green."""
    BLUE = enum.auto()


class EnumWithoutDocstrings(enum.Enum):
    FOO = enum.auto()
    BAR = enum.auto()


class IntEnum(enum.IntEnum):
    FOO = enum.auto()
    BAR = enum.auto()


class StrEnum(enum.StrEnum):
    FOO = enum.auto()
    BAR = enum.auto()

    def isprintable(self) -> bool:
        """This method has different docstrings depending on the Python version, so we override here for testing purposes."""
        raise NotImplementedError