@@ -54,7 +54,7 @@ def expand_type(
5454 env : Mapping [TypeVarId , Type ],
5555 allow_erased_callables : bool = ...,
5656 * ,
57- keep_none_type : bool = ...,
57+ strict_optional : bool = ...,
5858) -> ProperType :
5959 ...
6060
@@ -65,7 +65,7 @@ def expand_type(
6565 env : Mapping [TypeVarId , Type ],
6666 allow_erased_callables : bool = ...,
6767 * ,
68- keep_none_type : bool = ...,
68+ strict_optional : bool = ...,
6969) -> Type :
7070 ...
7171
@@ -75,12 +75,12 @@ def expand_type(
7575 env : Mapping [TypeVarId , Type ],
7676 allow_erased_callables : bool = False ,
7777 * ,
78- keep_none_type : bool = False ,
78+ strict_optional : bool = False ,
7979) -> Type :
8080 """Substitute any type variable references in a type given by a type
8181 environment.
8282 """
83- return typ .accept (ExpandTypeVisitor (env , allow_erased_callables , keep_none_type ))
83+ return typ .accept (ExpandTypeVisitor (env , allow_erased_callables , strict_optional ))
8484
8585
8686@overload
@@ -198,11 +198,11 @@ def __init__(
198198 self ,
199199 variables : Mapping [TypeVarId , Type ],
200200 allow_erased_callables : bool = False ,
201- keep_none_type : bool = False ,
201+ strict_optional : bool = False ,
202202 ) -> None :
203203 self .variables = variables
204204 self .allow_erased_callables = allow_erased_callables
205- self .keep_none_type = keep_none_type
205+ self .strict_optional = strict_optional
206206 self .recursive_guard : set [Type | tuple [int , Type ]] = set ()
207207
208208 def visit_unbound_type (self , t : UnboundType ) -> Type :
@@ -486,7 +486,7 @@ def visit_union_type(self, t: UnionType) -> Type:
486486 # might be subtypes of others, however calling make_simplified_union()
487487 # can cause recursion, so we just remove strict duplicates.
488488 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
490490 )
491491
492492 def visit_partial_type (self , t : PartialType ) -> Type :
0 commit comments