

@cached()
def get_tags_for_user(self, user_id):
    'Get all the tags for a user.\n\n\n        Args:\n            user_id(str): The user to get the tags for.\n        Returns:\n            A deferred dict mapping from room_id strings to dicts mapping from\n            tag strings to tag content.\n        '
    deferred = self._simple_select_list('room_tags', {
        'user_id': user_id,
    }, ['room_id', 'tag', 'content'])

    @deferred.addCallback
    def tags_by_room(rows):
        tags_by_room = {
            
        }
        for row in rows:
            room_tags = tags_by_room.setdefault(row['room_id'], {
                
            })
            room_tags[row['tag']] = json.loads(row['content'])
        return tags_by_room
    return deferred

dataset/ETHPy150Open matrix-org/synapse/synapse/storage/tags.py TagsStore.get_tags_for_user/original