def get_union_type( types: Iterable[s_types.Type], *, opaque: bool = False, ctx: context.ContextLevel, ) -> s_types.Type: ctx.env.schema, union, created = s_utils.ensure_union_type(ctx.env.schema, types, opaque=opaque) if created: ctx.env.created_schema_objects.add(union) elif (union not in ctx.env.created_schema_objects and union.get_name(ctx.env.schema).module != '__derived__'): ctx.env.schema_refs.add(union) return union
def get_union_type( types: Iterable[s_types.Type], *, opaque: bool = False, ctx: context.ContextLevel, ) -> s_types.Type: ctx.env.schema, union, created = s_utils.ensure_union_type(ctx.env.schema, types, opaque=opaque) if created: ctx.env.created_schema_objects.add(union) elif (union not in ctx.env.created_schema_objects and (not isinstance(union, s_obj.QualifiedObject) or union.get_name(ctx.env.schema).module != '__derived__')): ctx.env.add_schema_ref(union, expr=None) return union