def getAppliancesList(self): settings = Settings() applianceListStr = settings.get("appliancesList") applianceNameList = applianceListStr.replace(" ", "").split(",") appliancesList = [] for applianceName in applianceNameList: item = {} item["name"] = applianceName item["label"] = applianceName.replace("_", " ").title() appliancesList.append(item) return appliancesList
def initializeNetwork(self, familyProfile): validValues = ["single_men", "single_women", "friends_group", "couple", "couple_child"] if familyProfile not in validValues: raise NotValidFamilyProfileError("The required family profile is not valid") settings = Settings() settings.set("familyProfile", familyProfile) for currentAppliance in self.getAppliancesList(): applianceName = currentAppliance["name"] applianceLabel = currentAppliance["label"] appliance = Appliance( name = applianceName, label = applianceLabel, timeslots = self.getTimeslotsGanttByFamilyProfile(familyProfile, applianceName) ) appliance.store()