@@ -54,7 +54,7 @@ def expand_type(
54
54
env : Mapping [TypeVarId , Type ],
55
55
allow_erased_callables : bool = ...,
56
56
* ,
57
- keep_none_type : bool = ...,
57
+ strict_optional : bool = ...,
58
58
) -> ProperType :
59
59
...
60
60
@@ -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
) -> Type :
70
70
...
71
71
@@ -75,12 +75,12 @@ def expand_type(
75
75
env : Mapping [TypeVarId , Type ],
76
76
allow_erased_callables : bool = False ,
77
77
* ,
78
- keep_none_type : bool = False ,
78
+ strict_optional : bool = False ,
79
79
) -> Type :
80
80
"""Substitute any type variable references in a type given by a type
81
81
environment.
82
82
"""
83
- return typ .accept (ExpandTypeVisitor (env , allow_erased_callables , keep_none_type ))
83
+ return typ .accept (ExpandTypeVisitor (env , allow_erased_callables , strict_optional ))
84
84
85
85
86
86
@overload
@@ -198,11 +198,11 @@ def __init__(
198
198
self ,
199
199
variables : Mapping [TypeVarId , Type ],
200
200
allow_erased_callables : bool = False ,
201
- keep_none_type : bool = False ,
201
+ strict_optional : bool = False ,
202
202
) -> None :
203
203
self .variables = variables
204
204
self .allow_erased_callables = allow_erased_callables
205
- self .keep_none_type = keep_none_type
205
+ self .strict_optional = strict_optional
206
206
self .recursive_guard : set [Type | tuple [int , Type ]] = set ()
207
207
208
208
def visit_unbound_type (self , t : UnboundType ) -> Type :
@@ -486,7 +486,7 @@ def visit_union_type(self, t: UnionType) -> Type:
486
486
# might be subtypes of others, however calling make_simplified_union()
487
487
# can cause recursion, so we just remove strict duplicates.
488
488
return UnionType .make_union (
489
- remove_trivial (flatten_nested_unions (expanded ), self .keep_none_type ), t .line , t .column
489
+ remove_trivial (flatten_nested_unions (expanded ), self .strict_optional ), t .line , t .column
490
490
)
491
491
492
492
def visit_partial_type (self , t : PartialType ) -> Type :
0 commit comments