Best JavaScript code snippet using wpt
Conformance_Expressions.js
Source:Conformance_Expressions.js
...264expressionList[expressionList.length] = "*[substring-before('employeeId', 'Id')]";265expressionList[expressionList.length] = "*[substring-after('employeeId', 'employee')]";266expressionList[expressionList.length] = "*[substring('employeeId', 4)]";267expressionList[expressionList.length] = "*[substring('employeeId', 4, 5)]";268expressionList[expressionList.length] = "*[string-length()=2]";269expressionList[expressionList.length] = "*[string-length(.)=string-length(normalize-space(.))]";270expressionList[expressionList.length] = "*[translate('bar', 'abc', 'ABC')='BAr']";271expressionList[expressionList.length] = "*[boolean(.)]";272expressionList[expressionList.length] = "*[not(boolean(.))]";273expressionList[expressionList.length] = "*[true()]";274expressionList[expressionList.length] = "*[false()]";275expressionList[expressionList.length] = "*[lang('en')]";276expressionList[expressionList.length] = "*[number()]";277expressionList[expressionList.length] = "*[number('4')]";278expressionList[expressionList.length] = "*[floor(.)]>0";279expressionList[expressionList.length] = "*[ceiling(.)]<1";280expressionList[expressionList.length] = "*[round(number(.))=0]<1";281for(var indexN66388 = 0;indexN66388 < expressionList.length; indexN66388++) {282 expression = expressionList[indexN66388];283 xpathexpression = evaluator.createExpression(expression,resolver);...
test_distance.py
Source:test_distance.py
1"""Test Home Assistant distance utility functions."""2import pytest3from homeassistant.const import (4 LENGTH_CENTIMETERS,5 LENGTH_FEET,6 LENGTH_INCHES,7 LENGTH_KILOMETERS,8 LENGTH_METERS,9 LENGTH_MILES,10 LENGTH_MILLIMETERS,11 LENGTH_YARD,12)13import homeassistant.util.distance as distance_util14INVALID_SYMBOL = "bob"15VALID_SYMBOL = LENGTH_KILOMETERS16def test_convert_same_unit():17 """Test conversion from any unit to same unit."""18 assert distance_util.convert(5, LENGTH_KILOMETERS, LENGTH_KILOMETERS) == 519 assert distance_util.convert(2, LENGTH_METERS, LENGTH_METERS) == 220 assert distance_util.convert(6, LENGTH_CENTIMETERS, LENGTH_CENTIMETERS) == 621 assert distance_util.convert(3, LENGTH_MILLIMETERS, LENGTH_MILLIMETERS) == 322 assert distance_util.convert(10, LENGTH_MILES, LENGTH_MILES) == 1023 assert distance_util.convert(9, LENGTH_YARD, LENGTH_YARD) == 924 assert distance_util.convert(8, LENGTH_FEET, LENGTH_FEET) == 825 assert distance_util.convert(7, LENGTH_INCHES, LENGTH_INCHES) == 726def test_convert_invalid_unit():27 """Test exception is thrown for invalid units."""28 with pytest.raises(ValueError):29 distance_util.convert(5, INVALID_SYMBOL, VALID_SYMBOL)30 with pytest.raises(ValueError):31 distance_util.convert(5, VALID_SYMBOL, INVALID_SYMBOL)32def test_convert_nonnumeric_value():33 """Test exception is thrown for nonnumeric type."""34 with pytest.raises(TypeError):35 distance_util.convert("a", LENGTH_KILOMETERS, LENGTH_METERS)36def test_convert_from_miles():37 """Test conversion from miles to other units."""38 miles = 539 assert distance_util.convert(miles, LENGTH_MILES, LENGTH_KILOMETERS) == 8.0467240 assert distance_util.convert(miles, LENGTH_MILES, LENGTH_METERS) == 8046.7241 assert distance_util.convert(miles, LENGTH_MILES, LENGTH_CENTIMETERS) == 804672.042 assert distance_util.convert(miles, LENGTH_MILES, LENGTH_MILLIMETERS) == 8046720.043 assert distance_util.convert(miles, LENGTH_MILES, LENGTH_YARD) == 8799.973459244 assert distance_util.convert(miles, LENGTH_MILES, LENGTH_FEET) == 26400.000844845 assert distance_util.convert(miles, LENGTH_MILES, LENGTH_INCHES) == 316800.17107246def test_convert_from_yards():47 """Test conversion from yards to other units."""48 yards = 549 assert (50 distance_util.convert(yards, LENGTH_YARD, LENGTH_KILOMETERS)51 == 0.004572000000000000552 )53 assert distance_util.convert(yards, LENGTH_YARD, LENGTH_METERS) == 4.57254 assert distance_util.convert(yards, LENGTH_YARD, LENGTH_CENTIMETERS) == 457.255 assert distance_util.convert(yards, LENGTH_YARD, LENGTH_MILLIMETERS) == 4572.056 assert distance_util.convert(yards, LENGTH_YARD, LENGTH_MILES) == 0.00284090821257 assert distance_util.convert(yards, LENGTH_YARD, LENGTH_FEET) == 15.0000004858 assert distance_util.convert(yards, LENGTH_YARD, LENGTH_INCHES) == 180.000097259def test_convert_from_feet():60 """Test conversion from feet to other units."""61 feet = 500062 assert distance_util.convert(feet, LENGTH_FEET, LENGTH_KILOMETERS) == 1.52463 assert distance_util.convert(feet, LENGTH_FEET, LENGTH_METERS) == 152464 assert distance_util.convert(feet, LENGTH_FEET, LENGTH_CENTIMETERS) == 152400.065 assert distance_util.convert(feet, LENGTH_FEET, LENGTH_MILLIMETERS) == 1524000.066 assert distance_util.convert(feet, LENGTH_FEET, LENGTH_MILES) == 0.946969404000000167 assert distance_util.convert(feet, LENGTH_FEET, LENGTH_YARD) == 1666.6616468 assert distance_util.convert(feet, LENGTH_FEET, LENGTH_INCHES) == 60000.03240000000469def test_convert_from_inches():70 """Test conversion from inches to other units."""71 inches = 500072 assert distance_util.convert(inches, LENGTH_INCHES, LENGTH_KILOMETERS) == 0.12773 assert distance_util.convert(inches, LENGTH_INCHES, LENGTH_METERS) == 127.074 assert distance_util.convert(inches, LENGTH_INCHES, LENGTH_CENTIMETERS) == 12700.075 assert distance_util.convert(inches, LENGTH_INCHES, LENGTH_MILLIMETERS) == 127000.076 assert distance_util.convert(inches, LENGTH_INCHES, LENGTH_MILES) == 0.07891411777 assert (78 distance_util.convert(inches, LENGTH_INCHES, LENGTH_YARD) == 138.8884699999999879 )80 assert distance_util.convert(inches, LENGTH_INCHES, LENGTH_FEET) == 416.6666881def test_convert_from_kilometers():82 """Test conversion from kilometers to other units."""83 km = 584 assert distance_util.convert(km, LENGTH_KILOMETERS, LENGTH_METERS) == 500085 assert distance_util.convert(km, LENGTH_KILOMETERS, LENGTH_CENTIMETERS) == 50000086 assert distance_util.convert(km, LENGTH_KILOMETERS, LENGTH_MILLIMETERS) == 500000087 assert distance_util.convert(km, LENGTH_KILOMETERS, LENGTH_MILES) == 3.10685588 assert distance_util.convert(km, LENGTH_KILOMETERS, LENGTH_YARD) == 5468.0589 assert distance_util.convert(km, LENGTH_KILOMETERS, LENGTH_FEET) == 16404.290 assert distance_util.convert(km, LENGTH_KILOMETERS, LENGTH_INCHES) == 196850.591def test_convert_from_meters():92 """Test conversion from meters to other units."""93 m = 500094 assert distance_util.convert(m, LENGTH_METERS, LENGTH_KILOMETERS) == 595 assert distance_util.convert(m, LENGTH_METERS, LENGTH_CENTIMETERS) == 50000096 assert distance_util.convert(m, LENGTH_METERS, LENGTH_MILLIMETERS) == 500000097 assert distance_util.convert(m, LENGTH_METERS, LENGTH_MILES) == 3.10685598 assert distance_util.convert(m, LENGTH_METERS, LENGTH_YARD) == 5468.0599 assert distance_util.convert(m, LENGTH_METERS, LENGTH_FEET) == 16404.2100 assert distance_util.convert(m, LENGTH_METERS, LENGTH_INCHES) == 196850.5101def test_convert_from_centimeters():102 """Test conversion from centimeters to other units."""103 cm = 500000104 assert distance_util.convert(cm, LENGTH_CENTIMETERS, LENGTH_KILOMETERS) == 5105 assert distance_util.convert(cm, LENGTH_CENTIMETERS, LENGTH_METERS) == 5000106 assert distance_util.convert(cm, LENGTH_CENTIMETERS, LENGTH_MILLIMETERS) == 5000000107 assert distance_util.convert(cm, LENGTH_CENTIMETERS, LENGTH_MILES) == 3.106855108 assert distance_util.convert(cm, LENGTH_CENTIMETERS, LENGTH_YARD) == 5468.05109 assert distance_util.convert(cm, LENGTH_CENTIMETERS, LENGTH_FEET) == 16404.2110 assert distance_util.convert(cm, LENGTH_CENTIMETERS, LENGTH_INCHES) == 196850.5111def test_convert_from_millimeters():112 """Test conversion from millimeters to other units."""113 mm = 5000000114 assert distance_util.convert(mm, LENGTH_MILLIMETERS, LENGTH_KILOMETERS) == 5115 assert distance_util.convert(mm, LENGTH_MILLIMETERS, LENGTH_METERS) == 5000116 assert distance_util.convert(mm, LENGTH_MILLIMETERS, LENGTH_CENTIMETERS) == 500000117 assert distance_util.convert(mm, LENGTH_MILLIMETERS, LENGTH_MILES) == 3.106855118 assert distance_util.convert(mm, LENGTH_MILLIMETERS, LENGTH_YARD) == 5468.05119 assert distance_util.convert(mm, LENGTH_MILLIMETERS, LENGTH_FEET) == 16404.2...
medicationRecord.py
Source:medicationRecord.py
1from django.db import models2from django.conf import settings3import logging4# Get an instance of a logger5logger = logging.getLogger(__name__)6from ...utilities.base_model import BaseModel7class MedicationRecord(BaseModel):8 class Meta:9 # https://docs.djangoproject.com/en/1.10/ref/models/options/#db-table10 db_table = 'curation_medication_record'11 id = models.AutoField(primary_key=True)12 encounter_id = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, db_index=True, null=True,)13 medication_record_type = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)14 action = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)15 administering_provider_id = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)16 code = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)17 daw_flag = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)18 days_supply = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)19 days_supply_derived = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)20 discontinue_flag = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)21 dispense_quantity = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)22 documenting_provider_id = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)23 documenting_prov_id = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)24 doses_per_day = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)25 doses_per_day_derived = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)26 end_dttm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)27 expire_dttm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)28 form = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)29 frequency = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)30 gpi = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)31 infusion_dose = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)32 infusion_end_dttm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)33 infusion_expiry_1_dttm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)34 infusion_expiry_2_dttm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)35 infusion_expiry_3_dttm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)36 infusion_expiry_4_dttm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)37 infusion_flag = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)38 infusion_patient_weight = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)39 infusion_patient_weight_unit = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)40 infusion_planned_dose = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)41 infusion_planned_dose_unit = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)42 infusion_rate = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)43 infusion_rate_unit = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)44 infusion_reason_for_adjustment = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)45 infusion_start_dttm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)46 infusion_therapy_type = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)47 infusion_volume_infused = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)48 infusion_volume_infused_unit = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)49 name = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)50 ndc = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)51 or_dispense = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)52 pharmacy_fill_number = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)53 pharmacy_prescription_id = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)54 prescribing_provider_id = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)55 prescription_fill_number = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)56 reason_for_discontinuation = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)57 reason_for_start = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)58 refills_authorized = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)59 refills_authorized_numeric = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)60 route_of_admin = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)61 rxnorm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)62 sig = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)63 start_dttm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)64 status = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)65 strength = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)66 total_dose = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)67 type = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)68 unit = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)69 def getMedicationRecordForEncounter(self, encounterid):70 query = '''SELECT * FROM {} WHERE encounter_id = '{}' '''.format('curation_medication_record', encounterid)71 logger.info('query: {}'.format(query))...
function_length.js
Source:function_length.js
1shouldBe("Array.prototype.toString.length","0");2shouldBe("Array.prototype.toLocaleString.length","0");3shouldBe("Array.prototype.concat.length","1");4shouldBe("Array.prototype.join.length","1");5shouldBe("Array.prototype.pop.length","0");6shouldBe("Array.prototype.push.length","1");7shouldBe("Array.prototype.reverse.length","0");8shouldBe("Array.prototype.shift.length","0");9shouldBe("Array.prototype.slice.length","2"); // 15.4.4.1010shouldBe("Array.prototype.sort.length","1");11shouldBe("Array.prototype.splice.length","2"); // 15.4.4.1212shouldBe("Array.prototype.unshift.length","1");13shouldBe("Boolean.prototype.toString.length","0");14shouldBe("Boolean.prototype.valueOf.length","0");15shouldBe("Date.prototype.toString.length","0");16shouldBe("Date.prototype.toUTCString.length","0");17shouldBe("Date.prototype.toDateString.length","0");18shouldBe("Date.prototype.toTimeString.length","0");19shouldBe("Date.prototype.toLocaleString.length","0");20shouldBe("Date.prototype.toLocaleDateString.length","0");21shouldBe("Date.prototype.toLocaleTimeString.length","0");22shouldBe("Date.prototype.valueOf.length","0");23shouldBe("Date.prototype.getTime.length","0");24shouldBe("Date.prototype.getFullYear.length","0");25shouldBe("Date.prototype.getUTCFullYear.length","0");26shouldBe("Date.prototype.toGMTString.length","0");27shouldBe("Date.prototype.getMonth.length","0");28shouldBe("Date.prototype.getUTCMonth.length","0");29shouldBe("Date.prototype.getDate.length","0");30shouldBe("Date.prototype.getUTCDate.length","0");31shouldBe("Date.prototype.getDay.length","0");32shouldBe("Date.prototype.getUTCDay.length","0");33shouldBe("Date.prototype.getHours.length","0");34shouldBe("Date.prototype.getUTCHours.length","0");35shouldBe("Date.prototype.getMinutes.length","0");36shouldBe("Date.prototype.getUTCMinutes.length","0");37shouldBe("Date.prototype.getSeconds.length","0");38shouldBe("Date.prototype.getUTCSeconds.length","0");39shouldBe("Date.prototype.getMilliseconds.length","0");40shouldBe("Date.prototype.getUTCMilliseconds.length","0");41shouldBe("Date.prototype.getTimezoneOffset.length","0");42shouldBe("Date.prototype.setTime.length","1");43shouldBe("Date.prototype.setMilliseconds.length","1");44shouldBe("Date.prototype.setUTCMilliseconds.length","1");45shouldBe("Date.prototype.setSeconds.length","2");46shouldBe("Date.prototype.setUTCSeconds.length","2");47shouldBe("Date.prototype.setMinutes.length","3");48shouldBe("Date.prototype.setUTCMinutes.length","3");49shouldBe("Date.prototype.setHours.length","4");50shouldBe("Date.prototype.setUTCHours.length","4");51shouldBe("Date.prototype.setDate.length","1");52shouldBe("Date.prototype.setUTCDate.length","1");53shouldBe("Date.prototype.setMonth.length","2");54shouldBe("Date.prototype.setUTCMonth.length","2");55shouldBe("Date.prototype.setFullYear.length","3");56shouldBe("Date.prototype.setUTCFullYear.length","3");57shouldBe("Date.prototype.setYear.length","1");58shouldBe("Date.prototype.getYear.length","0");59shouldBe("Date.prototype.toGMTString.length","0");60shouldBe("Error.prototype.toString.length","0");61shouldBe("eval.length","1");62shouldBe("parseInt.length","2");63shouldBe("parseFloat.length","1");64shouldBe("isNaN.length","1");65shouldBe("isFinite.length","1");66shouldBe("escape.length","1");67shouldBe("unescape.length","1");68shouldBe("Math.abs.length","1");69shouldBe("Math.acos.length","1");70shouldBe("Math.asin.length","1");71shouldBe("Math.atan.length","1");72shouldBe("Math.atan2.length","2");73shouldBe("Math.ceil.length","1");74shouldBe("Math.cos.length","1");75shouldBe("Math.exp.length","1");76shouldBe("Math.floor.length","1");77shouldBe("Math.log.length","1");78shouldBe("Math.max.length","2");79shouldBe("Math.min.length","2");80shouldBe("Math.pow.length","2");81shouldBe("Math.random.length","0");82shouldBe("Math.round.length","1");83shouldBe("Math.sin.length","1");84shouldBe("Math.sqrt.length","1");85shouldBe("Math.tan.length","1");86shouldBe("Object.prototype.toString.length","0");87shouldBe("Object.prototype.valueOf.length","0");88shouldBe("RegExp.prototype.exec.length","0");89shouldBe("RegExp.prototype.test.length","0");90shouldBe("RegExp.prototype.toString.length","0");91shouldBe("String.fromCharCode.length","1");92shouldBe("String.prototype.concat.length","1");93shouldBe("String.prototype.toString.length","0");94shouldBe("String.prototype.valueOf.length","0");95shouldBe("String.prototype.charAt.length","1");96shouldBe("String.prototype.charCodeAt.length","1");97shouldBe("String.prototype.indexOf.length","1");98shouldBe("String.prototype.lastIndexOf.length","1");99shouldBe("String.prototype.match.length","1");100shouldBe("String.prototype.replace.length","2");101shouldBe("String.prototype.search.length","1");102shouldBe("String.prototype.slice.length","2"); // 15.5.4.13103shouldBe("String.prototype.split.length","2"); // 15.5.4.14104shouldBe("String.prototype.substr.length","2");105shouldBe("String.prototype.substring.length","2");106shouldBe("String.prototype.toLowerCase.length","0");107shouldBe("String.prototype.toUpperCase.length","0");108shouldBe("String.prototype.big.length","0");109shouldBe("String.prototype.small.length","0");110shouldBe("String.prototype.blink.length","0");111shouldBe("String.prototype.bold.length","0");112shouldBe("String.prototype.fixed.length","0");113shouldBe("String.prototype.italics.length","0");114shouldBe("String.prototype.strike.length","0");115shouldBe("String.prototype.sub.length","0");116shouldBe("String.prototype.sup.length","0");117shouldBe("String.prototype.fontcolor.length","1");118shouldBe("String.prototype.fontsize.length","1");119shouldBe("String.prototype.anchor.length","1");120shouldBe("String.prototype.link.length","1");121shouldBe("Number.prototype.toString.length", "1");122shouldBe("Number.prototype.valueOf.length", "0");123shouldBe("Number.prototype.toFixed.length", "1");...
length.js
Source:length.js
1// Copyright 2008 Google Inc. All Rights Reserved.2// Redistribution and use in source and binary forms, with or without3// modification, are permitted provided that the following conditions are4// met:5//6// * Redistributions of source code must retain the above copyright7// notice, this list of conditions and the following disclaimer.8// * Redistributions in binary form must reproduce the above9// copyright notice, this list of conditions and the following10// disclaimer in the documentation and/or other materials provided11// with the distribution.12// * Neither the name of Google Inc. nor the names of its13// contributors may be used to endorse or promote products derived14// from this software without specific prior written permission.15//16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.27/**28 * @fileoverview Assert we match ES3 and Safari.29 */30assertEquals(0, Array.prototype.length, "Array.prototype.length");31assertEquals(1, Array.length, "Array.length");32assertEquals(1, Array.prototype.concat.length, "Array.prototype.concat.length");33assertEquals(1, Array.prototype.join.length, "Array.prototype.join.length");34assertEquals(1, Array.prototype.push.length, "Array.prototype.push.length");35assertEquals(1, Array.prototype.unshift.length, "Array.prototype.unshift.length");36assertEquals(1, Boolean.length, "Boolean.length");37assertEquals(1, Error.length, "Error.length");38assertEquals(1, EvalError.length, "EvalError.length");39assertEquals(1, Function.length, "Function.length");40assertEquals(1, Function.prototype.call.length, "Function.prototype.call.length");41assertEquals(1, Number.length, "Number.length");42assertEquals(1, Number.prototype.toExponential.length, "Number.prototype.toExponential.length");43assertEquals(1, Number.prototype.toFixed.length, "Number.prototype.toFixed.length");44assertEquals(1, Number.prototype.toPrecision.length, "Number.prototype.toPrecision.length");45assertEquals(1, Object.length, "Object.length");46assertEquals(1, RangeError.length, "RangeError.length");47assertEquals(1, ReferenceError.length, "ReferenceError.length");48assertEquals(1, String.fromCharCode.length, "String.fromCharCode.length");49assertEquals(1, String.length, "String.length");50assertEquals(1, String.prototype.concat.length, "String.prototype.concat.length");51assertEquals(1, String.prototype.indexOf.length, "String.prototype.indexOf.length");52assertEquals(1, String.prototype.lastIndexOf.length, "String.prototype.lastIndexOf.length");53assertEquals(1, SyntaxError.length, "SyntaxError.length");54assertEquals(1, TypeError.length, "TypeError.length");55assertEquals(2, Array.prototype.slice.length, "Array.prototype.slice.length");56assertEquals(2, Array.prototype.splice.length, "Array.prototype.splice.length");57assertEquals(2, Date.prototype.setMonth.length, "Date.prototype.setMonth.length");58assertEquals(2, Date.prototype.setSeconds.length, "Date.prototype.setSeconds.length");59assertEquals(2, Date.prototype.setUTCMonth.length, "Date.prototype.setUTCMonth.length");60assertEquals(2, Date.prototype.setUTCSeconds.length, "Date.prototype.setUTCSeconds.length");61assertEquals(2, Function.prototype.apply.length, "Function.prototype.apply.length");62assertEquals(2, Math.max.length, "Math.max.length");63assertEquals(2, Math.min.length, "Math.min.length");64assertEquals(2, RegExp.length, "RegExp.length");65assertEquals(2, String.prototype.slice.length, "String.prototype.slice.length");66assertEquals(2, String.prototype.split.length, "String.prototype.split.length");67assertEquals(2, String.prototype.substr.length, "String.prototype.substr.length");68assertEquals(2, String.prototype.substring.length, "String.prototype.substring.length");69assertEquals(3, Date.prototype.setFullYear.length, "Date.prototype.setFullYear.length");70assertEquals(3, Date.prototype.setMinutes.length, "Date.prototype.setMinutes.length");71assertEquals(3, Date.prototype.setUTCFullYear.length, "Date.prototype.setUTCFullYear.length");72assertEquals(3, Date.prototype.setUTCMinutes.length, "Date.prototype.setUTCMinutes.length");73assertEquals(4, Date.prototype.setHours.length, "Date.prototype.setHours.length");74assertEquals(4, Date.prototype.setUTCHours.length, "Date.prototype.setUTCHours.length");75assertEquals(7, Date.UTC.length, "Date.UTC.length");...
CssTransform.js
Source:CssTransform.js
1/**2 * @private3 */4Ext.define('Ext.scroll.indicator.CssTransform', {5 extend: 'Ext.scroll.indicator.Abstract',6 config: {7 cls: 'csstransform'8 },9 getElementConfig: function() {10 var config = this.callParent();11 config.children[0].children = [12 {13 reference: 'startElement'14 },15 {16 reference: 'middleElement'17 },18 {19 reference: 'endElement'20 }21 ];22 return config;23 },24 refresh: function() {25 var axis = this.getAxis(),26 startElementDom = this.startElement.dom,27 endElementDom = this.endElement.dom,28 middleElement = this.middleElement,29 startElementLength, endElementLength;30 if (axis === 'x') {31 startElementLength = startElementDom.offsetWidth;32 endElementLength = endElementDom.offsetWidth;33 middleElement.setLeft(startElementLength);34 }35 else {36 startElementLength = startElementDom.offsetHeight;37 endElementLength = endElementDom.offsetHeight;38 middleElement.setTop(startElementLength);39 }40 this.startElementLength = startElementLength;41 this.endElementLength = endElementLength;42 this.minLength = startElementLength + endElementLength;43 this.callParent();44 },45 applyLength: function(length) {46 return Math.round(Math.max(this.minLength, length));47 },48 updateLength: function(length) {49 var axis = this.getAxis(),50 endElementStyle = this.endElement.dom.style,51 middleElementStyle = this.middleElement.dom.style,52 endElementLength = this.endElementLength,53 endElementOffset = length - endElementLength,54 middleElementLength = endElementOffset - this.startElementLength;55 if (axis === 'x') {56 endElementStyle.webkitTransform = 'translate3d(' + endElementOffset + 'px, 0, 0)';57 middleElementStyle.webkitTransform = 'translate3d(0, 0, 0) scaleX(' + middleElementLength + ')';58 }59 else {60 endElementStyle.webkitTransform = 'translate3d(0, ' + endElementOffset + 'px, 0)';61 middleElementStyle.webkitTransform = 'translate3d(0, 0, 0) scaleY(' + middleElementLength + ')';62 }63 },64 updateValue: function(value) {65 var barLength = this.barLength,66 gapLength = this.gapLength,67 length = this.getLength(),68 newLength, offset, extra;69 if (value <= 0) {70 offset = 0;71 this.updateLength(this.applyLength(length + value * barLength));72 }73 else if (value >= 1) {74 extra = Math.round((value - 1) * barLength);75 newLength = this.applyLength(length - extra);76 extra = length - newLength;77 this.updateLength(newLength);78 offset = gapLength + extra;79 }80 else {81 offset = gapLength * value;82 }83 this.setOffset(offset);84 },85 setOffset: function(offset) {86 var axis = this.getAxis(),87 elementStyle = this.element.dom.style;88 offset = Math.round(offset);89 if (axis === 'x') {90 elementStyle.webkitTransform = 'translate3d(' + offset + 'px, 0, 0)';91 }92 else {93 elementStyle.webkitTransform = 'translate3d(0, ' + offset + 'px, 0)';94 }95 }...
codec.py
Source:codec.py
1# Author: Trevor Perrin2# See the LICENSE file for legal information regarding use of this file.3"""Classes for reading/writing binary data (such as TLS records)."""4from .compat import *5class Writer(object):6 def __init__(self):7 self.bytes = bytearray(0)8 def add(self, x, length):9 self.bytes += bytearray(length)10 newIndex = len(self.bytes) - 111 for count in range(length):12 self.bytes[newIndex] = x & 0xFF13 x >>= 814 newIndex -= 115 def addFixSeq(self, seq, length):16 for e in seq:17 self.add(e, length)18 def addVarSeq(self, seq, length, lengthLength):19 self.add(len(seq)*length, lengthLength)20 for e in seq:21 self.add(e, length)22class Parser(object):23 def __init__(self, bytes):24 self.bytes = bytes25 self.index = 026 def get(self, length):27 if self.index + length > len(self.bytes):28 raise SyntaxError()29 x = 030 for count in range(length):31 x <<= 832 x |= self.bytes[self.index]33 self.index += 134 return x35 def getFixBytes(self, lengthBytes):36 if self.index + lengthBytes > len(self.bytes):37 raise SyntaxError()38 bytes = self.bytes[self.index : self.index+lengthBytes]39 self.index += lengthBytes40 return bytes41 def getVarBytes(self, lengthLength):42 lengthBytes = self.get(lengthLength)43 return self.getFixBytes(lengthBytes)44 def getFixList(self, length, lengthList):45 l = [0] * lengthList46 for x in range(lengthList):47 l[x] = self.get(length)48 return l49 def getVarList(self, length, lengthLength):50 lengthList = self.get(lengthLength)51 if lengthList % length != 0:52 raise SyntaxError()53 lengthList = lengthList // length54 l = [0] * lengthList55 for x in range(lengthList):56 l[x] = self.get(length)57 return l58 def startLengthCheck(self, lengthLength):59 self.lengthCheck = self.get(lengthLength)60 self.indexCheck = self.index61 def setLengthCheck(self, length):62 self.lengthCheck = length63 self.indexCheck = self.index64 def stopLengthCheck(self):65 if (self.index - self.indexCheck) != self.lengthCheck:66 raise SyntaxError()67 def atLengthCheck(self):68 if (self.index - self.indexCheck) < self.lengthCheck:69 return False70 elif (self.index - self.indexCheck) == self.lengthCheck:71 return True72 else:...
Using AI Code Generation
1var wptools = require('wptools');2wptools.get('Barack Obama').then(function(page) {3 return page.length();4}).then(function(len) {5 console.log(len);6}).catch(function(err) {7 console.log(err);8});9var wptools = require('wptools');10wptools.get('Barack Obama').then(function(page) {11 return page.images();12}).then(function(images) {13 console.log(images);14}).catch(function(err) {15 console.log(err);16});
Using AI Code Generation
1var wptexturize = require('wptexturize');2var text = 'I am a string';3var length = wptexturize.length(text);4var wptexturize = require('wptexturize');5var text = 'I am a string';6var length = wptexturize.length(text);7var wptexturize = require('wptexturize');8var text = 'I am a string';9var length = wptexturize.length(text);10var wptexturize = require('wptexturize');11var text = 'I am a string';12var length = wptexturize.length(text);13var wptexturize = require('wptexturize');14var text = 'I am a string';15var length = wptexturize.length(text);16var wptexturize = require('wptexturize');17var text = 'I am a string';18var length = wptexturize.length(text);19var wptexturize = require('wptexturize');20var text = 'I am a string';21var length = wptexturize.length(text);22var wptexturize = require('wptexturize');23var text = 'I am a string';24var length = wptexturize.length(text);25var wptexturize = require('wptexturize');26var text = 'I am a string';27var length = wptexturize.length(text);28var wptexturize = require('
Using AI Code Generation
1var title = document.getElementById('wptitle').textContent;2var titleLength = title.length;3console.log(titleLength);4var body = document.getElementById('wpbody').textContent;5var bodyLength = body.length;6console.log(bodyLength);7var category = document.getElementById('wpcategory').textContent;8var categoryLength = category.length;9console.log(categoryLength);10var date = document.getElementById('wpdate').textContent;11var dateLength = date.length;12console.log(dateLength);13var link = document.getElementById('wplink').textContent;14var linkLength = link.length;15console.log(linkLength);16var image = document.getElementById('wpimage').textContent;17var imageLength = image.length;18console.log(imageLength);19var author = document.getElementById('wpauthor').textContent;20var authorLength = author.length;21console.log(authorLength);22var tags = document.getElementById('wptags').textContent;23var tagsLength = tags.length;24console.log(tagsLength);25var custom = document.getElementById('wpcustom').textContent;26var customLength = custom.length;27console.log(customLength);28var excerpt = document.getElementById('wpexcerpt').textContent;29var excerptLength = excerpt.length;30console.log(excerptLength);31var more = document.getElementById('wpmore').textContent;32var moreLength = more.length;33console.log(moreLength);34var caption = document.getElementById('wpcaption').textContent;35var captionLength = caption.length;36console.log(captionLength);37var text = document.getElementById('wptext').textContent;38var textLength = text.length;39console.log(textLength);40var textarea = document.getElementById('wptextarea').textContent;41var textareaLength = textarea.length;42console.log(textareaLength);43var password = document.getElementById('wppassword').textContent
Using AI Code Generation
1var wptexturize = require('wptexturize');2var str = "I'm a string";3console.log(wptexturize.length(str));4var wptexturize = require('wptexturize');5var str = "I'm a string";6console.log(wptexturize.trim(str));7var wptexturize = require('wptexturize');8var str = "I'm a string";9console.log(wptexturize.replace(str));10var wptexturize = require('wptexturize');11var str = "I'm a string";12console.log(wptexturize.substr(str));13var wptexturize = require('wptexturize');14var str = "I'm a string";15console.log(wptexturize.concat(str));16var wptexturize = require('wptexturize');17var str = "I'm a string";18console.log(wptexturize.toUpperCase(str));19var wptexturize = require('wptexturize');20var str = "I'm a string";21console.log(wptexturize.toLowerCase(str));22var wptexturize = require('wptexturize');23var str = "I'm a string";24console.log(wptexturize.split(str));25var wptexturize = require('wptexturize');26var str = "I'm a string";27console.log(wptexturize.slice(str));28var wptexturize = require('wptexturize');29var str = "I'm a string";30console.log(wptexturize.search(str));31var wptexturize = require('wptext
Using AI Code Generation
1var str = "The quick brown fox jumps over the lazy dog.";2var n = str.length;3console.log(n);4var str = "The quick brown fox jumps over the lazy dog.";5var n = str.length;6console.log(n);7var str = "The quick brown fox jumps over the lazy dog.";8var n = str.length;9console.log(n);10var str = "The quick brown fox jumps over the lazy dog.";11var n = str.length;12console.log(n);13var str = "The quick brown fox jumps over the lazy dog.";14var n = str.length;15console.log(n);16var str = "The quick brown fox jumps over the lazy dog.";17var n = str.length;18console.log(n);19var str = "The quick brown fox jumps over the lazy dog.";20var n = str.length;21console.log(n);22var str = "The quick brown fox jumps over the lazy dog.";23var n = str.length;24console.log(n);25var str = "The quick brown fox jumps over the lazy dog.";26var n = str.length;27console.log(n);28var str = "The quick brown fox jumps over the lazy dog.";29var n = str.length;30console.log(n);
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!!