Skip to content

Commit 4cb17eb

Browse files
committed
Refactor: replace make_simplified_union with UnionType.make_union in plugins/default.py (#8624)
This commit replaces all calls to make_simplified_union with UnionType.make_union in this file, as part of the codebase modernization effort in issue #8624.
1 parent fc16c07 commit 4cb17eb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

mypy/plugins/default.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def typed_dict_get_signature_callback(ctx: MethodSigContext) -> CallableType:
222222
tv = signature.variables[0]
223223
assert isinstance(tv, TypeVarType)
224224
return signature.copy_modified(
225-
arg_types=[signature.arg_types[0], make_simplified_union([value_type, tv])],
225+
arg_types=[signature.arg_types[0], UnionType.make_union([value_type, tv])],
226226
ret_type=ret_type,
227227
)
228228
return signature
@@ -263,7 +263,7 @@ def typed_dict_get_callback(ctx: MethodContext) -> Type:
263263
if len(ctx.arg_types) == 1:
264264
output_types.append(NoneType())
265265

266-
return make_simplified_union(output_types)
266+
return UnionType.make_union(output_types)
267267
return ctx.default_return_type
268268

269269

@@ -292,7 +292,7 @@ def typed_dict_pop_signature_callback(ctx: MethodSigContext) -> CallableType:
292292
# variable that accepts everything.
293293
tv = signature.variables[0]
294294
assert isinstance(tv, TypeVarType)
295-
typ = make_simplified_union([value_type, tv])
295+
typ = UnionType.make_union([value_type, tv])
296296
return signature.copy_modified(arg_types=[str_type, typ], ret_type=typ)
297297
return signature.copy_modified(arg_types=[str_type, signature.arg_types[1]])
298298

@@ -327,9 +327,9 @@ def typed_dict_pop_callback(ctx: MethodContext) -> Type:
327327
return AnyType(TypeOfAny.from_error)
328328

329329
if len(ctx.args[1]) == 0:
330-
return make_simplified_union(value_types)
330+
return UnionType.make_union(value_types)
331331
elif len(ctx.arg_types) == 2 and len(ctx.arg_types[1]) == 1 and len(ctx.args[1]) == 1:
332-
return make_simplified_union([*value_types, ctx.arg_types[1][0]])
332+
return UnionType.make_union([*value_types, ctx.arg_types[1][0]])
333333
return ctx.default_return_type
334334

335335

@@ -401,7 +401,7 @@ def typed_dict_setdefault_callback(ctx: MethodContext) -> Type:
401401

402402
value_types.append(value_type)
403403

404-
return make_simplified_union(value_types)
404+
return UnionType.make_union(value_types)
405405
return ctx.default_return_type
406406

407407

@@ -479,7 +479,7 @@ def typed_dict_update_signature_callback(ctx: MethodSigContext) -> CallableType:
479479
item = item.copy_modified(item_names=list(td.items))
480480
items.append(item)
481481
if items:
482-
arg_type = make_simplified_union(items)
482+
arg_type = UnionType.make_union(items)
483483
return signature.copy_modified(arg_types=[arg_type])
484484
return signature
485485

0 commit comments

Comments
 (0)