File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 2222from mypy .subtypes import is_equivalent
2323from mypy .typeops import fixup_partial_type , make_simplified_union
2424from mypy .types import (
25+ ELLIPSIS_TYPE_NAMES ,
2526 CallableType ,
2627 Instance ,
2728 LiteralType ,
@@ -90,10 +91,7 @@ def _infer_value_type_with_auto_fallback(
9091 # Enums in stubs may have ... instead of actual values. If `_value_` is annotated
9192 # (manually or inherited from IntEnum, for example), it is a more reasonable guess
9293 # than literal ellipsis type.
93- if isinstance (proper_type , Instance ) and proper_type .type .fullname in {
94- "types.EllipsisType" ,
95- "builtins.ellipsis" ,
96- }:
94+ if isinstance (proper_type , Instance ) and proper_type .type .fullname in ELLIPSIS_TYPE_NAMES :
9795 if (
9896 isinstance (ctx .type , Instance )
9997 and (value_type := ctx .type .type .get ("_value_" ))
Original file line number Diff line number Diff line change @@ -1149,7 +1149,7 @@ def verify_var(
11491149 proper_type = mypy .types .get_proper_type (stub .type )
11501150 if (
11511151 isinstance (proper_type , mypy .types .Instance )
1152- and proper_type .type .fullname == "builtins.ellipsis"
1152+ and proper_type .type .fullname in mypy . types . ELLIPSIS_TYPE_NAMES
11531153 ):
11541154 should_error = False
11551155
Original file line number Diff line number Diff line change 181181# Supported @override decorator names.
182182OVERRIDE_DECORATOR_NAMES : Final = ("typing.override" , "typing_extensions.override" )
183183
184+ ELLIPSIS_TYPE_NAMES : Final = ("builtins.ellipsis" , "types.EllipsisType" )
185+
184186# A placeholder used for Bogus[...] parameters
185187_dummy : Final [Any ] = object ()
186188
@@ -1574,7 +1576,7 @@ def is_singleton_type(self) -> bool:
15741576 return (
15751577 self .type .is_enum
15761578 and len (self .type .enum_members ) == 1
1577- or self .type .fullname in { "builtins.ellipsis" , "types.EllipsisType" }
1579+ or self .type .fullname in ELLIPSIS_TYPE_NAMES
15781580 )
15791581
15801582
You can’t perform that action at this time.
0 commit comments