File tree Expand file tree Collapse file tree 3 files changed +14
-17
lines changed
test-data/pybind11_fixtures
expected_stubs_no_docs/pybind11_fixtures
expected_stubs_with_docs/pybind11_fixtures Expand file tree Collapse file tree 3 files changed +14
-17
lines changed Original file line number Diff line number Diff line change 1414import os .path
1515from collections .abc import Mapping
1616from types import FunctionType , ModuleType
17- from typing import Any , Callable
17+ from typing import Any , Callable , Final
1818
1919from mypy .fastparse import parse_type_comment
2020from mypy .moduleinspect import is_c_module
4040)
4141from mypy .util import quote_docstring
4242
43+ SPECIAL_ENUM_ATTRS : Final = {
44+ "_generate_next_value_" ,
45+ "_member_map_" ,
46+ "_member_names_" ,
47+ "_member_type_" ,
48+ "_unhashable_values_" ,
49+ "_use_args_" ,
50+ "_value2member_map_" ,
51+ "_value_repr_"
52+ }
53+
4354
4455class ExternalSignatureGenerator (SignatureGenerator ):
4556 def __init__ (
@@ -862,6 +873,8 @@ def generate_class_stub(
862873 )
863874 elif inspect .isclass (value ) and self .is_defined_in_module (value ):
864875 self .generate_class_stub (attr , value , types , parent_class = class_info )
876+ elif attr in SPECIAL_ENUM_ATTRS :
877+ pass
865878 else :
866879 attrs .append ((attr , value ))
867880
Original file line number Diff line number Diff line change @@ -9,14 +9,6 @@ class Color(enum.Enum):
99 __new__ : ClassVar [Callable ] = ...
1010 GREEN = 1
1111 RED = 0
12- _generate_next_value_ : ClassVar [Callable ] = ...
13- _member_map_ : ClassVar [dict ] = ...
14- _member_names_ : ClassVar [list ] = ...
15- _member_type_ : ClassVar [type [object ]] = ...
16- _unhashable_values_ : ClassVar [list ] = ...
17- _use_args_ : ClassVar [bool ] = ...
18- _value2member_map_ : ClassVar [dict ] = ...
19- _value_repr_ : ClassVar [None ] = ...
2012
2113class Point :
2214 class AngleUnit :
Original file line number Diff line number Diff line change @@ -9,14 +9,6 @@ class Color(enum.Enum):
99 __new__ : ClassVar [Callable ] = ...
1010 GREEN = 1
1111 RED = 0
12- _generate_next_value_ : ClassVar [Callable ] = ...
13- _member_map_ : ClassVar [dict ] = ...
14- _member_names_ : ClassVar [list ] = ...
15- _member_type_ : ClassVar [type [object ]] = ...
16- _unhashable_values_ : ClassVar [list ] = ...
17- _use_args_ : ClassVar [bool ] = ...
18- _value2member_map_ : ClassVar [dict ] = ...
19- _value_repr_ : ClassVar [None ] = ...
2012
2113class Point :
2214 class AngleUnit :
You can’t perform that action at this time.
0 commit comments