Best JavaScript code snippet using tracetest
reshape_data.py
Source:reshape_data.py
1import csv2outFile = csv.writer(open("data/HAI_all_years.csv", "wb"))3years = ["2013", "2006", "2000"]4data = {}5for year in years:6 if year == "2000":7 cr = csv.reader(open("data/source/HAI_COMMS_2000_Final_Map_Output.csv", "rU"))8 head = cr.next()9 i = 010 indices = {}11 for h in head:12 indices[h] = i13 i+= 114 for row in cr:15 fips = row[indices["county"]]16 if fips not in data:17 data[fips] = {"name":"", "2000":{"scalar":"","hud":"","maxELI":"", "minELI":"", "ami":"","usdaOn_hudOn":"","usdaOn_hudOff":"","usdaOff_hudOn":"","usdaOff_hudOff":"","totalPop":"","usdaOn_hudOnNum":"","usdaOn_hudOffNum":"","usdaOff_hudOnNum":"", "usdaOff_hudOffNum":"","flag":""}, "2006":{"scalar":"","usda":"", "hud":"", "maxELI":"", "minELI":"", "ami":"","usdaOn_hudOn":"","usdaOn_hudOff":"","usdaOff_hudOn":"","usdaOff_hudOff":"","totalPop":"","usdaOn_hudOnNum":"","usdaOn_hudOffNum":"","usdaOff_hudOnNum":"", "usdaOff_hudOffNum":"","flag":""}, "2013": {"scalar":"","usda":"", "hud":"", "maxELI":"", "minELI":"", "ami":"","usdaOn_hudOn":"","usdaOn_hudOff":"","usdaOff_hudOn":"","usdaOff_hudOff":"","totalPop":"","usdaOn_hudOnNum":"","usdaOn_hudOffNum":"","usdaOff_hudOnNum":"", "usdaOff_hudOffNum":"","flag":""}}18 flag = row[indices["state_flag"]]19 if flag == "0":20 data[fips][year]["flag"] = flag21 else:22 data[fips][year]["flag"] = "1"23 data[fips]["FIPS"] = fips24 if flag == "0":25 p100 = float(row[indices["per100"]])26 if p100 > 100:27 data[fips][year]["scalar"] = 100.0 / p10028 else:29 data[fips][year]["scalar"] = 130 data[fips][year]["usdaOn_hudOn"] = p10031 data[fips][year]["usdaOn_hudOff"] = p100 - float(row[indices["hudper100"]])32 data[fips][year]["usdaOff_hudOn"] = p100 - float(row[indices["USDAper100"]])33 data[fips][year]["usdaOff_hudOff"] = float(row[indices["per100_no_assisted"]])34 data[fips][year]["totalPop"] = row[indices["Total"]]35 data[fips][year]["usdaOn_hudOnNum"] = row[indices["units"]]36 data[fips][year]["usdaOn_hudOffNum"] = row[indices["Units_No_HUD"]]37 data[fips][year]["usdaOff_hudOnNum"] = row[indices["Units_no_usda"]]38 data[fips][year]["usdaOff_hudOffNum"] = row[indices["Unitsnoasst"]]39 data[fips][year]["hud"] = 040 data[fips][year]["usda"] = 041 data[fips][year]["maxELI"] = row[indices["l30_4"]]42 data[fips][year]["minELI"] = row[indices["l30_4"]]43 data[fips][year]["ami"] = row[indices["l30_4"]]44 elif row[indices["ST_Units"]] != "":45 p100 = float(row[indices["ST_per100"]])46 if p100 > 100:47 data[fips][year]["scalar"] = 100.0 / p10048 else:49 data[fips][year]["scalar"] = 150 data[fips][year]["usdaOn_hudOn"] = p10051 data[fips][year]["usdaOn_hudOff"] = p100 - float(row[indices["ST_Hudper100"]])52 data[fips][year]["usdaOff_hudOn"] = p100 - float(row[indices["ST_USDAper100"]])53 data[fips][year]["usdaOff_hudOff"] = float(row[indices["ST_per100_No_Assisted"]])54 data[fips][year]["totalPop"] = row[indices["ST_Total"]]55 data[fips][year]["usdaOn_hudOnNum"] = row[indices["ST_Units"]]56 data[fips][year]["usdaOn_hudOffNum"] = row[indices["ST_Units_No_HUD"]]57 data[fips][year]["usdaOff_hudOnNum"] = row[indices["ST_Units_no_USDA"]]58 data[fips][year]["usdaOff_hudOffNum"] = row[indices["ST_Unitsnoasst"]]59 data[fips][year]["hud"] = 060 data[fips][year]["usda"] = 061 data[fips][year]["maxELI"] = row[indices["MaxEli"]]62 data[fips][year]["minELI"] = row[indices["MinEli"]]63 elif year == "2006":64 cr = csv.reader(open("data/source/HAI_COMMS_2007_Final_Map_Output.csv", "rU"))65 head = cr.next()66 i = 067 indices = {}68 for h in head:69 indices[h] = i70 i+= 171 for row in cr:72 fips = row[indices["county"]]73 if fips not in data:74 data[fips] = {"name":"", "2000":{"scalar":"","hud":"","maxELI":"", "minELI":"", "ami":"","usdaOn_hudOn":"","usdaOn_hudOff":"","usdaOff_hudOn":"","usdaOff_hudOff":"","totalPop":"","usdaOn_hudOnNum":"","usdaOn_hudOffNum":"","usdaOff_hudOnNum":"", "usdaOff_hudOffNum":"","flag":""}, "2006":{"scalar":"","usda":"", "hud":"", "maxELI":"", "minELI":"", "ami":"","usdaOn_hudOn":"","usdaOn_hudOff":"","usdaOff_hudOn":"","usdaOff_hudOff":"","totalPop":"","usdaOn_hudOnNum":"","usdaOn_hudOffNum":"","usdaOff_hudOnNum":"", "usdaOff_hudOffNum":"","flag":""}, "2013": {"scalar":"","usda":"", "hud":"", "maxELI":"", "minELI":"", "ami":"","usdaOn_hudOn":"","usdaOn_hudOff":"","usdaOff_hudOn":"","usdaOff_hudOff":"","totalPop":"","usdaOn_hudOnNum":"","usdaOn_hudOffNum":"","usdaOff_hudOnNum":"", "usdaOff_hudOffNum":"","flag":""}}75 # if year == "2013":76 # ignore = row[indices["Unweighted ELI obs < 10"]]77 # state = row[indices["State Name"]]78 # name = row[indices["County Name"]]79 # data[fips]["state"] = state80 # data[fips]["name"] = name81 flag = row[indices["state_flag"]]82 if flag == "0":83 data[fips][year]["flag"] = flag84 else:85 data[fips][year]["flag"] = "1"86 data[fips]["FIPS"] = fips87 if flag == "0":88 p100 = float(row[indices["per100"]])89 if p100 > 100:90 data[fips][year]["scalar"] = 100.0 / p10091 else:92 data[fips][year]["scalar"] = 193 data[fips][year]["usdaOn_hudOn"] = p10094 data[fips][year]["usdaOn_hudOff"] = p100 - float(row[indices["hudper100"]])95 data[fips][year]["usdaOff_hudOn"] = p100 - float(row[indices["USDAper100"]])96 data[fips][year]["usdaOff_hudOff"] = float(row[indices["per100_no_assisted"]])97 data[fips][year]["totalPop"] = row[indices["Total"]]98 data[fips][year]["usdaOn_hudOnNum"] = row[indices["units"]]99 data[fips][year]["usdaOn_hudOffNum"] = row[indices["Units_No_HUD"]]100 data[fips][year]["usdaOff_hudOnNum"] = row[indices["Units_no_usda"]]101 data[fips][year]["usdaOff_hudOffNum"] = row[indices["Unitsnoasst"]]102 data[fips][year]["hud"] = 0103 data[fips][year]["usda"] = 0104 data[fips][year]["maxELI"] = row[indices["l30_4"]]105 data[fips][year]["minELI"] = row[indices["l30_4"]]106 data[fips][year]["ami"] = row[indices["l30_4"]]107 elif row[indices["ST_Units"]] != "":108 p100 = float(row[indices["ST_per100"]])109 if p100 > 100:110 data[fips][year]["scalar"] = 100.0 / p100111 else:112 data[fips][year]["scalar"] = 1113 data[fips][year]["usdaOn_hudOn"] = p100114 data[fips][year]["usdaOn_hudOff"] = p100 - float(row[indices["ST_Hudper100"]])115 data[fips][year]["usdaOff_hudOn"] = p100 - float(row[indices["ST_USDAper100"]])116 data[fips][year]["usdaOff_hudOff"] = float(row[indices["ST_per100_No_Assisted"]])117 data[fips][year]["totalPop"] = row[indices["ST_Total"]]118 data[fips][year]["usdaOn_hudOnNum"] = row[indices["ST_Units"]]119 data[fips][year]["usdaOn_hudOffNum"] = row[indices["ST_Units_No_HUD"]]120 data[fips][year]["usdaOff_hudOnNum"] = row[indices["ST_Units_no_USDA"]]121 data[fips][year]["usdaOff_hudOffNum"] = row[indices["ST_Unitsnoasst"]]122 data[fips][year]["hud"] = 0123 data[fips][year]["usda"] = 0124 data[fips][year]["maxELI"] = row[indices["MaxEli"]]125 data[fips][year]["minELI"] = row[indices["MinEli"]]126 127 elif year == "2013":128 cr = csv.reader(open("data/source/HAI_COMMS_2012_Final_Map_Output.csv", "rU"))129 head = cr.next()130 i = 0131 indices = {}132 for h in head:133 indices[h] = i134 i+= 1135 print indices136 for row in cr:137 fips = row[indices["county"]]138 if fips not in data:139 data[fips] = {"name":"", "2000":{"scalar":"","hud":"","maxELI":"", "minELI":"", "ami":"","usdaOn_hudOn":"","usdaOn_hudOff":"","usdaOff_hudOn":"","usdaOff_hudOff":"","totalPop":"","usdaOn_hudOnNum":"","usdaOn_hudOffNum":"","usdaOff_hudOnNum":"", "usdaOff_hudOffNum":"","flag":""}, "2006":{"scalar":"","usda":"", "hud":"", "maxELI":"", "minELI":"", "ami":"","usdaOn_hudOn":"","usdaOn_hudOff":"","usdaOff_hudOn":"","usdaOff_hudOff":"","totalPop":"","usdaOn_hudOnNum":"","usdaOn_hudOffNum":"","usdaOff_hudOnNum":"", "usdaOff_hudOffNum":"","flag":""}, "2013": {"scalar":"","usda":"", "hud":"", "maxELI":"", "minELI":"", "ami":"","usdaOn_hudOn":"","usdaOn_hudOff":"","usdaOff_hudOn":"","usdaOff_hudOff":"","totalPop":"","usdaOn_hudOnNum":"","usdaOn_hudOffNum":"","usdaOff_hudOnNum":"", "usdaOff_hudOffNum":"","flag":""}}140 # ignore = 0141 # state = row[indices["State Name"]]142 name = row[indices["countyname"]]143 data[fips]["name"] = name144 flag = row[indices["state_flag"]]145 if flag == "0":146 data[fips][year]["flag"] = flag147 else:148 data[fips][year]["flag"] = "1"149 data[fips]["FIPS"] = fips150 if flag == "0":151 p100 = float(row[indices["per100"]])152 if p100 > 100:153 data[fips][year]["scalar"] = 100.0 / p100154 else:155 data[fips][year]["scalar"] = 1156 data[fips][year]["usdaOn_hudOn"] = p100157 data[fips][year]["usdaOn_hudOff"] = p100 - float(row[indices["hudper100"]])158 data[fips][year]["usdaOff_hudOn"] = p100 - float(row[indices["USDAper100"]])159 data[fips][year]["usdaOff_hudOff"] = float(row[indices["per100_no_assisted"]])160 data[fips][year]["totalPop"] = row[indices["Total"]]161 data[fips][year]["usdaOn_hudOnNum"] = row[indices["units"]]162 data[fips][year]["usdaOn_hudOffNum"] = row[indices["Units_No_HUD"]]163 data[fips][year]["usdaOff_hudOnNum"] = row[indices["Units_no_usda"]]164 data[fips][year]["usdaOff_hudOffNum"] = row[indices["Unitsnoasst"]]165 data[fips][year]["hud"] = 0166 data[fips][year]["usda"] = 0167 data[fips][year]["maxELI"] = row[indices["l30_4"]]168 data[fips][year]["minELI"] = row[indices["l30_4"]]169 data[fips][year]["ami"] = row[indices["l30_4"]]170 elif row[indices["ST_Units"]] != "":171 p100 = float(row[indices["ST_per100"]])172 if p100 > 100:173 data[fips][year]["scalar"] = 100.0 / p100174 else:175 data[fips][year]["scalar"] = 1176 data[fips][year]["usdaOn_hudOn"] = p100177 data[fips][year]["usdaOn_hudOff"] = p100 - float(row[indices["ST_Hudper100"]])178 data[fips][year]["usdaOff_hudOn"] = p100 - float(row[indices["ST_USDAper100"]])179 data[fips][year]["usdaOff_hudOff"] = float(row[indices["ST_per100_No_Assisted"]])180 data[fips][year]["totalPop"] = row[indices["ST_Total"]]181 data[fips][year]["usdaOn_hudOnNum"] = row[indices["ST_Units"]]182 data[fips][year]["usdaOn_hudOffNum"] = row[indices["ST_Units_No_HUD"]]183 data[fips][year]["usdaOff_hudOnNum"] = row[indices["ST_Units_no_USDA"]]184 data[fips][year]["usdaOff_hudOffNum"] = row[indices["ST_Unitsnoasst"]]185 data[fips][year]["hud"] = 0186 data[fips][year]["usda"] = 0187 data[fips][year]["maxELI"] = row[indices["MaxEli"]]188 data[fips][year]["minELI"] = row[indices["MinEli"]]189 190outFile.writerow(["FIPS", "flagged", "name", "ami2000","ami2006","ami2013", "usdaOnhudOn2000","usdaOnhudOff2000","usdaOffhudOn2000","usdaOffhudOff2000","totalPop2000", "usdaOnhudOnNum2000","usdaOnhudOffNum2000","usdaOffhudOnNum2000","usdaOffhudOffNum2000", "usdaOnhudOn2006","usdaOnhudOff2006","usdaOffhudOn2006","usdaOffhudOff2006","totalPop2006", "usdaOnhudOnNum2006","usdaOnhudOffNum2006","usdaOffhudOnNum2006","usdaOffhudOffNum2006", "usdaOnhudOn2013","usdaOnhudOff2013","usdaOffhudOn2013","usdaOffhudOff2013","totalPop2013", "usdaOnhudOnNum2013","usdaOnhudOffNum2013","usdaOffhudOnNum2013","usdaOffhudOffNum2013","maxELI2000","minELI2000","maxELI2006","minELI2006","maxELI2013","minELI2013","hud2000","hud2006","hud2013","usda2006","usda2013","scalar2000","scalar2006","scalar2013"])191for fips in data:192 d = data[fips]...
off-canvas.es6.js
Source:off-canvas.es6.js
...55 * @param {jQuery} $element56 * The target element.57 */58 removeOffCanvasEvents($element) {59 $element.off('.off-canvas');60 $(document).off('.off-canvas');61 $(window).off('.off-canvas');62 },63 /**64 * Handler fired before an off-canvas dialog has been opened.65 *66 * @param {Object} settings67 * Settings related to the composition of the dialog.68 *69 * @return {undefined}70 */71 beforeCreate({ settings, $element }) {72 // Clean up previous dialog event handlers.73 Drupal.offCanvas.removeOffCanvasEvents($element);74 $('body').addClass('js-off-canvas-dialog-open');75 // @see http://api.jqueryui.com/position/...
off-canvas.js
Source:off-canvas.js
...13 isOffCanvas: function isOffCanvas($element) {14 return $element.is('#drupal-off-canvas');15 },16 removeOffCanvasEvents: function removeOffCanvasEvents($element) {17 $element.off('.off-canvas');18 $(document).off('.off-canvas');19 $(window).off('.off-canvas');20 },21 beforeCreate: function beforeCreate(_ref) {22 var settings = _ref.settings,23 $element = _ref.$element;24 Drupal.offCanvas.removeOffCanvasEvents($element);25 $('body').addClass('js-off-canvas-dialog-open');26 settings.position = {27 my: 'left top',28 at: Drupal.offCanvas.getEdge() + ' top',29 of: window30 };31 var position = settings.drupalOffCanvasPosition;32 var height = position === 'side' ? $(window).height() : settings.height;33 var width = position === 'side' ? settings.width : '100%';...
test_off.py
Source:test_off.py
1@app.route('/editOffDay', methods=['GET', 'POST'])2def off_day():3 global clinic_id4 create_user_form = OffDay(request.form)5 if request.method == 'POST':6 off_day_dict= {}7 od_db = shelve.open('clinic_od_storage.db', 'c')8 try:9 off_day_dict = od_db[clinic_id]10 except:11 print("Error in retrieving Users from storage.db.")12 clinic_od = Clinic.OffDay(create_user_form.start.data, create_user_form.end.data, create_user_form.reason.data)13 off_day_dict[clinic_od.get_id()] = clinic_od14 od_db[clinic_id] = off_day_dict15 print(clinic_id, "was stored in storage.db successfully with Clinic ID =", clinic_od.get_start())16 od_db.close()17 return redirect(url_for('retrieve_off_day'))18 return render_template('createOffDay.html', form=create_user_form)19@app.route('/retrieveOffDay')20def retrieve_off_day():21 global clinic_id22 off_day_dict = {}23 try:24 od_db = shelve.open('clinic_od_storage.db', 'r')25 off_day_dict = od_db[clinic_id] #have the dict of the operating hours26 od_db.close()27 except:28 od_db = {}29 # off_day_dict = od_db[clinic_id] #have the dict of the operating hours30 return render_template('retrieveOffDay.html', off_day_dict=off_day_dict)31@app.route('/updateOffDay/<int:id>/', methods=['GET', 'POST'])32def update_off_day(id):33 update_user_form = OffDay(request.form)34 global clinic_id35 if request.method == 'POST':36 od_db = shelve.open('clinic_od_storage.db', 'w')37 off_day_dict = od_db[clinic_id]38 off_day = off_day_dict[id]39 off_day.set_start(update_user_form.start.data)40 off_day.set_end(update_user_form.end.data)41 off_day.set_reason(update_user_form.reason.data)42 # clinic_od = Clinic.OffDay(update_user_form.start.data, update_user_form.end.data, update_user_form.reason.data)43 # period = [clinic_od.get_start(), clinic_od.get_end(), clinic_od.get_reason()]44 # off_day_dict[clinic_od.get_start()] = period45 od_db[clinic_id] = off_day_dict46 od_db.close()47 return redirect(url_for('retrieve_off_day'))48 else:49 off_day_dict = {}50 od_db = shelve.open('clinic_od_storage.db', 'w')51 off_day_dict = od_db[clinic_id] #have the dict of the operating hours52 od_db.close()53 off_day = off_day_dict[id]54 update_user_form.start.data = off_day.get_start()55 update_user_form.end.data = off_day.get_end()56 update_user_form.reason.data = off_day.get_reason()57 return render_template('updateOffDay.html', form=update_user_form)58@app.route('/deleteOffDay/<int:id>/', methods=['POST', 'GET'])59def delete_off_day(id):60 global clinic_id61 off_day_dict = {}62 try:63 od_db = shelve.open('clinic_od_storage.db', 'w')64 off_day_dict = od_db[clinic_id]65 except:66 print("Error in retrieving Users from storage.db.")67 print('hi this is start =',id)68 if id in off_day_dict:69 off_day_dict.pop(id)70 for i in off_day_dict:71 print(i)72 od_db[clinic_id] = off_day_dict73 od_db.close()74class OffDay:75 count_id = 076 def __init__(self, start, end, reason):77 OffDay.count_id +=178 self.__id = OffDay.count_id79 self.__start = start80 self.__end = end81 self.__reason = reason82 def set_id(self, id):83 self.__id = id84 def get_id(self):85 return self.__id86 def set_start(self, start):87 self.__start = start88 def get_start(self):89 return self.__start90 def set_end(self, end):91 self.__end = end92 def get_end(self):93 return self.__end94 def set_reason(self, reason):95 self.__reason = reason96 def get_reason(self):97 return self.__reason98{% extends "base.html" %}99{% block title %}Library Loan System - Retrieve Users{% endblock %}100{% block content %}101<section>102<h1 class="display-4">Retrieve Off Day</h1>103<div>104<table class="table table-striped">105 <title>Off Days</title>106 <thead>107 <tr>108 <th>Start</th>109 <th>End</th>110 <th>Reason/Message</th>111 <th></th>112 <th><a href="/editOffDay" class="btn btn-warning">Add</a></th>113 </tr>114 </thead>115 <tbody>116 {% for id in off_day_dict %}117 <tr>118 <td>{{ off_day_dict[id].get_start() }}</td>119 <td>{{ off_day_dict[id].get_end() }}</td>120 <td>{{ off_day_dict[id].get_reason() }}</td>121 <td><a href="/updateOffDay/{{ id }}/" class="btn btn-warning">Update</a></td>122 <td>123 <form action="{{url_for('delete_off_day', id=off_day_dict[id].get_id())}}" method="POST">124 <input type="submit" value="Delete" class="btn btn-danger">125 </form>126 </td>127 </tr>128 {% endfor %}129 </tbody>130 </table>131</div>132</section>...
bug-1431353.js
Source:bug-1431353.js
1// |jit-test| skip-if: helperThreadCount() === 02// Test multiple concurrent off-thread parse jobs.3function assertFails(f) {4 let failed = false;5 try {6 f();7 } catch (e) {8 failed = true;9 }10 assertEq(failed, true);11}12function encodeScript(source)13{14 let entry = cacheEntry(source);15 let global = newGlobal({ cloneSingletons: true });16 evaluate(entry, { global: global, saveBytecode: true });17 return entry;18}19let a, b, c;20// Calling run functions without arguments assumes a single off-thread job.21// Test run functions fail when no jobs exist.22assertFails(() => runOffThreadScript());23assertFails(() => finishOffThreadModule());24assertFails(() => runOffThreadDecodedScript());25// Test run functions fail when multiple jobs exist and no ID specified.26a = offThreadCompileScript("");27b = offThreadCompileScript("");28assertFails(() => runOffThreadScript());29runOffThreadScript(a);30runOffThreadScript(b);31a = offThreadCompileModule("");32b = offThreadCompileModule("");33assertFails(() => finishOffThreadModule());34finishOffThreadModule(a);35finishOffThreadModule(b);36a = offThreadDecodeScript(encodeScript(""));37b = offThreadDecodeScript(encodeScript(""));38assertFails(() => runOffThreadScript());39runOffThreadDecodedScript(a);40runOffThreadDecodedScript(b);41// Test fun functions succeed when a single job exist and no ID specified.42offThreadCompileScript("42");43assertEq(runOffThreadScript(), 42);44offThreadCompileModule("");45assertEq(typeof finishOffThreadModule(), "object");46offThreadDecodeScript(encodeScript("23"));47assertEq(runOffThreadDecodedScript(), 23);48// Run functions take an ID argument returned from the compile function.49// Test bad ID type and unknown ID.50offThreadCompileScript("");51assertFails(() => runOffThreadScript("foo"));52assertFails(() => runOffThreadScript(42));53runOffThreadScript();54offThreadCompileModule("");55assertFails(() => finishOffThreadModule("foo"));56assertFails(() => finishOffThreadModule(42));57finishOffThreadModule();58offThreadDecodeScript(encodeScript(""));59assertFails(() => runOffThreadDecodedScript("foo"));60assertFails(() => runOffThreadDecodedScript(42));61runOffThreadDecodedScript();62// Test stale ID.63a = offThreadCompileScript("");64runOffThreadScript(a);65assertFails(() => runOffThreadScript(a));66a = offThreadCompileModule("");67finishOffThreadModule(a);68assertFails(() => finishOffThreadModule(a));69a = offThreadDecodeScript(encodeScript(""));70runOffThreadDecodedScript(a);71assertFails(() => runOffThreadDecodedScript(a));72// Test wrong job kind.73a = offThreadCompileScript("");74b = offThreadCompileModule("");75c = offThreadDecodeScript(encodeScript(""));76assertFails(() => runOffThreadScript(b));77assertFails(() => runOffThreadScript(c));78assertFails(() => finishOffThreadModule(a));79assertFails(() => finishOffThreadModule(c));80assertFails(() => runOffThreadDecodedScript(a));81assertFails(() => runOffThreadDecodedScript(b));82runOffThreadScript(a);83finishOffThreadModule(b);84runOffThreadDecodedScript(c);85// Test running multiple jobs.86a = offThreadCompileScript("1");87b = offThreadCompileScript("2");88assertEq(runOffThreadScript(a), 1);89assertEq(runOffThreadScript(b), 2);90a = offThreadCompileModule("");91b = offThreadCompileModule("");92assertEq(typeof finishOffThreadModule(a), "object");93assertEq(typeof finishOffThreadModule(b), "object");94a = offThreadDecodeScript(encodeScript("3"));95b = offThreadDecodeScript(encodeScript("4"));96assertEq(runOffThreadDecodedScript(a), 3);97assertEq(runOffThreadDecodedScript(b), 4);98// Test many jobs.99const count = 100;100let jobs;101jobs = new Array(count);102for (let i = 0; i < jobs.length; i++)103 jobs[i] = offThreadCompileScript(`${i} * ${i}`);104for (let i = 0; i < jobs.length; i++)105 assertEq(runOffThreadScript(jobs[i]), i * i);106jobs = new Array(count);107for (let i = 0; i < jobs.length; i++)108 jobs[i] = offThreadCompileModule("");109for (let i = 0; i < jobs.length; i++)110 assertEq(typeof finishOffThreadModule(jobs[i]), "object");111jobs = new Array(count);112for (let i = 0; i < jobs.length; i++)113 jobs[i] = offThreadDecodeScript(encodeScript(`${i} * ${i}`));114for (let i = 0; i < jobs.length; i++)...
no-layout-rules.js
Source:no-layout-rules.js
1/*2 * IMPORTANT!3 * This file has been automatically generated,4 * in order to update it's content execute "npm run update"5 */6module.exports = {7 rules: {8 'vue/array-bracket-newline': 'off',9 'vue/array-bracket-spacing': 'off',10 'vue/arrow-spacing': 'off',11 'vue/block-spacing': 'off',12 'vue/block-tag-newline': 'off',13 'vue/brace-style': 'off',14 'vue/comma-dangle': 'off',15 'vue/comma-spacing': 'off',16 'vue/comma-style': 'off',17 'vue/dot-location': 'off',18 'vue/func-call-spacing': 'off',19 'vue/html-closing-bracket-newline': 'off',20 'vue/html-closing-bracket-spacing': 'off',21 'vue/html-comment-content-newline': 'off',22 'vue/html-comment-content-spacing': 'off',23 'vue/html-comment-indent': 'off',24 'vue/html-indent': 'off',25 'vue/html-quotes': 'off',26 'vue/html-self-closing': 'off',27 'vue/key-spacing': 'off',28 'vue/keyword-spacing': 'off',29 'vue/max-attributes-per-line': 'off',30 'vue/max-len': 'off',31 'vue/multiline-html-element-content-newline': 'off',32 'vue/mustache-interpolation-spacing': 'off',33 'vue/new-line-between-multi-line-property': 'off',34 'vue/no-extra-parens': 'off',35 'vue/no-multi-spaces': 'off',36 'vue/no-spaces-around-equal-signs-in-attribute': 'off',37 'vue/object-curly-newline': 'off',38 'vue/object-curly-spacing': 'off',39 'vue/object-property-newline': 'off',40 'vue/operator-linebreak': 'off',41 'vue/padding-line-between-blocks': 'off',42 'vue/script-indent': 'off',43 'vue/singleline-html-element-content-newline': 'off',44 'vue/space-in-parens': 'off',45 'vue/space-infix-ops': 'off',46 'vue/space-unary-ops': 'off',47 'vue/template-curly-spacing': 'off',48 'vue/v-for-delimiter-style': 'off'49 }...
radvd_constants.py
Source:radvd_constants.py
1#!/usr/bin/env python32#3# Copyright 2020 - Google4#5# Licensed under the Apache License, Version 2.0 (the "License");6# you may not use this file except in compliance with the License.7# You may obtain a copy of the License at8#9# http://www.apache.org/licenses/LICENSE-2.010#11# Unless required by applicable law or agreed to in writing, software12# distributed under the License is distributed on an "AS IS" BASIS,13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14# See the License for the specific language governing permissions and15# limitations under the License.16IGNORE_IF_MISSING_ON = 'on'17IGNORE_IF_MISSING_OFF = 'off'18ADV_SEND_ADVERT_ON = 'on'19ADV_SEND_ADVERT_OFF = 'off'20UNICAST_ONLY_ON = 'on'21UNICAST_ONLY_OFF = 'off'22ADV_MANAGED_FLAG_ON = 'on'23ADV_MANAGED_FLAG_OFF = 'off'24ADV_OTHER_CONFIG_FLAG_ON = 'on'25ADV_OTHER_CONFIG_FLAG_OFF = 'off'26ADV_DEFAULT_PREFERENCE_ON = 'on'27ADV_DEFAULT_PREFERENCE_OFF = 'off'28ADV_SOURCE_LL_ADDRESS_ON = 'on'29ADV_SOURCE_LL_ADDRESS_OFF = 'off'30ADV_HOME_AGENT_FLAG_ON = 'on'31ADV_HOME_AGENT_FLAG_OFF = 'off'32ADV_HOME_AGENT_INFO_ON = 'on'33ADV_HOME_AGENT_INFO_OFF = 'off'34ADV_MOB_RTR_SUPPORT_FLAG_ON = 'on'35ADV_MOB_RTR_SUPPORT_FLAG_OFF = 'off'36ADV_INTERVAL_OPT_ON = 'on'37ADV_INTERVAL_OPT_OFF = 'off'38ADV_ON_LINK_ON = 'on'39ADV_ON_LINK_OFF = 'off'40ADV_AUTONOMOUS_ON = 'on'41ADV_AUTONOMOUS_OFF = 'off'42ADV_ROUTER_ADDR_ON = 'on'43ADV_ROUTER_ADDR_OFF = 'off'44ADV_ROUTE_PREFERENCE_LOW = 'low'45ADV_ROUTE_PREFERENCE_MED = 'medium'46ADV_ROUTE_PREFERENCE_HIGH = 'high'47ADV_RDNSS_OPEN_ON = 'on'...
Using AI Code Generation
1var tracetest = require('./tracetest');2var obj = new tracetest();3obj.on('test', function() {4 console.log('test event occured');5});6obj.on('test', function() {7 console.log('test event occured again');8});9obj.emit('test');10obj.off('test');11obj.emit('test');12obj.removeAllListeners([event])13var tracetest = require('./tracetest');14var obj = new tracetest();15obj.on('test', function() {16 console.log('test event occured');17});18obj.on('test', function() {19 console.log('test event occured again');20});21obj.emit('test');22obj.removeAllListeners('test');23obj.emit('test');24obj.setMaxListeners(n)25var tracetest = require('./tracetest');26var obj = new tracetest();27obj.setMaxListeners(3);28obj.on('test', function() {29 console.log('test event occured');30});31obj.on('test', function() {32 console.log('test event occured again');33});34obj.on('test', function() {35 console.log('test event occured again again');36});37obj.on('test', function() {38 console.log('test event occured again again again');39});
Using AI Code Generation
1var tracetest = require('./tracetest');2var trace = new tracetest();3trace.on('test', function(arg1, arg2){4 console.log('test event emitted with arguments: ' + arg1 + ', ' + arg2);5});6trace.on('test', function(arg1, arg2){7 console.log('test event emitted with arguments: ' + arg1 + ', ' + arg2);8});9trace.off('test');10trace.emit('test', 'a', 'b');
Using AI Code Generation
1var tracetest = require('./tracetest');2var trace = tracetest.trace;3var off = tracetest.off;4trace('test');5off('test');6var events = require('events');7var eventEmitter = new events.EventEmitter();8var trace = function(msg) {9 console.log('Tracing: ' + msg);10 eventEmitter.emit('trace', msg);11};12var off = function(msg) {13 eventEmitter.removeAllListeners('trace');14};15exports.trace = trace;16exports.off = off;
Using AI Code Generation
1var tracetest = require('./tracetest');2function test() {3 var a = new tracetest();4 a.on('event', function() {5 console.log('event1');6 });7 a.on('event', function() {8 console.log('event2');9 });10 a.on('event', function() {11 console.log('event3');12 });13 a.on('event', function() {14 console.log('event4');15 });16 a.on('event', function() {17 console.log('event5');18 });19 a.on('event', function() {20 console.log('event6');21 });22 a.on('event', function() {23 console.log('event7');24 });25 a.on('event', function() {26 console.log('event8');27 });28 a.on('event', function() {29 console.log('event9');30 });31 a.on('event', function() {32 console.log('event10');33 });34 a.on('event', function() {35 console.log('event11');36 });37 a.on('event', function() {38 console.log('event12');39 });40 a.on('event', function() {41 console.log('event13');42 });43 a.on('event', function() {44 console.log('event14');45 });46 a.on('event', function() {47 console.log('event15');48 });49 a.on('event', function() {50 console.log('event16');51 });52 a.on('event', function() {53 console.log('event17');54 });55 a.on('event', function() {56 console.log('event18');57 });58 a.on('event', function() {59 console.log('event19');60 });61 a.on('event', function() {62 console.log('event20');63 });64 a.on('event', function() {65 console.log('event21');66 });67 a.on('event', function() {68 console.log('event22');69 });70 a.on('event', function() {71 console.log('event23');72 });73 a.on('event', function() {74 console.log('event24');75 });76 a.on('event', function() {77 console.log('event25');78 });79 a.on('event', function() {80 console.log('event26');81 });82 a.on('event', function
Using AI Code Generation
1var tracetest = require('./tracetest');2tracetest.off('trace', function() {3 console.log('trace event is off');4});5tracetest.emit('trace', 'trace event is off');6var events = require('events');7var util = require('util');8function tracetest() {9 events.EventEmitter.call(this);10}11util.inherits(tracetest, events.EventEmitter);12tracetest.prototype.trace = function(msg) {13 this.emit('trace', msg);14}15module.exports = new tracetest();16var tracetest = require('./tracetest');17tracetest.removeListener('trace', function() {18 console.log('trace event is off');19});20tracetest.emit('trace', 'trace event is off');21var events = require('events');22var util = require('util');23function tracetest() {24 events.EventEmitter.call(this);25}26util.inherits(tracetest, events.EventEmitter);27tracetest.prototype.trace = function(msg) {28 this.emit('trace', msg);29}30module.exports = new tracetest();31var tracetest = require('./tracetest');32tracetest.removeAllListeners('trace');33tracetest.emit('trace', 'trace event is off');34var events = require('events');35var util = require('util');36function tracetest() {37 events.EventEmitter.call(this);38}39util.inherits(tracetest, events.EventEmitter);40tracetest.prototype.trace = function(msg) {41 this.emit('trace', msg);42}43module.exports = new tracetest();44var tracetest = require('./tracetest');45tracetest.setMaxListeners(2);46tracetest.on('trace', function() {47 console.log('trace event is on');48});49tracetest.on('trace', function() {50 console.log('trace event is on');51});52tracetest.on('trace', function() {53 console.log('trace event is on');54});55tracetest.emit('trace', 'trace event is on');
Using AI Code Generation
1var trace = require('tracetest');2trace.on('data', function(data) {3 console.log(data);4});5trace.off('data');6trace.emit('data', 'hello world');7### .once(event, callback)8var trace = require('tracetest');9trace.once('data', function(data) {10 console.log(data);11});12trace.emit('data', 'hello world');13trace.emit('data', 'hello world');14### .removeAllListeners([event])15var trace = require('tracetest');16trace.on('data', function(data) {17 console.log(data);18});19trace.removeAllListeners();20trace.emit('data', 'hello world');21### .removeListener(event, callback)22var trace = require('tracetest');23var callback = function(data) {24 console.log(data);25}26trace.on('data', callback);27trace.removeListener('data', callback);28trace.emit('data', 'hello world');29### .setMaxListeners(n)30var trace = require('tracetest');31trace.setMaxListeners(20);32### .listeners(event)33var trace = require('tracetest');34var callback = function(data) {35 console.log(data);36}37trace.on('data', callback);38trace.on('data', callback);39trace.on('data', callback);40console.log(trace.listeners('data'));41### .listenerCount(event)42The `listenerCount()` method returns the
Using AI Code Generation
1var traceTest = require('tracetest');2var emitter = new traceTest.Emitter();3var listener = function(data){4 console.log(data);5}6emitter.on('event', listener);7emitter.emit('event', 'Hello World!');
Using AI Code Generation
1var tracetest = require('./tracetest.js');2tracetest.off('test');3### .on(eventname, callback)4var tracetest = require('./tracetest.js');5tracetest.on('test', function(eventname, data){6 console.log(eventname + " " + data);7});8### .once(eventname, callback)9var tracetest = require('./tracetest.js');10tracetest.once('test', function(eventname, data){11 console.log(eventname + " " + data);12});13### .removeAllListeners(eventname)
Using AI Code Generation
1var trace = require('trace');2trace.on();3trace.off();4trace('test');5###trace.on()6###trace.off()7###trace.trace()8###trace.list()9###trace.clear()10###trace.add(path)11###trace.remove(path)12###trace.set(path)13###trace.has(path)14###trace.get(path)15###trace.each(callback)16###trace.filter(callback)17###trace.map(callback)18###trace.reduce(callback, initialValue)19###trace.reduceRight(callback, initialValue)20###trace.some(callback)21Iterates through the list of paths being traced and calls the callback for each one. The callback is called with (path, index). If the callback returns true, then true is returned. If the callback returns false
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!!