How to use not_included method in locust

Best Python code snippet using locust

models.py

Source:models.py Github

copy

Full Screen

1from django.db import models2from django.conf import settings3from user.models import User4class Food(models.Model):5 english_name = models.CharField(max_length=100)6 original_name = models.CharField(max_length=100)7 UNDECIDED = 'UD'8 NOT_INCLUDED = 'NA'9 # country choices10 KOREA = 'KR'11 JAPAN = 'JP'12 COUNTRY_CHOICES = [13 (KOREA, 'Korean'),14 (JAPAN, 'Japanese'),15 (NOT_INCLUDED, 'Not Applied'),16 (UNDECIDED, 'Not sure')17 ]18 country = models.CharField(19 max_length=2,20 choices=COUNTRY_CHOICES,21 default=UNDECIDED,22 )23 # color choices24 YELLOW = 'YL'25 RED = 'RD'26 BROWN = 'BR'27 BLACK = 'BL'28 COLOR_CHOICES = [29 (YELLOW, 'Yellow'),30 (RED, 'Red'),31 (BROWN, 'Brown'),32 (BLACK, 'Black'),33 (NOT_INCLUDED, 'Not Applied'),34 (UNDECIDED, 'Not sure')35 ]36 color = models.CharField(37 max_length=2,38 choices=COLOR_CHOICES,39 default=UNDECIDED,40 )41 # taste choices42 SWEET = 'SW'43 SPICY = 'SC'44 SOUR = 'SR'45 SALTY = 'SL'46 BITTER = 'BT'47 TASTE_CHOICES = [48 (SWEET, 'Sweet'),49 (SPICY, 'Spicy'),50 (SOUR, 'Sour'),51 (SALTY, 'Salty'),52 (BITTER, 'Bitter'),53 (NOT_INCLUDED, 'Not Applied'),54 (UNDECIDED, 'Not sure'),55 ]56 taste = models.CharField(57 max_length=2,58 choices=TASTE_CHOICES,59 default=UNDECIDED,60 )61 # protein choices62 BEEF = 'BF'63 PORK = 'PR'64 FISH = 'FS'65 SHELLFISH = 'SF'66 CHICKEN = 'CK'67 VEGETARIAN = 'VG'68 PROTEIN_CHOICES = [69 (BEEF, 'Beef'),70 (PORK, 'Pork'),71 (SHELLFISH, 'Shell fish'),72 (FISH, 'Fish'),73 (VEGETARIAN, 'Vegetarian'),74 (CHICKEN, 'Chicken'),75 (NOT_INCLUDED, 'No Meat'),76 (UNDECIDED, 'Not sure'),77 ]78 protein = models.CharField(79 max_length=2,80 choices=PROTEIN_CHOICES,81 default=UNDECIDED,82 )83 # type choices (how the food being prepared)84 BOILED = 'BD'85 FRIED = 'FR'86 STEAMED = 'ST'87 BAKED = 'BE'88 BARBEQUE = 'BQ'89 RAW = 'RW'90 TYPE_CHOICES = [91 (BOILED, 'Boiled'),92 (FRIED, 'Fried'),93 (STEAMED, 'Steamed'),94 (BAKED, 'Baked'),95 (BARBEQUE, 'Barbeque'),96 (RAW, 'Raw'),97 (NOT_INCLUDED, 'Not Applied'),98 (UNDECIDED, 'Not sure'),99 ]100 type = models.CharField(101 max_length=2,102 choices=TYPE_CHOICES,103 default=UNDECIDED,104 )105 # Carbohydrates106 NOODLES = 'ND'107 RICE = 'RE'108 CAR_CHOICES = [109 (NOODLES, "Noodles"),110 (RICE, "Rice"),111 (NOT_INCLUDED, 'Not Applied'),112 (UNDECIDED, "Not sure"),113 ]114 carbohydrate = models.CharField(115 max_length=2,116 choices=CAR_CHOICES,117 default=UNDECIDED,118 )119 food_description = models.TextField(max_length=1000, blank=True)120 food_link = models.URLField(max_length=200, blank=True)121 food_image = models.ImageField(upload_to='food', blank=True)122 # list of descriptions for phase 2123 # descriptions = []124 def __str__(self):...

Full Screen

Full Screen

dijkstra.py

Source:dijkstra.py Github

copy

Full Screen

1def dijkstra(weight,source):2 included = {}3 not_included ={}4 for i in range(len(weight)):5 if i!=source:6 not_included[i]=2**31-17 else:8 not_included[i]=09 cur_weight = 010 while not_included:11 for j in range(len(weight)):12 if weight[source][j]!=0 and j not in included and cur_weight+weight[source][j] < not_included[j]:13 not_included[j]=cur_weight+weight[source][j]14 included[source] = not_included[source] 15 del not_included[source]16 if not_included:17 for key in sorted(not_included,key=not_included.get):18 source = key19 cur_weight = not_included[key]20 break21 for key in included:22 print key,included[key]23def main():24 weight = [[0,4,0,0,0,0,0,8,0],[4,0,8,0,0,0,0,11,0],[0,8,0,7,0,4,0,0,2],[0,0,7,0,9,14,0,0,0],[0,0,0,9,0,0,10,0,0,0],[0,0,4,14,10,0,2,0,0],[0,0,0,0,0,2,0,1,6],[8,11,0,0,0,0,1,0,7],[0,0,2,0,0,0,6,7,0]]25 dijkstra(weight,0)26 #for line in weight:27 #print line28if __name__=='__main__':...

Full Screen

Full Screen

main.py

Source:main.py Github

copy

Full Screen

1from fake_student.driver import Driver2from utils.scrapper import get_text 3from utils.process_text import get_rent4browser = Driver()5url = "https://markt.unibas.ch/category/wohnen-angebot"6listings = browser.get_all_listings(url)7browser.close()8price_to_apartment = []9not_included = []10for i,apartment in enumerate(listings):11 text = str(get_text(apartment))12 rent = get_rent(text)13 if not rent:14 not_included.append(apartment)15 else:16 price_to_apartment.append((rent, apartment))17 print("Done", i, "/", len(listings))18for x in not_included:19 print(x)20print(len(not_included))21# write the results we have to look them up22prices = sorted(price_to_apartment, key=lambda x: x[0])23with open("result.csv", "w") as f:24 for price in prices:25 if price[0] >= 300:26 f.write(str(price[0]) + "," + price[1]+"\n")27 for unknown in not_included:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run locust automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful