コード例 #1
0
    def loadEntries(bot):
        Entries.entries = []
        if hasattr(bot, "_id"):
            categories = Database.find(Database.COLLECTIONS.CATEGORY,
                                       {"bot": bot._id})
            for data in categories:
                c = Category(bot, data)
                Entries.entries.append(c)

        if (len(Entries.entries) > 0):
            Entries.currentEntry = Entries.entries[0]
        else:
            Entries.currentEntry = Entries.newEntry(bot)
        Entries._notify(Entries.UPDATE.ALL)
コード例 #2
0
ファイル: bot.py プロジェクト: d4rkm0nkey/TrainingChatbotGui
    def loadBots():
        bots = Database.find(Database.COLLECTIONS.BOT, {})
        Bots.__bots__ = []
        for document in bots:
            bot = Bot(document["name"])
            bot.load(document)
            Bots.__bots__.append(bot)

        if not any(bot.name == Bots.GENERAL_NAME_TAG for bot in Bots.__bots__):
            bot = Bot(Bots.GENERAL_NAME_TAG)
            bot.save()
            Bots.__bots__.insert(0, bot)

        Bots._notify()
コード例 #3
0
 def loadEmotions():
     emotions = Database.find(Database.COLLECTIONS.EMOTION, {})
     __emotions__ = []
     for document in emotions:
         __emotions__.append(document["name"])
コード例 #4
0
 def load():
     domains = Database.find(Database.COLLECTIONS.DOMAIN, {})
     Domains.__domains__ = []
     for document in domains :
         Domains.__domains__ .append(document["name"])
     Domains._notify()
コード例 #5
0
 def find_by_controller_id(cls, controller_id):
     hospitals = Database.find(collection='blogs',
                               query={'controller_id': controller_id})
     return [cls(**hospital) for hospital in hospitals]
コード例 #6
0
 def from_hospital(id):
     return [
         patient for patient in Database.find(collection='posts',
                                              query={'hospital_id': id})
     ]