MCPcopy Create free account
hub / github.com/alibaba/GraphScope / unify_type

Function unify_type

python/graphscope/framework/utils.py:546–573  ·  view source on GitHub ↗
(t)

Source from the content-addressed store, hash-verified

544
545
546def unify_type(t):
547 # If type is None, we deduce type from source file.
548 if t is None:
549 return graph_def_pb2.DataTypePb.UNKNOWN
550 if isinstance(t, str):
551 return _unify_str_type(t)
552 elif isinstance(t, type):
553 unify_types = {
554 int: graph_def_pb2.LONG,
555 np.int32: graph_def_pb2.INT,
556 np.int64: graph_def_pb2.LONG,
557 np.uint32: graph_def_pb2.UINT,
558 np.uint64: graph_def_pb2.ULONG,
559 float: graph_def_pb2.DOUBLE,
560 np.float32: graph_def_pb2.FLOAT,
561 np.float64: graph_def_pb2.DOUBLE,
562 str: graph_def_pb2.STRING,
563 np.str_: graph_def_pb2.STRING,
564 bool: graph_def_pb2.BOOL,
565 np.bool8: graph_def_pb2.BOOL,
566 list: graph_def_pb2.INT_LIST,
567 tuple: graph_def_pb2.INT_LIST,
568 dict: graph_def_pb2.DYNAMIC,
569 }
570 return unify_types[t]
571 elif isinstance(t, int): # graph_def_pb2.DataType
572 return t
573 raise TypeError("Not supported type {}".format(t))
574
575
576def data_type_to_cpp(t):

Callers 4

add_propertyMethod · 0.90
_from_vineyardMethod · 0.90
add_common_attributesMethod · 0.90
_from_mutable_graphMethod · 0.90

Calls 2

_unify_str_typeFunction · 0.85
formatMethod · 0.45

Tested by

no test coverage detected