How to use unit method in wpt

Best JavaScript code snippet using wpt

data.py

Source:data.py Github

copy

Full Screen

1#!/usr/bin/python2.42#3# Copyright 2011 Google Inc. All Rights Reserved.4#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.16"""Data model classes for the Organization Unit Provisioning API."""17__author__ = 'Gunjan Sharma <gunjansharma@google.com>'18import gdata.apps19import gdata.apps.apps_property_entry20import gdata.apps_property21import gdata.data22# This is required to work around a naming conflict between the Google23# Spreadsheets API and Python's built-in property function24pyproperty = property25# The apps:property name of an organization unit26ORG_UNIT_NAME = 'name'27# The apps:property orgUnitPath of an organization unit28ORG_UNIT_PATH = 'orgUnitPath'29# The apps:property parentOrgUnitPath of an organization unit30PARENT_ORG_UNIT_PATH = 'parentOrgUnitPath'31# The apps:property description of an organization unit32ORG_UNIT_DESCRIPTION = 'description'33# The apps:property blockInheritance of an organization unit34ORG_UNIT_BLOCK_INHERITANCE = 'blockInheritance'35# The apps:property userEmail of a user entry36USER_EMAIL = 'orgUserEmail'37# The apps:property list of users to move38USERS_TO_MOVE = 'usersToMove'39# The apps:property list of moved users40MOVED_USERS = 'usersMoved'41# The apps:property customerId for the domain42CUSTOMER_ID = 'customerId'43# The apps:property name of the customer org unit44CUSTOMER_ORG_UNIT_NAME = 'customerOrgUnitName'45# The apps:property description of the customer org unit46CUSTOMER_ORG_UNIT_DESCRIPTION = 'customerOrgUnitDescription'47# The apps:property old organization unit's path for a user48OLD_ORG_UNIT_PATH = 'oldOrgUnitPath'49class CustomerIdEntry(gdata.apps.apps_property_entry.AppsPropertyEntry):50 """Represents a customerId entry in object form."""51 def GetCustomerId(self):52 """Get the customer ID of the customerId object.53 Returns:54 The customer ID of this customerId object as a string or None.55 """56 return self._GetProperty(CUSTOMER_ID)57 customer_id = pyproperty(GetCustomerId)58 def GetOrgUnitName(self):59 """Get the Organization Unit name of the customerId object.60 Returns:61 The Organization unit name of this customerId object as a string or None.62 """63 return self._GetProperty(ORG_UNIT_NAME)64 org_unit_name = pyproperty(GetOrgUnitName)65 def GetCustomerOrgUnitName(self):66 """Get the Customer Organization Unit name of the customerId object.67 Returns:68 The Customer Organization unit name of this customerId object as a string69 or None.70 """71 return self._GetProperty(CUSTOMER_ORG_UNIT_NAME)72 customer_org_unit_name = pyproperty(GetCustomerOrgUnitName)73 def GetOrgUnitDescription(self):74 """Get the Organization Unit Description of the customerId object.75 Returns:76 The Organization Unit Description of this customerId object as a string77 or None.78 """79 return self._GetProperty(ORG_UNIT_DESCRIPTION)80 org_unit_description = pyproperty(GetOrgUnitDescription)81 def GetCustomerOrgUnitDescription(self):82 """Get the Customer Organization Unit Description of the customerId object.83 Returns:84 The Customer Organization Unit Description of this customerId object85 as a string or None.86 """87 return self._GetProperty(CUSTOMER_ORG_UNIT_DESCRIPTION)88 customer_org_unit_description = pyproperty(GetCustomerOrgUnitDescription)89class OrgUnitEntry(gdata.apps.apps_property_entry.AppsPropertyEntry):90 """Represents an OrganizationUnit in object form."""91 def GetOrgUnitName(self):92 """Get the Organization Unit name of the OrganizationUnit object.93 Returns:94 The Organization unit name of this OrganizationUnit object as a string95 or None.96 """97 return self._GetProperty(ORG_UNIT_NAME)98 def SetOrgUnitName(self, value):99 """Set the Organization Unit name of the OrganizationUnit object.100 Args:101 value: [string] The new Organization Unit name to give this object.102 """103 self._SetProperty(ORG_UNIT_NAME, value)104 org_unit_name = pyproperty(GetOrgUnitName, SetOrgUnitName)105 def GetOrgUnitPath(self):106 """Get the Organization Unit Path of the OrganizationUnit object.107 Returns:108 The Organization Unit Path of this OrganizationUnit object as a string109 or None.110 """111 return self._GetProperty(ORG_UNIT_PATH)112 def SetOrgUnitPath(self, value):113 """Set the Organization Unit path of the OrganizationUnit object.114 Args:115 value: [string] The new Organization Unit path to give this object.116 """117 self._SetProperty(ORG_UNIT_PATH, value)118 org_unit_path = pyproperty(GetOrgUnitPath, SetOrgUnitPath)119 def GetParentOrgUnitPath(self):120 """Get the Parent Organization Unit Path of the OrganizationUnit object.121 Returns:122 The Parent Organization Unit Path of this OrganizationUnit object123 as a string or None.124 """125 return self._GetProperty(PARENT_ORG_UNIT_PATH)126 def SetParentOrgUnitPath(self, value):127 """Set the Parent Organization Unit path of the OrganizationUnit object.128 Args:129 value: [string] The new Parent Organization Unit path130 to give this object.131 """132 self._SetProperty(PARENT_ORG_UNIT_PATH, value)133 parent_org_unit_path = pyproperty(GetParentOrgUnitPath, SetParentOrgUnitPath)134 def GetOrgUnitDescription(self):135 """Get the Organization Unit Description of the OrganizationUnit object.136 Returns:137 The Organization Unit Description of this OrganizationUnit object138 as a string or None.139 """140 return self._GetProperty(ORG_UNIT_DESCRIPTION)141 def SetOrgUnitDescription(self, value):142 """Set the Organization Unit Description of the OrganizationUnit object.143 Args:144 value: [string] The new Organization Unit Description145 to give this object.146 """147 self._SetProperty(ORG_UNIT_DESCRIPTION, value)148 org_unit_description = pyproperty(GetOrgUnitDescription,149 SetOrgUnitDescription)150 def GetOrgUnitBlockInheritance(self):151 """Get the block_inheritance flag of the OrganizationUnit object.152 Returns:153 The the block_inheritance flag of this OrganizationUnit object154 as a string or None.155 """156 return self._GetProperty(ORG_UNIT_BLOCK_INHERITANCE)157 def SetOrgUnitBlockInheritance(self, value):158 """Set the block_inheritance flag of the OrganizationUnit object.159 Args:160 value: [string] The new block_inheritance flag to give this object.161 """162 self._SetProperty(ORG_UNIT_BLOCK_INHERITANCE, value)163 org_unit_block_inheritance = pyproperty(GetOrgUnitBlockInheritance,164 SetOrgUnitBlockInheritance)165 def GetMovedUsers(self):166 """Get the moved users of the OrganizationUnit object.167 Returns:168 The the moved users of this OrganizationUnit object as a string or None.169 """170 return self._GetProperty(MOVED_USERS)171 def SetUsersToMove(self, value):172 """Set the Users to Move of the OrganizationUnit object.173 Args:174 value: [string] The comma seperated list of users to move175 to give this object.176 """177 self._SetProperty(USERS_TO_MOVE, value)178 move_users = pyproperty(GetMovedUsers, SetUsersToMove)179 def __init__(180 self, org_unit_name=None, org_unit_path=None,181 parent_org_unit_path=None, org_unit_description=None,182 org_unit_block_inheritance=None, move_users=None, *args, **kwargs):183 """Constructs a new OrganizationUnit object with the given arguments.184 Args:185 org_unit_name: string (optional) The organization unit name186 for the object.187 org_unit_path: string (optional) The organization unit path188 for the object.189 parent_org_unit_path: string (optional) The parent organization unit path190 for the object.191 org_unit_description: string (optional) The organization unit description192 for the object.193 org_unit_block_inheritance: boolean (optional) weather or not inheritance194 from the organization unit is blocked.195 move_users: string (optional) comma seperated list of users to move.196 args: The other parameters to pass to gdata.entry.GDEntry constructor.197 kwargs: The other parameters to pass to gdata.entry.GDEntry constructor.198 """199 super(OrgUnitEntry, self).__init__(*args, **kwargs)200 if org_unit_name:201 self.org_unit_name = org_unit_name202 if org_unit_path:203 self.org_unit_path = org_unit_path204 if parent_org_unit_path:205 self.parent_org_unit_path = parent_org_unit_path206 if org_unit_description:207 self.org_unit_description = org_unit_description208 if org_unit_block_inheritance is not None:209 self.org_unit_block_inheritance = str(org_unit_block_inheritance)210 if move_users:211 self.move_users = move_users212class OrgUnitFeed(gdata.data.GDFeed):213 """Represents a feed of OrgUnitEntry objects."""214 # Override entry so that this feed knows how to type its list of entries.215 entry = [OrgUnitEntry]216class OrgUserEntry(gdata.apps.apps_property_entry.AppsPropertyEntry):217 """Represents an OrgUser in object form."""218 def GetUserEmail(self):219 """Get the user email address of the OrgUser object.220 Returns:221 The user email address of this OrgUser object as a string or None.222 """223 return self._GetProperty(USER_EMAIL)224 def SetUserEmail(self, value):225 """Set the user email address of this OrgUser object.226 Args:227 value: string The new user email address to give this object.228 """229 self._SetProperty(USER_EMAIL, value)230 user_email = pyproperty(GetUserEmail, SetUserEmail)231 def GetOrgUnitPath(self):232 """Get the Organization Unit Path of the OrgUser object.233 Returns:234 The Organization Unit Path of this OrgUser object as a string or None.235 """236 return self._GetProperty(ORG_UNIT_PATH)237 def SetOrgUnitPath(self, value):238 """Set the Organization Unit path of the OrgUser object.239 Args:240 value: [string] The new Organization Unit path to give this object.241 """242 self._SetProperty(ORG_UNIT_PATH, value)243 org_unit_path = pyproperty(GetOrgUnitPath, SetOrgUnitPath)244 def GetOldOrgUnitPath(self):245 """Get the Old Organization Unit Path of the OrgUser object.246 Returns:247 The Old Organization Unit Path of this OrgUser object as a string248 or None.249 """250 return self._GetProperty(OLD_ORG_UNIT_PATH)251 def SetOldOrgUnitPath(self, value):252 """Set the Old Organization Unit path of the OrgUser object.253 Args:254 value: [string] The new Old Organization Unit path to give this object.255 """256 self._SetProperty(OLD_ORG_UNIT_PATH, value)257 old_org_unit_path = pyproperty(GetOldOrgUnitPath, SetOldOrgUnitPath)258 def __init__(259 self, user_email=None, org_unit_path=None,260 old_org_unit_path=None, *args, **kwargs):261 """Constructs a new OrgUser object with the given arguments.262 Args:263 user_email: string (optional) The user email address for the object.264 org_unit_path: string (optional) The organization unit path265 for the object.266 old_org_unit_path: string (optional) The old organization unit path267 for the object.268 args: The other parameters to pass to gdata.entry.GDEntry constructor.269 kwargs: The other parameters to pass to gdata.entry.GDEntry constructor.270 """271 super(OrgUserEntry, self).__init__(*args, **kwargs)272 if user_email:273 self.user_email = user_email274 if org_unit_path:275 self.org_unit_path = org_unit_path276 if old_org_unit_path:277 self.old_org_unit_path = old_org_unit_path278class OrgUserFeed(gdata.data.GDFeed):279 """Represents a feed of OrgUserEntry objects."""280 # Override entry so that this feed knows how to type its list of entries....

Full Screen

Full Screen

three.source.unit.js

Source:three.source.unit.js Github

copy

Full Screen

1/**2 * @author TristanVALCKE / https://github.com/Itee3 */4import './unit/qunit-utils.js';5//src6import './unit/src/constants.tests';7import './unit/src/polyfills.tests';8import './unit/src/utils.tests';9//src/animation10import './unit/src/animation/AnimationAction.tests';11import './unit/src/animation/AnimationClip.tests';12import './unit/src/animation/AnimationMixer.tests';13import './unit/src/animation/AnimationObjectGroup.tests';14import './unit/src/animation/AnimationUtils.tests';15import './unit/src/animation/KeyframeTrack.tests';16import './unit/src/animation/PropertyBinding.tests';17import './unit/src/animation/PropertyMixer.tests';18//src/animation/tracks19import './unit/src/animation/tracks/BooleanKeyframeTrack.tests';20import './unit/src/animation/tracks/ColorKeyframeTrack.tests';21import './unit/src/animation/tracks/NumberKeyframeTrack.tests';22import './unit/src/animation/tracks/QuaternionKeyframeTrack.tests';23import './unit/src/animation/tracks/StringKeyframeTrack.tests';24import './unit/src/animation/tracks/VectorKeyframeTrack.tests';25//src/audio26import './unit/src/audio/Audio.tests';27import './unit/src/audio/AudioAnalyser.tests';28import './unit/src/audio/AudioContext.tests';29import './unit/src/audio/AudioListener.tests';30import './unit/src/audio/PositionalAudio.tests';31//src/cameras32import './unit/src/cameras/ArrayCamera.tests';33import './unit/src/cameras/Camera.tests';34import './unit/src/cameras/CubeCamera.tests';35import './unit/src/cameras/OrthographicCamera.tests';36import './unit/src/cameras/PerspectiveCamera.tests';37import './unit/src/cameras/StereoCamera.tests';38//src/core39import './unit/src/core/BufferAttribute.tests';40import './unit/src/core/BufferGeometry.tests';41import './unit/src/core/Clock.tests';42import './unit/src/core/DirectGeometry.tests';43import './unit/src/core/EventDispatcher.tests';44import './unit/src/core/Face3.tests';45import './unit/src/core/Geometry.tests';46import './unit/src/core/InstancedBufferAttribute.tests';47import './unit/src/core/InstancedBufferGeometry.tests';48import './unit/src/core/InstancedInterleavedBuffer.tests';49import './unit/src/core/InterleavedBuffer.tests';50import './unit/src/core/InterleavedBufferAttribute.tests';51import './unit/src/core/Layers.tests';52import './unit/src/core/Object3D.tests';53import './unit/src/core/Raycaster.tests';54import './unit/src/core/Uniform.tests';55//src/extras56import './unit/src/extras/ShapeUtils.tests';57//src/extras/core58import './unit/src/extras/core/Curve.tests';59import './unit/src/extras/core/CurvePath.tests';60import './unit/src/extras/core/Font.tests';61import './unit/src/extras/core/Interpolations.tests';62import './unit/src/extras/core/Path.tests';63import './unit/src/extras/core/Shape.tests';64import './unit/src/extras/core/ShapePath.tests';65//src/extras/curves66import './unit/src/extras/curves/ArcCurve.tests';67import './unit/src/extras/curves/CatmullRomCurve3.tests';68import './unit/src/extras/curves/CubicBezierCurve.tests';69import './unit/src/extras/curves/CubicBezierCurve3.tests';70import './unit/src/extras/curves/EllipseCurve.tests';71import './unit/src/extras/curves/LineCurve.tests';72import './unit/src/extras/curves/LineCurve3.tests';73import './unit/src/extras/curves/QuadraticBezierCurve.tests';74import './unit/src/extras/curves/QuadraticBezierCurve3.tests';75import './unit/src/extras/curves/SplineCurve.tests';76//src/extras/objects77import './unit/src/extras/objects/ImmediateRenderObject.tests';78//src/geometries79import './unit/src/geometries/BoxGeometry.tests';80import './unit/src/geometries/CircleGeometry.tests';81import './unit/src/geometries/ConeGeometry.tests';82import './unit/src/geometries/CylinderGeometry.tests';83import './unit/src/geometries/DodecahedronGeometry.tests';84import './unit/src/geometries/EdgesGeometry.tests';85import './unit/src/geometries/ExtrudeGeometry.tests';86import './unit/src/geometries/IcosahedronGeometry.tests';87import './unit/src/geometries/LatheGeometry.tests';88import './unit/src/geometries/OctahedronGeometry.tests';89import './unit/src/geometries/ParametricGeometry.tests';90import './unit/src/geometries/PlaneGeometry.tests';91import './unit/src/geometries/PolyhedronGeometry.tests';92import './unit/src/geometries/RingGeometry.tests';93import './unit/src/geometries/ShapeGeometry.tests';94import './unit/src/geometries/SphereGeometry.tests';95import './unit/src/geometries/TetrahedronGeometry.tests';96import './unit/src/geometries/TextGeometry.tests';97import './unit/src/geometries/TorusGeometry.tests';98import './unit/src/geometries/TorusKnotGeometry.tests';99import './unit/src/geometries/TubeGeometry.tests';100import './unit/src/geometries/WireframeGeometry.tests';101//src/helpers102import './unit/src/helpers/ArrowHelper.tests';103import './unit/src/helpers/AxesHelper.tests';104import './unit/src/helpers/Box3Helper.tests';105import './unit/src/helpers/BoxHelper.tests';106import './unit/src/helpers/CameraHelper.tests';107import './unit/src/helpers/DirectionalLightHelper.tests';108import './unit/src/helpers/GridHelper.tests';109import './unit/src/helpers/HemisphereLightHelper.tests';110import './unit/src/helpers/PlaneHelper.tests';111import './unit/src/helpers/PointLightHelper.tests';112import './unit/src/helpers/PolarGridHelper.tests';113import './unit/src/helpers/SkeletonHelper.tests';114import './unit/src/helpers/SpotLightHelper.tests';115//src/lights116import './unit/src/lights/AmbientLight.tests';117import './unit/src/lights/DirectionalLight.tests';118import './unit/src/lights/DirectionalLightShadow.tests';119import './unit/src/lights/HemisphereLight.tests';120import './unit/src/lights/Light.tests';121import './unit/src/lights/LightShadow.tests';122import './unit/src/lights/PointLight.tests';123import './unit/src/lights/RectAreaLight.tests';124import './unit/src/lights/SpotLight.tests';125import './unit/src/lights/SpotLightShadow.tests';126//src/loaders127import './unit/src/loaders/AnimationLoader.tests';128import './unit/src/loaders/AudioLoader.tests';129import './unit/src/loaders/BufferGeometryLoader.tests';130import './unit/src/loaders/Cache.tests';131import './unit/src/loaders/CompressedTextureLoader.tests';132import './unit/src/loaders/CubeTextureLoader.tests';133import './unit/src/loaders/DataTextureLoader.tests';134import './unit/src/loaders/FileLoader.tests';135import './unit/src/loaders/FontLoader.tests';136import './unit/src/loaders/ImageLoader.tests';137import './unit/src/loaders/Loader.tests';138import './unit/src/loaders/LoaderUtils.tests';139import './unit/src/loaders/LoadingManager.tests';140import './unit/src/loaders/MaterialLoader.tests';141import './unit/src/loaders/ObjectLoader.tests';142import './unit/src/loaders/TextureLoader.tests';143//src/materials144import './unit/src/materials/LineBasicMaterial.tests';145import './unit/src/materials/LineDashedMaterial.tests';146import './unit/src/materials/Material.tests';147import './unit/src/materials/MeshBasicMaterial.tests';148import './unit/src/materials/MeshDepthMaterial.tests';149import './unit/src/materials/MeshDistanceMaterial.tests';150import './unit/src/materials/MeshLambertMaterial.tests';151import './unit/src/materials/MeshNormalMaterial.tests';152import './unit/src/materials/MeshPhongMaterial.tests';153import './unit/src/materials/MeshPhysicalMaterial.tests';154import './unit/src/materials/MeshStandardMaterial.tests';155import './unit/src/materials/MeshToonMaterial.tests';156import './unit/src/materials/PointsMaterial.tests';157import './unit/src/materials/RawShaderMaterial.tests';158import './unit/src/materials/ShaderMaterial.tests';159import './unit/src/materials/ShadowMaterial.tests';160import './unit/src/materials/SpriteMaterial.tests';161//src/math162import './unit/src/math/Box2.tests';163import './unit/src/math/Box3.tests';164import './unit/src/math/Color.tests';165import './unit/src/math/Cylindrical.tests';166import './unit/src/math/Euler.tests';167import './unit/src/math/Frustum.tests';168import './unit/src/math/Interpolant.tests';169import './unit/src/math/Line3.tests';170import './unit/src/math/Math.tests';171import './unit/src/math/Matrix3.tests';172import './unit/src/math/Matrix4.tests';173import './unit/src/math/Plane.tests';174import './unit/src/math/Quaternion.tests';175import './unit/src/math/Ray.tests';176import './unit/src/math/Sphere.tests';177import './unit/src/math/Spherical.tests';178import './unit/src/math/Triangle.tests';179import './unit/src/math/Vector2.tests';180import './unit/src/math/Vector3.tests';181import './unit/src/math/Vector4.tests';182//src/math/interpolants183import './unit/src/math/interpolants/CubicInterpolant.tests';184import './unit/src/math/interpolants/DiscreteInterpolant.tests';185import './unit/src/math/interpolants/LinearInterpolant.tests';186import './unit/src/math/interpolants/QuaternionLinearInterpolant.tests';187//src/objects188import './unit/src/objects/Bone.tests';189import './unit/src/objects/Group.tests';190import './unit/src/objects/Line.tests';191import './unit/src/objects/LineLoop.tests';192import './unit/src/objects/LineSegments.tests';193import './unit/src/objects/LOD.tests';194import './unit/src/objects/Mesh.tests';195import './unit/src/objects/Points.tests';196import './unit/src/objects/Skeleton.tests';197import './unit/src/objects/SkinnedMesh.tests';198import './unit/src/objects/Sprite.tests';199//src/renderers200import './unit/src/renderers/WebGLRenderer.tests';201import './unit/src/renderers/WebGLRenderTarget.tests';202import './unit/src/renderers/WebGLRenderTargetCube.tests';203//src/renderers/shaders204import './unit/src/renderers/shaders/ShaderChunk.tests';205import './unit/src/renderers/shaders/ShaderLib.tests';206import './unit/src/renderers/shaders/UniformsLib.tests';207import './unit/src/renderers/shaders/UniformsUtils.tests';208//src/renderers/webgl209import './unit/src/renderers/webgl/WebGLAttributes.tests';210import './unit/src/renderers/webgl/WebGLBackground.tests';211import './unit/src/renderers/webgl/WebGLBufferRenderer.tests';212import './unit/src/renderers/webgl/WebGLCapabilities.tests';213import './unit/src/renderers/webgl/WebGLClipping.tests';214import './unit/src/renderers/webgl/WebGLExtensions.tests';215import './unit/src/renderers/webgl/WebGLGeometries.tests';216import './unit/src/renderers/webgl/WebGLIndexedBufferRenderer.tests';217import './unit/src/renderers/webgl/WebGLLights.tests';218import './unit/src/renderers/webgl/WebGLMorphtargets.tests';219import './unit/src/renderers/webgl/WebGLObjects.tests';220import './unit/src/renderers/webgl/WebGLProgram.tests';221import './unit/src/renderers/webgl/WebGLPrograms.tests';222import './unit/src/renderers/webgl/WebGLProperties.tests';223import './unit/src/renderers/webgl/WebGLRenderLists.tests';224import './unit/src/renderers/webgl/WebGLShader.tests';225import './unit/src/renderers/webgl/WebGLShadowMap.tests';226import './unit/src/renderers/webgl/WebGLState.tests';227import './unit/src/renderers/webgl/WebGLTextures.tests';228import './unit/src/renderers/webgl/WebGLUniforms.tests';229import './unit/src/renderers/webgl/WebGLUtils.tests';230//src/scenes231import './unit/src/scenes/Fog.tests';232import './unit/src/scenes/FogExp2.tests';233import './unit/src/scenes/Scene.tests';234//src/textures235import './unit/src/textures/CanvasTexture.tests';236import './unit/src/textures/CompressedTexture.tests';237import './unit/src/textures/CubeTexture.tests';238import './unit/src/textures/DataTexture.tests';239import './unit/src/textures/DepthTexture.tests';240import './unit/src/textures/Texture.tests';...

Full Screen

Full Screen

unit_extraction.py

Source:unit_extraction.py Github

copy

Full Screen

1"""2If I want to truly optimize the process, I should be running the for in observation.raw_data.units only once!3It's a trade-off between modularity and running time. Doing it all in one for would be very spaghetti.4TO-DO: should I do everything using unit docs?, as it is, it mixes actual units (the outputs of5 observation.raw_data.units) with unit docs, using both of them instead of just one.6"""7def get_unit_doc(unit):8 # TO-DO: add human name.9 return {10 "tag": unit.tag,11 "unit_type": unit.unit_type,12 "alliance": unit.alliance,13 "type": unit.unit_type,14 "location": {"x": unit.pos.x, "y": unit.pos.y, "z": unit.pos.z},15 "owner": unit.owner,16 "health": unit.health,17 "health_max": unit.health_max,18 "shield": unit.shield,19 "shield_max": unit.shield_max,20 "energy": unit.energy,21 "energy_max": unit.energy_max,22 "build_progress": unit.build_progress,23 "is_on_screen": unit.is_on_screen,24 }25def get_all_units(observation):26 """27 This function takes an observation and returns all units in the field.28 """29 return [get_unit_doc(unit) for unit in observation.raw_data.units]30def get_allied_units(observation):31 """32 This function takes an observation and returns all allied units in the field.33 """34 return [35 get_unit_doc(unit) for unit in observation.raw_data.units if unit.alliance == 136 ]37def get_all_enemy_units(observation):38 """39 This function takes an observation and returns all enemy units in the field.40 """41 return [42 get_unit_doc(unit) for unit in observation.raw_data.units if unit.alliance == 443 ]44def get_visible_enemy_units(observation, as_list=False, as_dict=True):45 """46 This function takes an observation and returns a list of the enemy units that are47 on screen and are visible.48 A unit is considered visible if is either visible (in the protos sense) or if it 49 is snapshotted and finished.50 The definition of display_type can be found here:51 https://github.com/Blizzard/s2client-proto/blob/master/s2clientprotocol/raw.proto#L55 52 """53 if as_list == as_dict:54 raise ValueError("One and only one of as_list and as_dict should be True")55 if as_list == True:56 visible_enemy_units = []57 for unit in observation.raw_data.units:58 if unit.alliance == 4 and unit.is_on_screen:59 if unit.display_type == 1 or (60 unit.display_type == 2 and unit.build_progress == 161 ):62 visible_enemy_units.append(get_unit_doc(unit))63 if as_dict == True:64 # TO-DO: fix this one, this is the root of all bugs.65 visible_enemy_units = {}66 for unit in observation.raw_data.units:67 if unit.alliance == 4 and unit.is_on_screen:68 if unit.display_type == 1 or (69 unit.display_type == 2 and unit.build_progress == 170 ):71 if str(unit.unit_type) not in visible_enemy_units:72 visible_enemy_units[str(unit.unit_type)] = [get_unit_doc(unit)]73 else:74 visible_enemy_units[str(unit.unit_type)].append(75 get_unit_doc(unit)76 )77 return visible_enemy_units78def get_seen_enemy_units(observation, last_seen):79 """80 This function takes an observation and the last state (i.e. at time t-1).81 It copies this last seen_enemy_units and adds all the units that are currently being seen and82 that haven't been seen before. If a unit is seen to be killed (i.e it was on screen in the last83 frame, but in this frame it isn't and it isn't in the enemy's all unit list, then remove it)84 It returns this new updated copy (i.e. a dictionary).85 TO-DO: 86 - Modify this function to be more fair and less cheaty: a human player doesn't know87 if a unit in screen is new or not, a human player doesn't have access to the tags, nor88 all enemy units.89 - For an LSTM, store only visible units, the network should be able to "remember" 90 shortly which units where alive. Not storing tags should be fine.91 - Test and fix this more thoroughly. (deadline: friday)92 """93 # Put new seen units94 seen = last_seen.copy()95 # print(f"seen: {seen}")96 visible_enemy_units = get_visible_enemy_units(97 observation98 ) # {unit type (str): [unit tags (ints)]}99 for str_unit_type in visible_enemy_units:100 if str_unit_type not in seen:101 seen[str_unit_type] = []102 for unit_doc in visible_enemy_units[str_unit_type]:103 if unit_doc not in seen[str_unit_type]:104 # print(f"unit {unit_tag} ({type(unit_tag)}) (of type {unit_type} ({type(unit_type)})) is new!")105 seen[str_unit_type].append(unit_doc)106 # print(f"seen after adding currently visible units: {last_seen}")107 # Remove killed units108 all_enemy_units = get_all_enemy_units(observation) # already returns unit docs.109 for str_unit_type in seen:110 for unit_doc in seen[str_unit_type]:111 if unit_doc not in all_enemy_units:112 # print(f"removing unit {unit_tag} because it was killed.")113 seen[str_unit_type].remove(unit_doc)114 # print(f"seen after removing killed units: {seen}")115 return seen116def get_allied_units_in_progress(observation):117 """118 This function takes an observation and returns a dictionary holding 119 the current units in progress. This dictionary is built as follows120 units_in_progress = {121 (unit's type, unit's tag): unit's build progress122 }123 for each allied unit that has a build progress of less than 1.124 """125 units_in_progress = {}126 for unit in observation.raw_data.units:127 if unit.alliance == 1 and unit.build_progress < 1:128 units_in_progress[(unit.unit_type, unit.tag)] = unit.build_progress...

Full Screen

Full Screen

unit.js

Source:unit.js Github

copy

Full Screen

1'use strict';2var should = require('chai').should();3var expect = require('chai').expect;4var bitcore = require('..');5var errors = bitcore.errors;6var Unit = bitcore.Unit;7describe('Unit', function() {8 it('can be created from a number and unit', function() {9 expect(function() {10 return new Unit(1.2, 'BTC');11 }).to.not.throw();12 });13 it('can be created from a number and exchange rate', function() {14 expect(function() {15 return new Unit(1.2, 350);16 }).to.not.throw();17 });18 it('no "new" is required for creating an instance', function() {19 expect(function() {20 return Unit(1.2, 'BTC');21 }).to.not.throw();22 expect(function() {23 return Unit(1.2, 350);24 }).to.not.throw();25 });26 it('has property accesors "BTC", "mBTC", "uBTC", "bits", and "satoshis"', function() {27 var unit = new Unit(1.2, 'BTC');28 unit.BTC.should.equal(1.2);29 unit.mBTC.should.equal(1200);30 unit.uBTC.should.equal(1200000);31 unit.bits.should.equal(1200000);32 unit.satoshis.should.equal(120000000);33 });34 it('a string amount is allowed', function() {35 var unit;36 unit = Unit.fromBTC('1.00001');37 unit.BTC.should.equal(1.00001);38 unit = Unit.fromMilis('1.00001');39 unit.mBTC.should.equal(1.00001);40 unit = Unit.fromMillis('1.00001');41 unit.mBTC.should.equal(1.00001);42 unit = Unit.fromBits('100');43 unit.bits.should.equal(100);44 unit = Unit.fromSatoshis('8999');45 unit.satoshis.should.equal(8999);46 unit = Unit.fromFiat('43', 350);47 unit.BTC.should.equal(0.12285714);48 });49 it('should have constructor helpers', function() {50 var unit;51 unit = Unit.fromBTC(1.00001);52 unit.BTC.should.equal(1.00001);53 unit = Unit.fromMilis(1.00001);54 unit.mBTC.should.equal(1.00001);55 unit = Unit.fromBits(100);56 unit.bits.should.equal(100);57 unit = Unit.fromSatoshis(8999);58 unit.satoshis.should.equal(8999);59 unit = Unit.fromFiat(43, 350);60 unit.BTC.should.equal(0.12285714);61 });62 it('converts to satoshis correctly', function() {63 /* jshint maxstatements: 25 */64 var unit;65 unit = Unit.fromBTC(1.3);66 unit.mBTC.should.equal(1300);67 unit.bits.should.equal(1300000);68 unit.satoshis.should.equal(130000000);69 unit = Unit.fromMilis(1.3);70 unit.BTC.should.equal(0.0013);71 unit.bits.should.equal(1300);72 unit.satoshis.should.equal(130000);73 unit = Unit.fromBits(1.3);74 unit.BTC.should.equal(0.0000013);75 unit.mBTC.should.equal(0.0013);76 unit.satoshis.should.equal(130);77 unit = Unit.fromSatoshis(3);78 unit.BTC.should.equal(0.00000003);79 unit.mBTC.should.equal(0.00003);80 unit.bits.should.equal(0.03);81 });82 it('takes into account floating point problems', function() {83 var unit = Unit.fromBTC(0.00000003);84 unit.mBTC.should.equal(0.00003);85 unit.bits.should.equal(0.03);86 unit.satoshis.should.equal(3);87 });88 it('exposes unit codes', function() {89 should.exist(Unit.BTC);90 Unit.BTC.should.equal('BTC');91 should.exist(Unit.mBTC);92 Unit.mBTC.should.equal('mBTC');93 should.exist(Unit.bits);94 Unit.bits.should.equal('bits');95 should.exist(Unit.satoshis);96 Unit.satoshis.should.equal('satoshis');97 });98 it('exposes a method that converts to different units', function() {99 var unit = new Unit(1.3, 'BTC');100 unit.to(Unit.BTC).should.equal(unit.BTC);101 unit.to(Unit.mBTC).should.equal(unit.mBTC);102 unit.to(Unit.bits).should.equal(unit.bits);103 unit.to(Unit.satoshis).should.equal(unit.satoshis);104 });105 it('exposes shorthand conversion methods', function() {106 var unit = new Unit(1.3, 'BTC');107 unit.toBTC().should.equal(unit.BTC);108 unit.toMilis().should.equal(unit.mBTC);109 unit.toMillis().should.equal(unit.mBTC);110 unit.toBits().should.equal(unit.bits);111 unit.toSatoshis().should.equal(unit.satoshis);112 });113 it('can convert to fiat', function() {114 var unit = new Unit(1.3, 350);115 unit.atRate(350).should.equal(1.3);116 unit.to(350).should.equal(1.3);117 unit = Unit.fromBTC(0.0123);118 unit.atRate(10).should.equal(0.12);119 });120 it('toString works as expected', function() {121 var unit = new Unit(1.3, 'BTC');122 should.exist(unit.toString);123 unit.toString().should.be.a('string');124 });125 it('can be imported and exported from/to JSON', function() {126 var json = JSON.stringify({amount:1.3, code:'BTC'});127 var unit = Unit.fromObject(JSON.parse(json));128 JSON.stringify(unit).should.deep.equal(json);129 });130 it('importing from invalid JSON fails quickly', function() {131 expect(function() {132 return Unit.fromJSON('¹');133 }).to.throw();134 });135 it('inspect method displays nicely', function() {136 var unit = new Unit(1.3, 'BTC');137 unit.inspect().should.equal('<Unit: 130000000 satoshis>');138 });139 it('fails when the unit is not recognized', function() {140 expect(function() {141 return new Unit(100, 'USD');142 }).to.throw(errors.Unit.UnknownCode);143 expect(function() {144 return new Unit(100, 'BTC').to('USD');145 }).to.throw(errors.Unit.UnknownCode);146 });147 it('fails when the exchange rate is invalid', function() {148 expect(function() {149 return new Unit(100, -123);150 }).to.throw(errors.Unit.InvalidRate);151 expect(function() {152 return new Unit(100, 'BTC').atRate(-123);153 }).to.throw(errors.Unit.InvalidRate);154 });...

Full Screen

Full Screen

unit_conversion.py

Source:unit_conversion.py Github

copy

Full Screen

1import pandas as pd2import string3import random4def convert(num, unit, ingred):5 """6 Convert the unit, and let the code decide whether the measurement is volume or mass7 """8 the_unit = ""9 weight = 010 volume = False11 mass = False12 quantity = False13 14 # Testing for volume15 if "gal" in unit or 'gallon' in unit:16 the_unit = "gallon"17 weight = 3785.4118 volume = True19 elif "quart" in unit or "qt" in unit or "q" in unit:20 the_unit = "quart"21 weight = 946.35322 volume = True23 elif "pt" in unit or "pint" in unit:24 the_unit = "pint"25 weight = 473.17626 volume = True27 elif "cup" in unit or 'c' == unit:28 the_unit = "cup"29 weight = 24030 volume = True31 elif ("fl" in unit and "oz" in unit) or ("fl" in unit and "ounce" in unit):32 the_unit = "fl oz"33 weight = 29.573534 volume = True35 elif "tbsp" in unit or "table" in unit or "tablespoon" in unit:36 the_unit = "tablespoon"37 weight = 14.786838 volume = True39 elif "tsp" in unit or "tea" in unit:40 the_unit = "teaspoon"41 weight = 4.9289242 volume = True43 elif "ml" in unit or "milli" in unit:44 the_unit = "milliliter"45 weight = 146 volume = True47 elif "liter" in unit or "l" == unit:48 the_unit = "liter"49 weight = 100050 volume = True51 elif "pinch" in unit or "bit" or "dash" in unit: # extraneous cases52 # Vocab words that we'll estimate to half a teaspoon53 the_unit = "teaspoon"54 num = 0.555 weight = 4.9289256 volume = True57 elif "drop" in unit:58 the_unit = "teaspoon"59 num = 0.260 weight = 4.9289261 volume = True62 63 # Testing for mass64 elif "metric ton" in unit or "mt" in unit or "m t" in unit:65 the_unit = "metric ton"66 weight = 1e667 mass = True68 elif "kilo" in unit or "kg" in unit:69 the_unit = "kilogram"70 weight = 100071 mass = True72 elif "gram" in unit or "g" == unit:73 the_unit = "gram"74 weight = 175 mass = True76 elif "milli" in unit or "mg" in unit:77 the_unit = "milligram"78 weight = 0.00179 mass = True80 elif ("micro" in unit and "wave" not in unit) or "μg" in unit or "mcg" in unit:81 the_unit = "microgram"82 weight = 1e-683 mass = True84 elif "ton" in unit or "t" == unit:85 the_unit = "ton"86 weight = 90718587 mass = True88 elif "stone" in unit or "st" == unit:89 the_unit = "stone"90 weight = 6350.2991 mass = True92 elif "pound" in unit or "lb" in unit:93 the_unit = "pound"94 weight = 453.59295 mass = True96 elif "ounce" in unit or "ozs" in unit or "oz" in unit:97 the_unit = "ounces"98 weight = 28.349599 mass = True100 else: # if no match, we express the ingredient as a quantity instead of a unit of measure101 quantity = True102 weight = 1103 104 # Convert the unit105 output = round(weight * num, 3)106 if volume:107 # print('Converted', the_unit, 'to milliliters')108 mass = 0109 volume = output110 cols = [ingred + '_mass', ingred + '_volume']111 measurements = [mass, volume]112 elif mass:113 # print('Converted', the_unit, 'to grams')114 mass = output115 volume = 0116 cols = [ingred + '_mass', ingred + '_volume']117 measurements = [mass, volume]118 elif quantity:119 cols = [unit]120 measurements = [output]121 # print('Ingredient expressed as quantity')122 # print(output)123 return measurements, cols, quantity124# List of some expected input units to the function125units = ['oz', 'ounces', 'ounce', 'gram', 'grams', 'ml', 'l', 'pound', 'lb',126 'ozs', 'stone', 'st', 's.t.', 'milliliters', 'ton', 't', 'micrograms',127 'microgram', 'kilograms', 'kg', 'kilogram', 'metric ton', 'mt', 'm.t',128 'metric tonne', 'cubic inch', 'cubic inches', 'cubic feet', 'f3', 'in3',129 'liter', 'cubic meter', 'm3', 'tsp', 'teaspoons', 'teaspoon', 'tbsp',130 'tablespoons', 'cup', 'cups', 'c', 'floz', 'fluid oz', 'fluid ounces', 131 'quart', 'qu', 'qt', 'pint', 'pt', 'gallons', 'gal']132# Number of random combinations of measurements and units you'd like to test133tests = 50134# list of random measurements135nums = [random.randint(1, 1000) for i in range(tests)]136# list of random indices to choose units from the "units" list above137indices = [random.randint(0, len(units) - 1) for i in range(tests)]138def test():139 df = pd.DataFrame(columns=["Volume", "Mass"])140 for i in range(tests):141 # print("INPUT Num:", nums[i], ', Indices:', units[indices[i]])142 convert(nums[i], units[indices[i]], df=df, i=i)143 # print()144def print_df():...

Full Screen

Full Screen

foodinfo.js

Source:foodinfo.js Github

copy

Full Screen

1const router = require('express').Router();2let FoodInfo = require('../models/foodinfo.model');3const auth = require('../middleware/auth');4router.route('/').get((req, res) => {5 FoodInfo.find()6 .then(foodInfos => res.json(foodInfos))7 .catch(err => res.status(400).json('Error: ' + err));8});9router.post("/getOneConsumedFood", auth, async (req, res) => {10 try {11 FoodInfo.findById(req.body.id)12 .then(foodInfo => res.json({ ...foodInfo._doc, quantity: req.body.quantity}))13 .catch(err => res.status(400).json({ msg: err, value: 1 }));14 }15 catch (err) {16 res.json({ msg: err, value: -1 });17 }18});19// Ternary operators here are just error-checking in case of null values20router.route('/add').post((req, res) => {21 const emoji = decodeURIComponent(req.body.emoji);22 const name = req.body.name.toLowerCase();23 const unit = req.body.unit.toLowerCase();24 const protein_per_unit = req.body.protein_per_unit ? Number(req.body.protein_per_unit) : req.body.protein_per_unit;25 const carb_per_unit = req.body.carb_per_unit ? Number(req.body.carb_per_unit) : req.body.carb_per_unit;26 const cal_per_unit = req.body.cal_per_unit ? Number(req.body.cal_per_unit) : req.body.cal_per_unit;27 const fat_per_unit = req.body.fat_per_unit ? Number(req.body.fat_per_unit) : req.body.fat_per_unit;28 const chol_per_unit = req.body.chol_per_unit ? Number(req.body.chol_per_unit) : req.body.chol_per_unit;29 const sodium_per_unit = req.body.sodium_per_unit ? Number(req.body.sodium_per_unit) : req.body.sodium_per_unit;30 const calcium_per_unit = req.body.cal_per_unit ? Number(req.body.cal_per_unit) : req.body.cal_per_unit;31 const iron_per_unit = req.body.iron_per_unit ? Number(req.body.iron_per_unit) : req.body.iron_per_unit;32 const magnesium_per_unit = req.body.magnesium_per_unit ? Number(req.body.magnesium_per_unit) : req.body.magnesium_per_unit;33 34 const newFoodInfo = new FoodInfo({35 emoji: emoji,36 name: name,37 unit: unit,38 protein_per_unit: protein_per_unit,39 carb_per_unit: carb_per_unit,40 cal_per_unit: cal_per_unit,41 fat_per_unit: fat_per_unit,42 chol_per_unit: chol_per_unit,43 sodium_per_unit: sodium_per_unit,44 calcium_per_unit: calcium_per_unit,45 iron_per_unit: iron_per_unit,46 magnesium_per_unit: magnesium_per_unit47 })48 newFoodInfo.save()49 .then(() => res.json('New Food Label added!'))50 .catch(err => res.status(400).json('Error: ' + err));51});52router.route('/delete/:id').post((req, res) => {53 FoodInfo.findByIdAndDelete(req.params.id)54 .then(() => res.json('Food label deleted.'))55 .catch(err => res.status(400).json('Error: '+ err));56})57router.route('/update/:id').post((req, res) => {58 FoodInfo.findById(req.params.id)59 .then(foodinfo => {60 foodinfo.emoji = decodeURIComponent(req.body.emoji);61 foodinfo.name = req.body.name.toLowerCase();62 foodinfo.unit = req.body.unit.toLowerCase();63 foodinfo.protein_per_unit = req.body.protein_per_unit ? Number(req.body.protein_per_unit) : req.body.protein_per_unit;64 foodinfo.carb_per_unit = req.body.carb_per_unit ? Number(req.body.carb_per_unit) : req.body.carb_per_unit;65 foodinfo.cal_per_unit = req.body.cal_per_unit ? Number(req.body.cal_per_unit) : req.body.cal_per_unit;66 foodinfo.fat_per_unit = req.body.fat_per_unit ? Number(req.body.fat_per_unit) : req.body.fat_per_unit;67 foodinfo.chol_per_unit = req.body.chol_per_unit ? Number(req.body.chol_per_unit) : req.body.chol_per_unit;68 foodinfo.sodium_per_unit = req.body.sodium_per_unit ? Number(req.body.sodium_per_unit) : req.body.sodium_per_unit;69 foodinfo.calcium_per_unit = req.body.cal_per_unit ? Number(req.body.cal_per_unit) : req.body.cal_per_unit;70 foodinfo.iron_per_unit = req.body.iron_per_unit ? Number(req.body.iron_per_unit) : req.body.iron_per_unit;71 foodinfo.magnesium_per_unit = req.body.magnesium_per_unit ? Number(req.body.magnesium_per_unit) : req.body.magnesium_per_unit;72 foodinfo.save()73 .then(() => res.json('Food label updated.'))74 .catch(err => res.status(400).json('Error: ' + err));75 })76 .catch(err => res.status(400).json('Error: ' + err));77})...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3 if (err) return console.error(err);4 console.log('Test status:', data.statusText);5 console.log('Test ID:', data.data.testId);6 console.log('Test URL:', data.data.summary);7});8var wpt = require('webpagetest');9var wpt = new WebPageTest('www.webpagetest.org');10 if (err) return console.error(err);11 console.log('Test status:', data.statusText);12 console.log('Test ID:', data.data.testId);13 console.log('Test URL:', data.data.summary);14});15var wpt = require('webpagetest');16var wpt = new WebPageTest('www.webpagetest.org');17 if (err) return console.error(err);18 console.log('Test status:', data.statusText);19 console.log('Test ID:', data.data.testId);20 console.log('Test URL:', data.data.summary);21});22var wpt = require('webpagetest');23var wpt = new WebPageTest('www.webpagetest.org');24 if (err) return console.error(err);25 console.log('Test status:', data.statusText);26 console.log('Test ID:', data.data.testId);27 console.log('Test URL:', data.data.summary);28});29var wpt = require('webpagetest');30var wpt = new WebPageTest('www.webpagetest.org');31 if (err) return console.error(err);32 console.log('Test status:', data.statusText);33 console.log('Test ID:', data.data.testId);34 console.log('Test URL:', data.data.summary);35});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3 if (err) return console.error(err);4 console.log(data);5 wpt.getTestResults(data.data.testId, function(err, data) {6 if (err) return console.error(err);7 console.log(data);8 });9});10var WebPageTest = require('webpagetest');11var wpt = new WebPageTest('www.webpagetest.org');12var GoogleSpreadsheet = require('google-spreadsheet');13var creds = require('./client_secret.json');14var doc = new GoogleSpreadsheet('1Q2w3E4r5t6Y7u8i9o0p');15var sheet;16doc.useServiceAccountAuth(creds, function (err) {17 doc.getInfo(function (err, info) {18 console.log('Loaded doc: ' + info.title + ' by ' + info.author.email);19 sheet = info.worksheets[0];20 console.log('sheet 1: ' + sheet.title + ' ' + sheet.rowCount + 'x' + sheet.colCount);21 });22});23 if (err) return console.error(err);24 console.log(data);25 wpt.getTestResults(data.data.testId, function (err, data) {26 if (err) return console.error(err);27 console.log(data);28 sheet.addRow(1,

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var api = new wpt('www.webpagetest.org');3 if (err) return console.error(err);4 console.log('Test status:', data.statusText);5 if (data.statusCode == 200) {6 console.log('Test completed in', data.data.median.firstView.loadTime, 'ms');7 }8});

Full Screen

Using AI Code Generation

copy

Full Screen

1const wpt = require('webpagetest');2const wptServer = new wpt('www.webpagetest.org');3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9const wpt = require('webpagetest');10const wptServer = new wpt('www.webpagetest.org');11 if (err) {12 console.log(err);13 } else {14 console.log(data);15 }16});17const wpt = require('webpagetest');18const wptServer = new wpt('www.webpagetest.org');19 if (err) {20 console.log(err);21 } else {22 console.log(data);23 }24});25const wpt = require('webpagetest');26const wptServer = new wpt('www.webpagetest.org');27 if (err) {28 console.log(err);29 } else {30 console.log(data);31 }32});33const wpt = require('webpagetest');34const wptServer = new wpt('www.webpagetest.org');35 if (err) {36 console.log(err);37 } else {38 console.log(data);39 }40});41const wpt = require('webpagetest');42const wptServer = new wpt('www.webpagetest.org');43 if (err) {44 console.log(err);45 } else {46 console.log(data);47 }48});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var util = require('util');3var wpt = new WebPageTest('www.webpagetest.org');4wpt.runTest(url, function(err, data) {5 if (err) return console.error(err);6 console.log(util.inspect(data));7});8var wpt = require('wpt');9var util = require('util');10var wpt = new WebPageTest('www.webpagetest.org');11wpt.runTest(url, function(err, data) {12 if (err) return console.error(err);13 console.log(util.inspect(data));14});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2 wpt.unit(data.data.median.firstView.SpeedIndex, 'ms', function(err, data) {3 console.log(data);4 });5});6var wpt = require('wpt');7 wpt.unit(data.data.median.firstView.SpeedIndex, 'ms', function(err, data) {8 console.log(data);9 });10});11var wpt = require('wpt');12 wpt.unit(data.data.median.firstView.SpeedIndex, 'ms', function(err, data) {13 console.log(data);14 });15});16var wpt = require('wpt');17 wpt.unit(data.data.median.firstView.SpeedIndex, 'ms', function(err, data) {18 console.log(data);19 });20});21var wpt = require('wpt');22 wpt.unit(data.data.median.firstView.SpeedIndex, 'ms', function(err, data) {23 console.log(data);24 });25});

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 wpt 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