def get_vertex_value(self, vid): vertex = ttypes.Vertex() vertex.vid = vid vertex.tags = list() for i in range(0, 3): tag = ttypes.Tag() tag.name = 'tag{}'.format(i) tag.props = dict() for j in range(0, 5): tag.props['prop{}'.format(j)] = j vertex.tags.append(tag) return vertex
def get_vertex_value(self, vid): vertex = ttypes.Vertex() vertex.vid = vid vertex.tags = list() for i in range(0, 3): tag = ttypes.Tag() tag.name = ('tag{}'.format(i)).encode('utf-8') tag.props = dict() for j in range(0, 5): value = ttypes.Value() value.set_iVal(j) tag.props[('prop{}'.format(j)).encode('utf-8')] = value vertex.tags.append(tag) return vertex
def create_vertex_team(line): assert len(line) == 2 vertex = ttypes.Vertex() vertex.vid = utf8b(line[0]) tags = [] tag = ttypes.Tag() tag.name = utf8b('team') props = dict() name = ttypes.Value() name.set_sVal(utf8b(line[1])) props[utf8b('name')] = name tag.props = props tags.append(tag) vertex.tags = tags return vertex
def create_vertex_team(self, line): if len(line) != 2: assert False vertex = CommonTtypes.Vertex() vertex.vid = bytes(line[0], encoding='utf-8') tags = [] tag = CommonTtypes.Tag() tag.name = bytes('team', encoding='utf-8') props = dict() name = CommonTtypes.Value() name.set_sVal(bytes(line[1], encoding='utf-8')) props[bytes('name', encoding='utf-8')] = name tag.props = props tags.append(tag) vertex.tags = tags return vertex
def create_vertex_bachelor(line): assert len(line) == 3 vertex = ttypes.Vertex() vertex.vid = utf8b(line[0]) tags = [] tag = ttypes.Tag() tag.name = utf8b('bachelor') props = dict() name = ttypes.Value() name.set_sVal(utf8b(line[1])) props[utf8b('name')] = name speciality = ttypes.Value() speciality.set_sVal(utf8b(line[2])) props[utf8b('speciality')] = speciality tag.props = props tags.append(tag) vertex.tags = tags return vertex
def create_vertex_player(line): assert len(line) == 3 vertex = ttypes.Vertex() vertex.vid = utf8b(line[0]) tags = [] tag = ttypes.Tag() tag.name = utf8b('player') props = dict() name = ttypes.Value() name.set_sVal(utf8b(line[1])) props[utf8b('name')] = name age = ttypes.Value() age.set_iVal(int(line[2])) props[utf8b('age')] = age tag.props = props tags.append(tag) vertex.tags = tags return vertex
def create_vertex_bachelor(self, line): if len(line) != 3: assert False vertex = CommonTtypes.Vertex() vertex.vid = bytes(line[0], encoding='utf-8') tags = [] tag = CommonTtypes.Tag() tag.name = bytes('bachelor', encoding='utf-8') props = dict() name = CommonTtypes.Value() name.set_sVal(bytes(line[1], encoding='utf-8')) props[bytes('name', encoding='utf-8')] = name speciality = CommonTtypes.Value() speciality.set_sVal(bytes(line[2], encoding='utf-8')) props[bytes('speciality', encoding='utf-8')] = speciality tag.props = props tags.append(tag) vertex.tags = tags return vertex
def create_vertex_player(self, line): if len(line) != 3: assert False vertex = CommonTtypes.Vertex() vertex.vid = bytes(line[0], encoding='utf-8') tags = [] tag = CommonTtypes.Tag() tag.name = bytes('player', encoding='utf-8') props = dict() name = CommonTtypes.Value() name.set_sVal(bytes(line[1], encoding='utf-8')) props[bytes('name', encoding='utf-8')] = name age = CommonTtypes.Value() age.set_iVal(int(line[2])) props[bytes('age', encoding='utf-8')] = age tag.props = props tags.append(tag) vertex.tags = tags return vertex