Python does not support add program-readable document string to a Enum class value currently, see:
There is a approach is to parse AST of the wanted Enum class, and manually add them to document string.
@enum_auto_doc
class SearchType(IntEnum):
"""搜索内容类型"""
SONG = 1
"""单曲"""
ALBUM = 10
"""专辑"""
ARTIST = 100
"""歌手"""
PLAYLIST = 1000
"""歌单"""
USER = 1002
"""用户"""
MV = 1004
"""MV"""
LYRICS = 1006
"""歌词"""
DJ = 1009
"""主播电台"""
VIDEO = 1014
"""视频"""
搜索内容类型
- `SONG` = *`1`* : 单曲
- `ALBUM` = *`10`* : 专辑
- `ARTIST` = *`100`* : 歌手
- `PLAYLIST` = *`1000`* : 歌单
- `USER` = *`1002`* : 用户
- `MV` = *`1004`* : MV
- `LYRICS` = *`1006`* : 歌词
- `DJ` = *`1009`* : 主播电台
- `VIDEO` = *`1014`* : 视频
- Add support for Python version 3.6+ (3.8+ currently)
- Enum class with indentaion support
- Add a
AutoEnum
metaclass to support auto Enum document by inherit