Skip to content

Commit ee0ebb8

Browse files
committed
Add literal
1 parent 50e48d1 commit ee0ebb8

File tree

3 files changed

+5
-5
lines changed
  • mypy
  • test-data/pybind11_fixtures
    • expected_stubs_no_docs/pybind11_fixtures
    • expected_stubs_with_docs/pybind11_fixtures

3 files changed

+5
-5
lines changed

mypy/stubgenc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ def generate_class_stub(
872872
prop_type_name = self.strip_or_import(self.get_type_annotation(value))
873873
# Pybind supports native enums now
874874
if issubclass(cls, enum.Enum) and attr in cls._member_names_:
875-
static_properties.append(f"{self._indent}{attr} = ...")
875+
static_properties.append(f"{self._indent}{attr} = {cls._member_map_[attr].value}")
876876
else:
877877
classvar = self.add_name("typing.ClassVar")
878878
static_properties.append(f"{self._indent}{attr}: {classvar}[{prop_type_name}] = ...")

test-data/pybind11_fixtures/expected_stubs_no_docs/pybind11_fixtures/demo.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ __version__: str
77

88
class Color(enum.Enum):
99
__new__: ClassVar[Callable] = ...
10-
GREEN = ...
11-
RED = ...
10+
GREEN = 1
11+
RED = 0
1212
_generate_next_value_: ClassVar[Callable] = ...
1313
_member_map_: ClassVar[dict] = ...
1414
_member_names_: ClassVar[list] = ...

test-data/pybind11_fixtures/expected_stubs_with_docs/pybind11_fixtures/demo.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ __version__: str
77

88
class Color(enum.Enum):
99
__new__: ClassVar[Callable] = ...
10-
GREEN = ...
11-
RED = ...
10+
GREEN = 1
11+
RED = 0
1212
_generate_next_value_: ClassVar[Callable] = ...
1313
_member_map_: ClassVar[dict] = ...
1414
_member_names_: ClassVar[list] = ...

0 commit comments

Comments
 (0)