(This is not the same issue with as #116)
Since the typing module in Python 3.7 doesn't have _Union class, AttributeError occurs by below lines. To support Python 3.7 it should be fixed.
|
if hasattr(typing, '_Union'): |
|
def is_union_type(type_): |
|
return isinstance(type_, typing._Union) |
|
|
|
def get_union_types(type_): |
|
if is_union_type(type_): |
|
return type_.__args__ |
|
else: |
|
def is_union_type(type_): |
|
return isinstance(type_, typing.UnionMeta) |
|
|
|
def get_union_types(type_): |
|
if is_union_type(type_): |
|
return type_.__union_params__ \ |
|
if hasattr(type_, '__union_params__') \ |
|
else type_.__args__ |
p.s. @kanghyojun Could you explain why you used _Union instead of Union?
Relative links
(This is not the same issue with as #116)
Since the
typingmodule in Python 3.7 doesn't have_Unionclass,AttributeErroroccurs by below lines. To support Python 3.7 it should be fixed.nirum-python/nirum/_compat.py
Lines 28 to 43 in 2f85525
p.s. @kanghyojun Could you explain why you used
_Unioninstead ofUnion?Relative links
UnionMetaand added_UnionandUnion_Union.Unionis now using the new class_SpecialForm.