How to use add_labels method in autotest

Best Python code snippet using autotest_python Github


Full Screen

1#!/usr/bin/env python2def get_label_command_facts(issuewrapper, meta, module_indexer, core_team=[], valid_labels=[]):3 iw = issuewrapper4 add_labels = []5 del_labels = []6 namespace_labels = [7 u'aci',8 u'avi',9 u'aws',10 u'azure',11 u'cloud',12 u'cloudstack',13 u'digital_ocean',14 u'docker',15 u'f5',16 u'gce',17 u'infoblox',18 u'jboss',19 u'meraki',20 u'netapp',21 u'networking',22 u'nxos',23 u'openstack',24 u'ovirt',25 u'ucs',26 u'vmware',27 u'windows',28 ]29 whitelist = [30 u'docsite_pr',31 u'easyfix',32 u'module',33 u'needs_triage',34 u'needs_verified',35 u'test',36 ]37 whitelist += namespace_labels38 whitelist += [x for x in valid_labels if x.startswith(u'affects_')]39 whitelist += [x for x in valid_labels if x.startswith(u'c:')]40 whitelist += [x for x in valid_labels if x.startswith(u'm:')]41 iw = issuewrapper42 maintainers = [x for x in core_team]43 maintainers += module_indexer.all_maintainers44 maintainers = sorted(set(maintainers))45 # iterate through the description and comments and look for label commands46 for ev in iw.history.history:47 if ev[u'actor'] in maintainers and ev[u'event'] == u'commented':48 if u'+label' in ev[u'body'] or u'-label' in ev[u'body']:49 for line in ev[u'body'].split(u'\n'):50 if u'label' not in line:51 continue52 words = line.split()53 # if len(words) < 2:55 continue56 label = words[1]57 if label not in whitelist:58 continue59 action = words[0]60 if action == u'+label':61 add_labels.append(label)62 if label in del_labels:63 del_labels.remove(label)64 elif action == u'-label':65 del_labels.append(label)66 if label in add_labels:67 add_labels.remove(label)68 # prevent waffling on label actions69 # managed = sorted(set(add_labels + del_labels))71 for ml in managed:72 if iw.history.label_is_waffling(ml, limit=5):73 if ml in add_labels:74 add_labels.remove(ml)75 if ml in del_labels:76 del_labels.remove(ml)77 fact = {78 u'label_cmds': {79 u'add': add_labels,80 u'del': del_labels81 }82 }83 return fact84def get_waffling_overrides(issuewrapper, meta, module_indexer, core_team=[], valid_labels=[]):85 iw = issuewrapper86 overrides = []87 iw = issuewrapper88 maintainers = [x for x in core_team]89 maintainers += module_indexer.all_maintainers90 maintainers = sorted(set(maintainers))91 for ev in iw.history.history:92 if ev[u'actor'] in maintainers and ev[u'event'] == u'commented':93 if u'!waffling' in ev.get(u'body', u''):94 lines = ev[u'body'].split(u'\n')95 for line in lines:96 if line.strip().startswith(u'!waffling'):97 line = line.strip()98 parts = line.strip().split()99 thislabel = parts[1].strip()100 if thislabel not in overrides:101 overrides.append(thislabel)102 fact = {103 u'label_waffling_overrides': overrides104 }...

Full Screen

Full Screen Github


Full Screen

1"""Functions to visualize human poses"""2import matplotlib.pyplot as plt3import data_utils4import numpy as np5import h5py6import os7from mpl_toolkits.mplot3d import Axes3D8def show3Dpose(channels, ax, lcolor="#3498db", rcolor="#e74c3c", add_labels=False): # blue, orange9 """10 Visualize a 3d skeleton11 Args12 channels: 96x1 vector. The pose to plot.13 ax: matplotlib 3d axis to draw on14 lcolor: color for left part of the body15 rcolor: color for right part of the body16 add_labels: whether to add coordinate labels17 Returns18 Nothing. Draws on ax.19 """20 assert channels.size == len(data_utils.H36M_NAMES)*3, "channels should have 96 entries, it has %d instead" % channels.size21 vals = np.reshape( channels, (len(data_utils.H36M_NAMES), -1) )22 I = np.array([1,2,3,1,7,8,1, 13,14,15,14,18,19,14,26,27])-1 # start points23 J = np.array([2,3,4,7,8,9,13,14,15,16,18,19,20,26,27,28])-1 # end points24 LR = np.array([1,1,1,0,0,0,0, 0, 0, 0, 0, 0, 0, 1, 1, 1], dtype=bool)25 # Make connection matrix26 for i in np.arange( len(I) ):27 x, y, z = [np.array( [vals[I[i], j], vals[J[i], j]] ) for j in range(3)]28 #print (x, y, z)29 ax.plot(x, y, z, marker='o', markersize=2, lw=1, c=lcolor if LR[i] else rcolor)30 RADIUS = 750 # space around the subject31 xroot, yroot, zroot = vals[0,0], vals[0,1], vals[0,2]32 ax.set_xlim3d([-RADIUS+xroot, RADIUS+xroot])33 ax.set_zlim3d([-RADIUS+zroot, RADIUS+zroot])34 ax.set_ylim3d([-RADIUS+yroot, RADIUS+yroot])35 if add_labels:36 ax.set_xlabel("x")37 ax.set_ylabel("y")38 ax.set_zlabel("z")39 # Get rid of the ticks and tick labels40 ax.set_xticks([])41 ax.set_yticks([])42 ax.set_zticks([])43 ax.get_xaxis().set_ticklabels([])44 ax.get_yaxis().set_ticklabels([])45 ax.set_zticklabels([])46 ax.set_aspect('equal')47 # Get rid of the panes (actually, make them white)48 white = (1.0, 1.0, 0.1, 0.0)49 ax.w_xaxis.set_pane_color(white)50 ax.w_yaxis.set_pane_color(white)51 # Keep z pane52 # Get rid of the lines in 3d53 ax.w_xaxis.line.set_color(white)54 ax.w_yaxis.line.set_color(white)55 ax.w_zaxis.line.set_color(white)56 57def show2Dpose(channels, ax, lcolor="#3498db", rcolor="#e74c3c", add_labels=False):58 """59 Visualize a 2d skeleton60 Args61 channels: 64x1 vector. The pose to plot.62 ax: matplotlib axis to draw on63 lcolor: color for left part of the body64 rcolor: color for right part of the body65 add_labels: whether to add coordinate labels66 Returns67 Nothing. Draws on ax.68 """69 assert channels.size == len(data_utils.H36M_NAMES)*2, "channels should have 64 entries, it has %d instead" % channels.size70 vals = np.reshape( channels, (len(data_utils.H36M_NAMES), -1) )71 I = np.array([1,2,3,1,7,8,1, 13,14,14,18,19,14,26,27])-1 # start points72 J = np.array([2,3,4,7,8,9,13,14,16,18,19,20,26,27,28])-1 # end points73 LR = np.array([1,1,1,0,0,0,0, 0, 0, 0, 0, 0, 1, 1, 1], dtype=bool)74 # Make connection matrix75 for i in np.arange( len(I) ):76 x, y = [np.array( [vals[I[i], j], vals[J[i], j]] ) for j in range(2)]77 ax.plot(x, y, lw=2, c=lcolor if LR[i] else rcolor)78 # Get rid of the ticks79 ax.set_xticks([])80 ax.set_yticks([])81 # Get rid of tick labels82 ax.get_xaxis().set_ticklabels([])83 ax.get_yaxis().set_ticklabels([])84 RADIUS = 350 # space around the subject85 xroot, yroot = vals[0,0], vals[0,1]86 ax.set_xlim([-RADIUS+xroot, RADIUS+xroot])87 ax.set_ylim([-RADIUS+yroot, RADIUS+yroot])88 if add_labels:89 ax.set_xlabel("x")90 ax.set_ylabel("z")...

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:


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

Run autotest 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?