Fix typing to cypher type impl inside mgp.py (#159)
This commit is contained in:
parent
cd03e13443
commit
542a324c96
@ -627,8 +627,11 @@ def _typing_to_cypher_type(type_):
|
|||||||
if complex_type == typing.Union:
|
if complex_type == typing.Union:
|
||||||
# If we have a Union with NoneType inside, it means we are building
|
# If we have a Union with NoneType inside, it means we are building
|
||||||
# a nullable type.
|
# a nullable type.
|
||||||
if isinstance(None, type_args):
|
# isinstance doesn't work here because subscripted generics cannot
|
||||||
types = tuple(t for t in type_args if not isinstance(None, t))
|
# be used with class and instance checks. type comparison should be
|
||||||
|
# fine because subclasses are not used.
|
||||||
|
if type(None) in type_args:
|
||||||
|
types = tuple(t for t in type_args if t is not type(None)) # noqa E721
|
||||||
if len(types) == 1:
|
if len(types) == 1:
|
||||||
type_arg, = types
|
type_arg, = types
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user