本文整理汇总了Python中group.Group.id方法的典型用法代码示例。如果您正苦于以下问题:Python Group.id方法的具体用法?Python Group.id怎么用?Python Group.id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类group.Group
的用法示例。
在下文中一共展示了Group.id方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: group
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import id [as 别名]
def group(self):
"""
:return: Group() that is attached to this meeting
"""
meeting_group_relationship = self._graph_db.match(start_node=None,
rel_type=GraphRelationship.HAS_MEETING,
end_node=self.meeting_node)
group = Group()
for rel in meeting_group_relationship:
group.id = rel.end_node.properties['id']
group.get_group()
return group
示例2: leave_group
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import id [as 别名]
def leave_group(self, group_id):
"""
remove relationship between user and study group
:param group_id: string uuid
:return: None
"""
#TODO exception handling
group = Group()
group.id = group_id
user_group_relationship = self._graph_db.match_one(start_node=self.user_node,
rel_type=GraphRelationship.MEMBER_OF,
end_node=group.group_node)
self._graph_db.delete(user_group_relationship)
示例3: user_groups
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import id [as 别名]
def user_groups(self):
"""
:return: list of tuples of the groups
"""
#TODO add list of related interests
user_groups = self._graph_db.match(start_node=self.user_node, rel_type=GraphRelationship.STUDIES_WITH,
end_node=None)
# create a list of tuples of interests and the users's relationship to them
groups_list = []
for rel in user_groups:
group_properties = dict(rel.end_node.properties)
group = Group()
group.id = group_properties['id']
interests = group.group_interests
group_interests_list = []
for interest in interests:
group_interests_list.append(interest['name'])
group_properties['interests'] = group_interests_list
groups_list.append(group_properties)
return groups_list
示例4: join_group
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import id [as 别名]
def join_group(self, group_id, group_relationship_properties=None):
"""
Add user as member of group
:param group_id: string uuid
:return:
"""
#TODO exception handling
group = Group()
group.id = group_id
# relationship properties
join_properties = {
'join_date': datetime.date.today()
}
user_group_relationship = Relationship(self.user_node,
GraphRelationship.STUDIES_WITH,
group.group_node)
# properties=join_properties)
for key, value in join_properties.iteritems():
user_group_relationship[key] = value
try:
self._graph_db.create_unique(user_group_relationship)
except:
pass
示例5: create_meeting
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import id [as 别名]
def create_meeting(self, group_id, meeting_properties=None):
"""
:param meeting_properties:
:return:
"""
#TODO exception handling
self.created_date = datetime.date.today()
self.id = str(uuid.uuid4())
if meeting_properties is not None:
self.set_meeting_properties(meeting_properties)
new_meeting_node = Node.cast(GraphLabel.MEETING, self.meeting_properties)
try:
self._graph_db.create(new_meeting_node)
group = Group()
group.id = group_id
group_node = group.group_node
meeting_group_relationship = Relationship(group_node,
GraphRelationship.HAS_MEETING,
self.meeting_node)
self._graph_db.create_unique(meeting_group_relationship)
except:
pass
return new_meeting_node