Skip to content

Commit fc16c07

Browse files
committed
Refactor: replace make_simplified_union with UnionType.make_union in plugins/ctypes.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 3c29b1d commit fc16c07

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mypy/plugins/ctypes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def _autoconvertible_to_cdata(tp: Type, api: mypy.plugin.CheckerPluginInterface)
7272
allowed_types.append(api.named_generic_type("builtins.int", []))
7373
allowed_types.append(NoneType())
7474

75-
return make_simplified_union(allowed_types)
75+
return UnionType.make_union(allowed_types)
7676

7777

7878
def _autounboxed_cdata(tp: Type) -> ProperType:
@@ -85,7 +85,7 @@ def _autounboxed_cdata(tp: Type) -> ProperType:
8585
tp = get_proper_type(tp)
8686

8787
if isinstance(tp, UnionType):
88-
return make_simplified_union([_autounboxed_cdata(t) for t in tp.items])
88+
return UnionType.make_union([_autounboxed_cdata(t) for t in tp.items])
8989
elif isinstance(tp, Instance):
9090
for base in tp.type.bases:
9191
if base.type.fullname == "_ctypes._SimpleCData":
@@ -218,7 +218,7 @@ def array_value_callback(ctx: mypy.plugin.AttributeContext) -> Type:
218218
),
219219
ctx.context,
220220
)
221-
return make_simplified_union(types)
221+
return UnionType.make_union(types)
222222
return ctx.default_attr_type
223223

224224

@@ -241,5 +241,5 @@ def array_raw_callback(ctx: mypy.plugin.AttributeContext) -> Type:
241241
' with element type "c_char", not {}'.format(format_type(et, ctx.api.options)),
242242
ctx.context,
243243
)
244-
return make_simplified_union(types)
244+
return UnionType.make_union(types)
245245
return ctx.default_attr_type

0 commit comments

Comments
 (0)