Skip to content

Commit 6323e9d

Browse files
committed
Make StrEnum ScopeType compatible with stubtest
Apparently, enums members should not include type annotations, instead type checkers are supposed to infer the type from the assigned value itself. Long-term, we might want to support Enums by default, but for no use this not so satisfying workaround.
1 parent e0c39be commit 6323e9d

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/docstub/_stubs.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,14 @@ def try_format_stub(stub: str) -> str:
109109

110110

111111
class ScopeType(enum.StrEnum):
112-
MODULE = enum.auto()
113-
CLASS = enum.auto()
114-
FUNC = enum.auto()
115-
METHOD = enum.auto()
116-
CLASSMETHOD = enum.auto()
117-
STATICMETHOD = enum.auto()
112+
# docstub: off
113+
MODULE = "module"
114+
CLASS = "class"
115+
FUNC = "func"
116+
METHOD = "method"
117+
CLASSMETHOD = "classmethod"
118+
STATICMETHOD = "staticmethod"
119+
# docstub: on
118120

119121

120122
@dataclass(slots=True, frozen=True)

0 commit comments

Comments
 (0)