Example #1
0
def deleteDrink(name):
    marked = None
    for element in DrinkLibrary:
        if (element.getName() == name):
            marked = element
    log('Drinks', '[DELETE]' + str(marked))
    DrinkLibrary.remove(marked)
Example #2
0
def deleteIngredient(name):
    marked = None
    for element in IngredientLibrary:
        if (element.getName() == name):
            marked = element
    log('Ingredients', '[DELETE]' + str(marked))
    IngredientLibrary.remove(marked)
Example #3
0
def restoreBases():
    #TODO: Remove this after ingestion
    BASES.clear()
    file = open("BasesRepo.txt", "r")
    for line in file:
        BASES.append(line.strip('\n'))
    log('Info', 'Restoring Bases List')
Example #4
0
def PetPlan_OwnerDetailsPage(driver, wait):
    try:
        wait.until(
            ec.visibility_of_element_located((By.XPATH, '//*[@id="title"]')))
        selectTitle = Select(
            driver.find_element(*PetPlan_OwnerDetails.Select_Title))
        selectTitle.select_by_value("string:Mr")
        driver.find_element(*PetPlan_OwnerDetails.txt_FirstName).clear()
        driver.find_element(
            *PetPlan_OwnerDetails.txt_FirstName).send_keys('Testing')
        driver.find_element(*PetPlan_OwnerDetails.txt_Surname).clear()
        driver.find_element(
            *PetPlan_OwnerDetails.txt_Surname).send_keys('Test')
        selectDay = Select(
            driver.find_element(*PetPlan_OwnerDetails.Select_Day))
        selectDay.select_by_value('12')
        selectMonth = Select(
            driver.find_element(*PetPlan_OwnerDetails.Select_Month))
        selectMonth.select_by_value('number:6')
        selectYear = Select(
            driver.find_element(*PetPlan_OwnerDetails.Select_Year))
        selectYear.select_by_value('number:1991')
        driver.find_element(*PetPlan_OwnerDetails.txt_PhoneNumber).clear()
        driver.find_element(
            *PetPlan_OwnerDetails.txt_PhoneNumber).send_keys('07814973804')
        driver.find_element(*PetPlan_OwnerDetails.txt_Email).clear()
        driver.find_element(
            *PetPlan_OwnerDetails.txt_Email).send_keys('*****@*****.**')
        driver.find_element(*PetPlan_OwnerDetails.txt_Postcode).clear()
        driver.find_element(
            *PetPlan_OwnerDetails.txt_Postcode).send_keys('tn23ef')
        driver.find_element(*PetPlan_OwnerDetails.btn_FindAddress).click()
        try:
            time.sleep(2)
            wait.until(
                ec.visibility_of_element_located(
                    (By.XPATH, '//*[@id="addressList"]')))
            selectAddress = Select(
                driver.find_element(*PetPlan_OwnerDetails.Select_Address))
            selectAddress.select_by_visible_text(
                'Vision Track,Unit 2 Chapman Way Tunbridge Wells')
        except:
            driver.find_element(
                *PetPlan_OwnerDetails.txt_HouseNumber).send_keys('Unit 2')
            driver.find_element(
                *PetPlan_OwnerDetails.txt_Street).send_keys('Chapman Way')
            driver.find_element(
                *PetPlan_OwnerDetails.txt_Town).send_keys('Tunbridge Wells')
            driver.find_element(
                *PetPlan_OwnerDetails.txt_County).send_keys('Kent')
        wait.until(
            ec.visibility_of_element_located((
                By.XPATH,
                '//*[@id="skipnav"]/div[1]/div/div/div/div/form/section[3]/div/div[3]/button'
            )))
        time.sleep(3)
        driver.find_element(*PetPlan_OwnerDetails.btn_OwnerContinue).click()
    except:
        log('Failed Owner Details Page')
 def __init__(self, con, addr):
     log(1, "New Client: " + addr)
     self.con = con
     self.file = con.makefile()
     self.addr = addr
     self.user = None
     self.sentpass = false
     self._hooks = []
     Thread(target=self._listen).start()
Example #6
0
def main():
    class_path = str(sys.argv[1])
    dir_name = str(sys.argv[2])
    my_parameters.static_post_data['NaviCode'] = 'I1' + class_path
    try:
        s = SearchTool(dir_name)
        s.search_reference()
    except:
        log('程序挂掉了')
 def __init__(self, con, addr):
     log(1, "New Client: " + addr)
     self.con = con
     self.file = con.makefile()
     self.addr = addr
     self.user = None
     self.sentpass = false
     self._hooks = []
     Thread(target=self._listen).start()
Example #8
0
def MainPageLoad(driver, csv_writer, dtrow):
    url = Website.site(dtrow[0])
    wait = WebDriverWait(driver, 30)
    log('Navigate to ' + dtrow[0])
    try:
        driver.get(url)
    except:
        log(("Driver Failure"))
        print('Driver Fail')
    Website.PetSite(dtrow, csv_writer, driver, wait)
    driver.delete_all_cookies()
Example #9
0
def createIngredient(name, base, family, startVol, endVol, active, position,
                     restore):
    test = str(active)
    if (test == 'True'):
        active = True
    else:
        active = False
    ingredient = Ingredient(name, base, family, int(startVol), int(endVol),
                            bool(active), int(position))
    addIngredient(ingredient)
    if (not restore):
        log('Ingredients', '[CREATE]' + str(ingredient))
Example #10
0
    def __init__(self, c_instance, selected_track_controller):
        self.c_instance = c_instance
        if c_instance:
            self.song = c_instance.song()
        self.selected_track_controller = selected_track_controller
        #self.midi_callbacks = (,)

        for key, callback in self.get_midi_bindings():
            if not key in settings.midi_mapping:
                log("no mapping for control '%s' - see settings.py" % key)
                continue

            mapping = settings.midi_mapping[key]
            # always make sure mapping is a tuple
            if isinstance(mapping, MIDI.MIDICommand):
                mapping = (mapping, )

            for m in mapping:
                self.selected_track_controller.register_midi_callback(
                    callback, m.key, m.mode, m.status, m.channel)
	def __init__(self, c_instance, selected_track_controller):
		self.c_instance = c_instance
		if c_instance:
			self.song = c_instance.song()
		self.selected_track_controller = selected_track_controller
		#self.midi_callbacks = (,)
		
		
		for key, callback in self.get_midi_bindings():
			if not key in settings.midi_mapping:
				log("no mapping for control '%s' - see settings.py" % key)
				continue
			
			mapping = settings.midi_mapping[key]
			# always make sure mapping is a tuple
			if isinstance(mapping, MIDI.MIDICommand):
				mapping = (mapping,)
			
			for m in mapping:
				self.selected_track_controller.register_midi_callback(callback, m.key, m.mode, m.status, m.channel)
Example #12
0
    def search_reference(self):
        #首先创建存放数据的文件夹
        if not os.path.exists(self.dir_path):
            os.mkdir(self.dir_path)
        '''
        第一次发送post请求
        再一次发送get请求,这次请求没有写文献等东西
        两次请求来获得文献列表
        '''

        # my_parameters.static_post_data['NaviCode'] = 'I1' + class_path
        first_post_res = self.session.post(SEARCH_HANDLE_URL, data=my_parameters.static_post_data, headers=my_parameters.headers_post, verify=False)
        self.get_result_url = GET_PAGE_URL + first_post_res.text + '&t=1604567480096&keyValue=&S=1&sorttype='
        self.get_result = self.session.get(self.get_result_url, headers=my_parameters.headers_get_page, verify=False)

        #如果此文件未被保存过,则找到其内容保存下来
        cur_file = os.path.join(self.dir_path ,str(self.cur_page) + '.json')
        if not os.path.exists(cur_file):
            #将第一页的所需内容加入列表
            dict_per_page = get_page_info.get_Page_Info(self.get_result.text,self.session)
            with open(cur_file, 'w', encoding='utf8') as fp:
                json.dump(dict_per_page, fp)
            time.sleep(0.1)
            log('第' + str(self.cur_page) + '页下载完毕!')
            exit()

        self.start_page = self.get_max_page()
        print("初始页码",self.start_page)
        for self.cur_page in range(self.start_page,self.end_page+1):
            time.sleep(0.5)
            # 如果此文件未被保存过,则找到其内容保存下来
            cur_file = os.path.join(self.dir_path, str(self.cur_page) + '.json')
            if not os.path.exists(cur_file):
                self.get_another_page()
                self.get_result = self.session.get(self.get_result_url, headers=my_parameters.headers_kns)
                dict_per_page = get_page_info.get_Page_Info(self.get_result.text, self.session)
                with open(cur_file, 'w') as fp:
                    json.dump(dict_per_page, fp)
                time.sleep(0.1)
                log('第' + str(self.cur_page) +'页下载完毕!')
            exit()
Example #13
0
def createOrder(name,force):

    shelfPositions = []
    for item in getShelf():
        if(item is not None):
            shelfPositions.append(item.getBase())
        else:
            shelfPositions.append(None)

    recipe = {}
    order = None
    for drink in Drink_Library.DrinkLibrary:
        if drink.getName() == name:
            order = drink
            break

    if(force):
        shelf = {}
        #Get a dict of shelf names
        for element in getShelf():
            if(element is not None):
                shelf[element.getBase()] = ''

            #Get recipe together for arduino
        for key, value in order.getIngredients().items():
            if(key in shelf):
                recipe[shelfPositions.index(str(key))] = int(value)
        #Pass on to arduino
        log('Order','[Normal]'+str(order)+'|'+str(recipe))
        print('RECIPE: '+str(recipe))
    else:
        #Get recipe together for arduino
        for key, value in order.getIngredients().items():
            try:
                recipe[shelfPositions.index(str(key))] = int(value)
            except ValueError:
                print('Didnt find: '+str(key))
        #Pass on to arduino
        log('Order','[Normal]'+str(order)+'|'+str(recipe))
        print(str(recipe))
Example #14
0
def TescoYourQuote(driver, wait, csv_writer, dtrow):
    log('Collecting Quote Data')
    wait.until(
        ec.invisibility_of_element(
            (By.XPATH,
             '//*[@id="yourDetailsPolicyHolderReferralSelectBoxIt"]')))
    wait.until(
        ec.visibility_of_element_located(
            (By.XPATH, '//*[@id="yourQuoteHide1"]/div[1]/div')))
    driver.find_element(*QuotePageLocators.Quote_Accident_Only).click()
    time.sleep(1)
    AccidentOnlyMonthlyQuote = driver.find_element(
        *QuotePageLocators.Quote_AO_Monthly)
    TescoAOMonthly = AccidentOnlyMonthlyQuote.text
    log('Tesco Accident Only Monthly is ' + TescoAOMonthly)
    AccidentOnlyYearlyQuote = driver.find_element(
        *QuotePageLocators.Quote_AO_Yearly)
    TescoAOYearly = AccidentOnlyYearlyQuote.text
    log('Tesco Accident Only Yearliy is ' + TescoAOYearly)
    row = 'Tesco', 'Dog', TescoAOMonthly, TescoAOYearly, 'Accident Only'
    csv_writer.writerow(row)
    driver.find_element(*QuotePageLocators.Quote_Accident_and_Illness).click()
    wait.until(
        ec.visibility_of_element_located((
            By.XPATH,
            '//*[@id="iddEnhancedTile"]/div[3]/div[2]/fieldset/div/label[1]')))
    driver.find_element(*QuotePageLocators.Quote_AI_ShortTermOnly).click()
    wait.until(
        ec.visibility_of_element_located(
            (By.XPATH, '//*[@id="totalPriceText"]/span')))
    TescoAIMonthly = driver.find_element(
        *QuotePageLocators.Quote_AI_ShortTermOnly_Monthly).text
    TescoAIYearly = driver.find_element(
        *QuotePageLocators.Quote_AI_ShortTermOnly_Yearly).text
    row = 'Tesco', 'Dog', TescoAIMonthly, TescoAIYearly, 'Accident and Illness - Short Term'
    csv_writer.writerow(row)
    driver.find_element(*QuotePageLocators.Quote_AI_Ongoing).click()
    time.sleep(3)
    TescoAI_OngogingMonthly = driver.find_element(
        *QuotePageLocators.Quote_AI_Ongoing_Extra_Monthly).text
    TescoAI_OngoingYearly = driver.find_element(
        *QuotePageLocators.Quote_AI_Ongoing_Extra_Yearly).text
    row = 'Tesco', 'Dog', TescoAI_OngogingMonthly, TescoAI_OngoingYearly, 'Accident and Illness - Ongoing (Extra)'
    csv_writer.writerow(row)
    TescoPremierMonthly = driver.find_element(
        *QuotePageLocators.Quote_AI_Ongoing_Premier_Monthly).text
    TescoPremierYearly = driver.find_element(
        *QuotePageLocators.Quote_AI_Ongoing_Premier_Yearly).text
    row = 'Tesco', 'Dog', TescoPremierMonthly, TescoPremierYearly, 'Accident and Illness - Ongoing Premier'
    csv_writer.writerow(row)
Example #15
0
 def setImage(self, new_image):
     log('Drinks', '[EDIT]' + 'image=' + new_image + '|' + str(self))
     self.image = new_image
Example #16
0
 def setGarnish(self, new_garnish):
     log('Drinks', '[EDIT]' + 'garnish=' + new_garnish + '|' + str(self))
     self.garnish = new_garnish
Example #17
0
 def setExtras(self, new_extras):
     log('Drinks', '[EDIT]' + 'extras=' + new_extras + '|' + str(self))
     self.extras = new_extras
Example #18
0
def serverInRaw(arg):
    log(1, "[BNC] <- [IRCD] " + arg.line)
Example #19
0
def clientOutRaw(arg):
    log(1, "[CLIENT] <- [BNC] " + arg.line)
Example #20
0
def clientOutRaw(arg):
    log(1, "[CLIENT] <- [BNC] " + arg.line)
Example #21
0
def serverOutRaw(arg):
    log(1, "[BNC] -> [IRCD] " + arg.line)
Example #22
0
def createDrink(name, ice, glass, garnish, extras, ingredients, image,
                restore):
    drink = Drink(name, ice, glass, garnish, extras, ingredients, image)
    addDrink(drink)
    if (not restore):
        log('Drinks', '[CREATE]' + str(drink))
Example #23
0
def TescoPetPage(driver, wait, dtrow):
    try:
        driver.find_element_by_xpath('//*[@id="ensCloseBanner"]').click()
    except:
        print("Didnt Need To Close Cookie Bar")
    log('Entering Pet Information')
    petName = driver.find_element(*DetailsPageLocators.Pet_Name)
    petName.send_keys('Tommy')
    driver.find_element(*DetailsPageLocators.Pet_Type).click()
    driver.find_element(*DetailsPageLocators.Pet_Type).click()
    wait.until(
        ec.element_to_be_clickable((By.XPATH, '//*[@id="dogPedigree0"]')))
    driver.find_element(*DetailsPageLocators.Pet_Breed_Pedigree).click()
    wait.until(
        ec.visibility_of_element_located(
            (By.XPATH, '//*[@id="predictiveTextBreedSelector0"]')))
    driver.find_element(
        *DetailsPageLocators.Pet_Breed_Name).send_keys('Black Mouth Cur')
    time.sleep(2)
    driver.find_element(*DetailsPageLocators.Pet_Breed_Name).send_keys(
        Keys.ARROW_DOWN)
    time.sleep(2)
    driver.find_element(*DetailsPageLocators.Pet_Breed_Name).send_keys(
        Keys.ENTER)
    driver.find_element(*DetailsPageLocators.Pet_Gender_Male).click()
    driver.find_element(*DetailsPageLocators.Pet_Gender_Male).click()
    driver.find_element(*DetailsPageLocators.Pet_DoB_Day).send_keys('21')
    driver.find_element(*DetailsPageLocators.Pet_DoB_Month).send_keys('06')
    driver.find_element(*DetailsPageLocators.Pet_DoB_Year).send_keys('2011')
    driver.find_element(*DetailsPageLocators.Pet_Price).send_keys('1000')
    driver.find_element(*DetailsPageLocators.Pet_N_or_S_No).click()
    driver.find_element(*DetailsPageLocators.Pet_Chipped_No).click()
    driver.find_element(*DetailsPageLocators.Pet_Legal_Action_No).click()
    driver.find_element(*DetailsPageLocators.Pet_Complaints_No).click()
    driver.find_element(*DetailsPageLocators.Pet_Home_Yes).click()
    driver.find_element(*DetailsPageLocators.Pet_Good_Health).click()
    log('Entering Owner Information')
    driver.find_element(*AboutYouLocators.Owner_Title).send_keys('Mr')
    driver.find_element(*AboutYouLocators.Owner_Title).send_keys(Keys.ENTER)
    driver.find_element(*AboutYouLocators.Owner_FirstName).send_keys('John')
    driver.find_element(*AboutYouLocators.Owner_Surname).send_keys('Smith')
    driver.find_element(*AboutYouLocators.Owner_DoB_Day).send_keys('20')
    driver.find_element(*AboutYouLocators.Owner_DoB_Month).send_keys('06')
    driver.find_element(*AboutYouLocators.Owner_DoB_Year).send_keys('1991')
    driver.find_element(*AboutYouLocators.Owner_EmailAddress).send_keys(
        "*****@*****.**")
    driver.find_element(
        *AboutYouLocators.Owner_Phone_Number).send_keys('01323725776')
    driver.find_element(
        *AboutYouLocators.Owner_Marital_Status).send_keys('Married')
    driver.find_element(*AboutYouLocators.Owner_Marital_Status).send_keys(
        Keys.ENTER)
    driver.find_element(*AboutYouLocators.Owner_Postcode).send_keys('TN2 3EF')
    driver.find_element(*AboutYouLocators.Owner_FindAddress).click()
    wait.until(
        ec.visibility_of_element_located(
            (By.XPATH, '//*[@id="yourDetailsAddressIncorrectButton"]')))
    driver.find_element(*AboutYouLocators.Owner_EnterAddress).click()
    wait.until(
        ec.visibility_of_element_located(
            (By.XPATH, '//*[@id="yourDetailsManualAddressHouseNumber"]')))
    driver.find_element(
        *AboutYouLocators.Owner_ManualPostcode).send_keys('TN2 3EF')
    driver.find_element(*AboutYouLocators.Owner_HouseNumber).send_keys('4')
    driver.find_element(
        *AboutYouLocators.Owner_Street).send_keys('Chapman Way')
    driver.find_element(
        *AboutYouLocators.Owner_Town).send_keys('Tunbridge Wells')
    wait.until(
        ec.visibility_of_element_located(
            (By.XPATH,
             '//*[@id="yourDetailsManualAddressCountrySelectBoxItText"]')))
    driver.find_element(*AboutYouLocators.Owner_County).click()
    driver.find_element(*AboutYouLocators.Owner_County_Kent).click()
    #driver.find_element(*AboutYouLocators.Owner_County).send_keys(Keys.ENTER)
    driver.find_element(*AboutYouLocators.Owner_1_Pet).click()
    driver.find_element(*AboutYouLocators.Owner_Informed_No).click()
    #driver.find_element(*DetailsPageLocators.Pet_Breed_Name).send_keys('Black Mouth Cur')
    driver.find_element(*AboutYouLocators.Owner_Get_Quote).click()
Example #24
0
#!/usr/bin/python
from SilvairServer import Server
from Hooks import *
from User import User
import Core
from Logging import log, Level
import hashlib

Core.setup()

log(Level.INFO, "Starting server...")
mainserv = Server(None, 8001)
mainserv.listen()
log(Level.INFO, "Done")

s = hashlib.sha512()
s.update("test")
passw = s.hexdigest()

serv = {"host": "localhost", "port": 6667, "pass": None}
user = {
    "name": "Kilobyte",
    "pass": passw,
    "server": serv,
    "nick": "Kilo2",
    "realname": "Test",
    "ident": "test"
}
User(user)
	def set_quantization(self, key, i):
		log("set %s to %d" % (key, i))
		self.song[key] = i
Example #26
0
def AnimalFriendsCat(driver, wait, dtrow):
    try:
        wait.until(
            ec.visibility_of_element_located(
                (By.XPATH,
                 '//*[@id="details-section"]/div[1]/div[2]/div/label[2]')))
        driver.find_element(*AnimalFriendsAnimalType.Pet_Cat).click()
        time.sleep(1)
        wait.until(
            ec.visibility_of_element_located(
                (By.XPATH, '//*[@id="details-section"]/div['
                 '2]/div/div[2]/div[1]/div/label[1]')))
        try:
            driver.find_element(*AF_PreExistingCons.PreConNo).click()
        except:
            log('PreCon Button not Found')
        try:
            wait.until(
                ec.visibility_of_element_located(
                    (By.XPATH,
                     '//*[@id="pet-details"]/div[1]/div[1]/div/label')))
        except:
            driver.find_element(*AF_PreExistingCons.PreConNo).click()
        wait.until(
            ec.visibility_of_element_located(
                (By.XPATH, '//*[@id="pet-details"]/div[1]/div[1]/div/label')))
        driver.find_element(*AF_Details.Pet_Name).send_keys('Thomas')
        if 'Male' in dtrow[4]:
            driver.find_element(*AF_Details.Pet_Gender_Male).click()
        elif 'Female' in dtrow[4]:
            driver.find_element(*AF_Details.Pet_Gender_Female).click()
        petDob = BirthdayFromAge(dtrow[3])
        driver.find_element(*AF_Details.Pet_DoB).send_keys(
            petDob.strftime('%d%m%Y'))
        if 'Moggie' in dtrow[2]:
            driver.find_element(*AF_Details.Pet_Breed_Mog).click()
        else:
            driver.find_element(*AF_Details.Cat_Breed_Pedigree).click()
            BreedName = driver.find_element(*AF_Details.Cat_Breed_Selection)
            BreedName.send_keys(dtrow[2])
            BreedName.send_keys(Keys.ENTER)
        if 'Free' in dtrow[6]:
            driver.find_element(*AF_Details.Cat_Free).click()
        else:
            driver.find_element(*AF_Details.Cat_Paid_Btn).click()
            time.sleep(1)
            driver.find_element(*AF_Details.Cat_Paid_txt).send_keys(dtrow[6])
        driver.find_element(*AF_Details.Cat_NeverInsured).click()
        driver.find_element(*AF_Details.Cat_AccidentNo).click()
        driver.find_element(*AF_Details.Cat_NotDeclinedInsurance).click()
        driver.find_element(*AF_Details.Owner_FirstName).send_keys('Testing')
        driver.find_element(*AF_Details.Owner_LastName).send_keys('Testing')
        driver.find_element(*AF_Details.Owner_Email).send_keys('*****@*****.**')
        driver.find_element(*AF_Details.Owner_Phone).send_keys('07814973804')
        driver.find_element(*AF_Details.Owner_DoB).send_keys('15121991')
        wait.until(
            ec.element_to_be_clickable(
                (By.XPATH, '//*[@id="client-details"]/div[5]/div[3]/span[2]')))
        driver.find_element(*AF_Details.Owner_ManualAddressBtn).click()
        driver.find_element(*AF_Details.Owner_Address_1).send_keys('unit 4')
        driver.find_element(
            *AF_Details.Owner_Address_2).send_keys('Chapman Way')
        driver.find_element(
            *AF_Details.Owner_Town).send_keys('Tunbridge Wells')
        driver.find_element(*AF_Details.Owner_County).send_keys('Kent')
        driver.find_element(*AF_Details.Owner_Postcode).send_keys('TN23EF')
        FoundUs = driver.find_element(*AF_Details.Owner_FindUs)
        FoundUs.click()
        FoundUs.send_keys(Keys.ARROW_DOWN)
        FoundUs.send_keys(Keys.ENTER)
        driver.find_element(*AF_Details.ContinueButton).click()

    except:
        log("Failure to Generate")
Example #27
0
#!/usr/bin/python
from SilvairServer import Server
from Hooks import *
from User import User
import Core
from Logging import log, Level
import hashlib

Core.setup()

log(Level.INFO, "Starting server...")
mainserv = Server(None, 8001)
mainserv.listen();
log(Level.INFO, "Done")

s = hashlib.sha512()
s.update("test")
passw = s.hexdigest()

serv = {"host": "localhost", "port": 6667, "pass": None}
user = {"name": "Kilobyte", "pass": passw, "server": serv, "nick": "Kilo2", "realname": "Test", "ident": "test"}
User(user)
Example #28
0
def serverOutRaw(arg):
    log(1, "[BNC] -> [IRCD] " + arg.line)
Example #29
0
def addDrink(new_drink):
    DrinkLibrary.append(new_drink)
    log('Drinks', '[CREATE]' + str(new_drink))
Example #30
0
 def setIngredients(self, ingredients):
     log('Drinks',
         '[EDIT]' + 'ingredients=' + str(ingredients) + '|' + str(self))
     self.ingredients = ingredients
Example #31
0
def clientInRaw(arg):
    log(1, "[CLIENT] -> [BNC] " + arg.line)
Example #32
0
 def setName(self, new_name):
     log('Drinks', '[EDIT]' + 'name=' + new_name + '|' + str(self))
     self.name = new_name
Example #33
0
def serverInRaw(arg):
    log(1, "[BNC] <- [IRCD] " + arg.line)
Example #34
0
 def setIce(self, new_ice):
     log('Drinks', '[EDIT]' + 'ice=' + new_ice + '|' + str(self))
     self.ice = new_ice
Example #35
0
def PetPlanPetDetails(driver, wait, dtrow):
    try:
        time.sleep(2)
        wait.until(
            ec.visibility_of_element_located(
                (By.XPATH, '//*[@id="petTypeDogLabel[0]"]')))
        if 'Dog' in dtrow[1]:
            driver.find_element(*PetPlan_PetDetails.btn_Dog).click()
        else:
            driver.find_element(*PetPlan_PetDetails.btn_Cat).click()
        driver.find_element(*PetPlan_PetDetails.txt_PetName).clear()
        driver.find_element(*PetPlan_PetDetails.txt_PetName).send_keys('Tommy')
        if 'Male' in dtrow[4]:
            driver.find_element(*PetPlan_PetDetails.btn_Male).click()
        else:
            driver.find_element(*PetPlan_PetDetails.btn_Female).click()
        if 'Yes' in dtrow[5]:
            driver.find_element(*PetPlan_PetDetails.btn_Neutered_Yes).click()
        else:
            driver.find_element(*PetPlan_PetDetails.btn_Neutered_No).click()
        driver.find_element(
            *PetPlan_PetDetails.btn_PreviouslyInjured_No).click()
        if 'Dog' in dtrow[1]:
            if 'Small' in dtrow[2]:
                driver.find_element(*PetPlan_PetDetails.btn_Dog_Mixed).click()
            elif 'Medium' in dtrow[2]:
                driver.find_element(*PetPlan_PetDetails.btn_Dog_Mixed).click()
            elif 'Large' in dtrow[2]:
                driver.find_element(*PetPlan_PetDetails.btn_Dog_Mixed).click()
            else:
                driver.find_element(
                    *PetPlan_PetDetails.btn_Dog_Pedigree).click()
        if 'Small' in dtrow[2]:
            driver.find_element(
                *PetPlan_PetDetails.btn_Dog_Mixed_Small).click()
        elif 'Medium' in dtrow[2]:
            driver.find_element(
                *PetPlan_PetDetails.btn_Dog_Mixed_Medium).click()
        elif 'Large' in dtrow[2]:
            driver.find_element(
                *PetPlan_PetDetails.btn_Dog_Mixed_Large).click()
        else:
            if 'Dog' in dtrow[1]:
                wait.until(
                    ec.visibility_of_element_located(
                        (By.XPATH, '//*[@id="pedigreeBreed[0]"]')))
                driver.find_element(*PetPlan_PetDetails.txt_Dog_Breed).clear()
                driver.find_element(
                    *PetPlan_PetDetails.txt_Dog_Breed).send_keys(dtrow[2])
            else:
                if 'Moggie' in dtrow[2]:
                    driver.find_element(
                        *PetPlan_PetDetails.txt_Cat_Breed).clear()
                    driver.find_element(
                        *PetPlan_PetDetails.txt_Cat_Breed).send_keys('Moggy')
                else:
                    driver.find_element(
                        *PetPlan_PetDetails.txt_Cat_Breed).clear()
                    driver.find_element(
                        *PetPlan_PetDetails.txt_Cat_Breed).send_keys(dtrow[2])
        petDob = BirthdayFromAge(dtrow[3])
        Day = str(petDob.strftime('%d'))
        if Day.startswith('0'):
            Day = Day.replace('0', '')
        Month = str(petDob.strftime('%m'))
        if Month.startswith('0'):
            Month = Month.replace('0', '')
        Year = str(petDob.strftime('%Y'))
        selectDay = Select(driver.find_element(*PetPlan_PetDetails.Select_Day))
        selectMonth = Select(
            driver.find_element(*PetPlan_PetDetails.Select_Month))
        selectYear = Select(
            driver.find_element(*PetPlan_PetDetails.Select_Year))
        selectYear.select_by_value('number:' + Year)
        selectMonth.select_by_value('number:' + Month)
        selectDay.select_by_value(Day)
        if 'Dog' in dtrow[1]:
            driver.find_element(
                *PetPlan_PetDetails.check_Dog_Behaviour).click()
            driver.find_element(*PetPlan_PetDetails.check_Dog_Attack).click()
            driver.find_element(*PetPlan_PetDetails.check_Dog_Guard).click()
            driver.find_element(*PetPlan_PetDetails.check_Dog_Alcohol).click()
            driver.find_element(*PetPlan_PetDetails.check_Dog_NoWork).click()
            driver.find_element(*PetPlan_PetDetails.btn_Dog_Continue).click()
            try:
                wait.until(
                    ec.visibility_of_element_located(
                        (By.XPATH, '//*[@id="title"]')))
            except:
                driver.find_element(
                    *PetPlan_PetDetails.check_Dog_Behaviour).click()
                driver.find_element(
                    *PetPlan_PetDetails.check_Dog_Attack).click()
                driver.find_element(
                    *PetPlan_PetDetails.check_Dog_Guard).click()
                driver.find_element(
                    *PetPlan_PetDetails.check_Dog_Alcohol).click()
                driver.find_element(
                    *PetPlan_PetDetails.check_Dog_NoWork).click()
                driver.find_element(
                    *PetPlan_PetDetails.btn_Dog_Continue).click()
        else:
            driver.find_element(*PetPlan_PetDetails.btn_Dog_Continue).click()

    except:
        print("Failure on details page")
        log("Failure to Generate")
Example #36
0
 def setGlass(self, new_glass):
     log('Drinks', '[EDIT]' + 'glass=' + new_glass + '|' + str(self))
     self.glass = new_glass
Example #37
0
def storeDrinkLibrary():
    file = open("DrinkRepo.txt", "w")
    for drink in DrinkLibrary:
        file.write(json.dumps(drink.__dict__) + '\n')
    file.close()
    log('Info', 'Saved Drink Library')
Example #38
0
def clientInRaw(arg):
    log(1, "[CLIENT] -> [BNC] " + arg.line)