in chz/tiepin.py [0:0]
def simplified_union(types):
if len(types) == 0:
return typing.Never
if len(types) == 1:
return types[0]
union_types = []
for typ in types:
if getattr(typ, "__args__", None) is None and any(
issubclass(typ, member) for member in union_types
):
continue
union_types.append(typ)
types = union_types
union_types = []
for typ in reversed(types):
if getattr(typ, "__args__", None) is None and any(
issubclass(typ, member) for member in union_types
):
continue
union_types.append(typ)
return functools.reduce(operator.or_, union_types)