@@ -65,7 +65,7 @@ def expand_type(
65
65
env : Mapping [TypeVarId , Type ],
66
66
allow_erased_callables : bool = ...,
67
67
* ,
68
- keep_none_type : bool = ...,
68
+ strict_optional : bool = ...,
69
69
) -> ProperType :
70
70
...
71
71
@@ -76,7 +76,7 @@ def expand_type(
76
76
env : Mapping [TypeVarId , Type ],
77
77
allow_erased_callables : bool = ...,
78
78
* ,
79
- keep_none_type : bool = ...,
79
+ strict_optional : bool = ...,
80
80
) -> Type :
81
81
...
82
82
@@ -86,12 +86,12 @@ def expand_type(
86
86
env : Mapping [TypeVarId , Type ],
87
87
allow_erased_callables : bool = False ,
88
88
* ,
89
- keep_none_type : bool = False ,
89
+ strict_optional : bool = False ,
90
90
) -> Type :
91
91
"""Substitute any type variable references in a type given by a type
92
92
environment.
93
93
"""
94
- return typ .accept (ExpandTypeVisitor (env , allow_erased_callables , keep_none_type ))
94
+ return typ .accept (ExpandTypeVisitor (env , allow_erased_callables , strict_optional ))
95
95
96
96
97
97
@overload
@@ -214,11 +214,11 @@ def __init__(
214
214
self ,
215
215
variables : Mapping [TypeVarId , Type ],
216
216
allow_erased_callables : bool = False ,
217
- keep_none_type : bool = False ,
217
+ strict_optional : bool = False ,
218
218
) -> None :
219
219
self .variables = variables
220
220
self .allow_erased_callables = allow_erased_callables
221
- self .keep_none_type = keep_none_type
221
+ self .strict_optional = strict_optional
222
222
self .recursive_guard : set [Type | tuple [int , Type ]] = set ()
223
223
224
224
def visit_unbound_type (self , t : UnboundType ) -> Type :
@@ -502,7 +502,7 @@ def visit_union_type(self, t: UnionType) -> Type:
502
502
# might be subtypes of others, however calling make_simplified_union()
503
503
# can cause recursion, so we just remove strict duplicates.
504
504
return UnionType .make_union (
505
- remove_trivial (flatten_nested_unions (expanded ), self .keep_none_type ), t .line , t .column
505
+ remove_trivial (flatten_nested_unions (expanded ), self .strict_optional ), t .line , t .column
506
506
)
507
507
508
508
def visit_partial_type (self , t : PartialType ) -> Type :
0 commit comments