Best Python code snippet using yandex-tank
Load_layout.py
Source:Load_layout.py
...22 td = data[i]23 data[i] = data[i+1]24 data[i+1] = td25 return data26def get_load_plan():27 f = "../Info/Load_Plan.txt"28 txt = open(f)29 data = []30 for line in txt:31 print "line", line32 destination = line[0:3];33 load = []34 center = []35 head = []36 tail = []37 load.append(destination)38 x = line[4:]39 end_door = x.index(":")40 door = x[0: end_door]41 load.append(door)42 x = x[end_door + 2:]43 number_destinations = line.count("/")44 load.append(0)45 load.append(0)46 load.append(0)47 load.append(0)48 for i in range (0, number_destinations):49 next = x.index("/")50 dt = x[0:next]51 if "Head" in dt:52 load[4] += 153 dt = dt[0: 3]54 head.append(dt)55 elif "Tail" in dt:56 load[5] += 157 dt = dt[0: 3]58 tail.append(dt)59 else:60 center.append(dt)61 x = x[next + 1:]62 for i in range (0, len(head)):63 load.append(head[i])64 for i in range (0, len(center)):65 load.append(center[i])66 for i in range (0, len(tail)):67 load.append(tail[i])68 print load69 data.append(load)70 return data71def weightANDhu(data):72 f = "../Info/incoming.txt"73 txt = open(f)74 for line in txt:75 for i in range (0, len(data)):76 for j in range (6, len(data[i])):77 if data[i][j] in line:78 wstart = 479 wend = line.index("/")80 data[i][2] += int(line[wstart: wend])81 huend = line.index("\n")82 data[i][3] += int(line[wend + 1: huend])83 84 return data85 86 87def erase_block(x,y,x2,y2):88 w = y - y289 y = y + w/290 print "x, x2, y, w: ", x, x2, y, w91 draw.line((x,y,x2,y), width = w, fill = (255,255,255));92 93 94def find_lowest_point(xy):95 maximum = 096 for i in range (1, len(xy)):97 if(xy[maximum][1] > xy[i][1] and xy[i][1] != 0):98 maximum = i99 return maximum, xy[maximum][0], xy[maximum][1]100 101def draw_square(x, y, fx, fy, w):102 draw.line((x,y,x ,fy), width = w, fill = (0,0,0));103 draw.line((x, y, fx,y ), width = w, fill = (0,0,0));104 draw.line((fx,fy , x, fy), width = w, fill = (0,0,0));105 draw.line((fx,fy,fx,y ), width = w, fill = (0,0,0)); 106 107#Data format {Destination, Door Number, Weight, Handling Units, Number of Head Load Destinations, Number of Tail Load Destinations, List of Destinations}108data = get_load_plan()109s = 1.5110data = weightANDhu(data)111data = sort_data(data)112size_bay_number_DT = int(s*25)113size_weight_hu = int(s*15)114size_dts = int(s*15)115tiny_size = int(s*10)116length = int(2*900)117width = int(4*300)118image = Image.new("RGBA", (length,width), (255,255,255))119draw = ImageDraw.Draw(image)120header_font = ImageFont.truetype("../TextFormats/FreeMonoOblique.ttf", size_bay_number_DT)121weight_font = ImageFont.truetype("../TextFormats/FreeMonoOblique.ttf", size_weight_hu)122dts_headTail_font = ImageFont.truetype("../TextFormats/FreeMonoBoldOblique.ttf", size_dts)...
stepper.py
Source:stepper.py
...5class AmmoFactory(object):6 '''Link generators, filters and markers together'''7 def __init__(self, factory):8 self.factory = factory9 self.load_plan = factory.get_load_plan()10 self.ammo_generator = factory.get_ammo_generator()11 self.filter = lambda missile: True12 self.marker = factory.get_marker()13 def __iter__(self):14 return (15 (timestamp, marker or self.marker(missile), missile)16 for timestamp, (missile, marker)17 in izip(self.load_plan, self.ammo_generator)18 )19 def __len__(self):20 #FIXME: wrong ammo count when loop_limit is set21 lp_len = len(self.load_plan)22 ammo_len = len(self.ammo_generator)23 return min(lp_len, ammo_len) or max(lp_len, ammo_len)...
process_califano.py
Source:process_califano.py
...21my_server, my_username, my_password, cytoscape_visual_properties_template_id = get_input_params()22#==================23# GET IMPORT PLAN24#==================25load_plan = get_load_plan('aracne-califano-plan.json')26#==================27# GET INPUT FILE28#==================29#df = get_input_dataframe('test-aracne.txt')30df = get_input_dataframe('regulonthca.txt')31network = t2n.convert_pandas_to_nice_cx_with_load_plan(df, load_plan)...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!