Best JavaScript code snippet using best
parse.py
Source:parse.py
1"""2This module contains code to parse the input arguments to the command line:3- easysvm.py4- datagen.py5"""6#############################################################################################7# #8# This program is free software; you can redistribute it and/or modify #9# it under the terms of the GNU General Public License as published by #10# the Free Software Foundation; either version 3 of the License, or #11# (at your option) any later version. #12# #13# This program is distributed in the hope that it will be useful, #14# but WITHOUT ANY WARRANTY; without even the implied warranty of #15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 16# GNU General Public License for more details. #17# #18# You should have received a copy of the GNU General Public License # 19# along with this program; if not, see http://www.gnu.org/licenses #20# or write to the Free Software Foundation, Inc., 51 Franklin Street, #21# Fifth Floor, Boston, MA 02110-1301 USA #22# #23#############################################################################################24import datafuncs25import sys26################################################################################27# basic types28def parse_range(str):29 list=str.split("-")30 if len(list)==1:31 return (int(list[0]), int(list[0]))32 if len(list)==2:33 return (int(list[0]), int(list[1]))34 sys.stderr.write("Cannot parse range '%s'\n" %str) 35 sys.exit(-1)36def parse_float_list(str):37 list=str.split(",")38 float_list=[] ;39 for elem in list:40 float_list.append(float(elem))41 return float_list42def parse_int_list(str):43 list=str.split(",")44 int_list=[] ;45 for elem in list:46 int_list.append(int(elem))47 return int_list48################################################################################49# input files50def parse_input_file_train(kernelname, argv):51 """Parse the input and output file names"""52 if len(argv)<2 or (argv[0]=="fasta" and len(argv)<3) or (argv[0]!='fasta' and argv[0]!='arff'):53 sys.stderr.write("data usage: arff <train.arff>\n or: fasta <train_pos.fa> <train_neg.fa>\n") 54 sys.exit(-1)55 if argv[0] == 'fasta':56 datafilenamepos = argv[1]57 datafilenameneg = argv[2]58 (examples, labels) = datafuncs.fastaread(datafilenamepos, datafilenameneg)59 argv_rest=argv[3:]60 elif argv[0] == 'arff':61 datafilename = argv[1]62 (examples, labels) = datafuncs.arffread(kernelname, datafilename)63 argv_rest=argv[2:]64 else:65 print 'Error in parse_input_file'66 return (examples,labels,argv_rest)67def parse_input_file_train_test(kernelname, argv):68 """Parse the input and output file names"""69 if len(argv)<3 or (argv[0]=="fasta" and len(argv)<4) or (argv[0]!='fasta' and argv[0]!='arff'):70 sys.stderr.write("data usage: arff <train.arff> <test.arff>\n or: fasta <train_pos.fa> <train_neg.fa> <test.fa>\n") 71 sys.exit(-1)72 73 if argv[0] == 'fasta':74 datafilenamepos = argv[1]75 datafilenameneg = argv[2]76 datafilenametest = argv[3]77 (trainex, trainlab) = datafuncs.fastaread(datafilenamepos, datafilenameneg)78 (testex, testlab) = datafuncs.fastaread(datafilenametest)79 argv_rest=argv[4:]80 elif argv[0] == 'arff':81 datafilename = argv[1]82 datafilenametest = argv[2]83 (trainex, trainlab) = datafuncs.arffread(kernelname, datafilename)84 (testex, testlab) = datafuncs.arffread(kernelname, datafilenametest)85 argv_rest=argv[3:]86 else:87 print 'Error in parse_input_file'88 return (trainex,trainlab,testex,argv_rest)89################################################################################90# prediction file91def parse_prediction_file(fname):92 outputs=[]93 splitassignments=[]94 f = open(fname)95 str=f.read()96 lines = str.split('\n') 97 num=0 98 for line in lines:99 if len(line)>0 and line[0] != '#':100 elems=line.split('\t') 101 assert(len(elems)>1)102 assert(int(elems[0]) == num) 103 num+=1 104 if len(elems)==2:105 outputs.append(float(elems[1]))106 else:107 assert(len(elems)==3)108 outputs.append(float(elems[1]))109 splitassignments.append(float(elems[2]))110 f.close() 111 if len(splitassignments)==0:112 splitassignments = None113 return (outputs, splitassignments)114################################################################################115# kernel parameters116def parse_kernel_param(argv, allow_modelsel_params):117 """Parse the arguments for a particular kernel"""118 if len(argv)<1:119 sys.stderr.write("kernel usage: <kernelname> [<parameters>]\n")120 sys.exit(-1)121 kernelname = argv[0] 122 kparam = {}123 kparam["name"]=kernelname124 kparam["modelsel_name"]=None125 kparam["modelsel_params"]=None126 127 if kernelname == 'gauss':128 if len(argv)<2:129 sys.stderr.write("kernel usage: gauss <width>\n")130 sys.exit(-1)131 if allow_modelsel_params:132 kparam['width'] = None133 kparam["modelsel_name"]="width"134 kparam["modelsel_params"]=parse_float_list(argv[1])135 else:136 kparam['width'] = float(argv[1])137 argv_rest=argv[2:]138 elif kernelname == 'linear':139 kparam['scale']=1140 # no parameters141 argv_rest=argv[1:]142 elif kernelname == 'poly':143 if len(argv)<4:144 sys.stderr.write("kernel usage: poly <degree> <true|false> <true|false>\n")145 sys.exit(-1)146 if allow_modelsel_params:147 kparam['degree'] = None148 kparam["modelsel_name"]="degree"149 kparam["modelsel_params"]=parse_int_list(argv[1])150 else:151 kparam['degree'] = int(argv[1])152 kparam['inhomogene'] = (argv[2] == 'true')153 kparam['normal'] = (argv[3] == 'true')154 argv_rest=argv[4:]155 elif kernelname == 'wd':156 if len(argv)<3:157 sys.stderr.write("kernel usage: wd <degree> <shift>\n")158 sys.exit(-1)159 if allow_modelsel_params:160 kparam['degree'] = None161 kparam["modelsel_name"]="degree"162 kparam["modelsel_params"]=parse_int_list(argv[1])163 else:164 kparam['degree'] = int(argv[1])165 if allow_modelsel_params and len(kparam["modelsel_params"])==1:166 kparam['degree'] = kparam["modelsel_params"][0]167 kparam['shift'] = None168 kparam["modelsel_name"] = "shift"169 kparam["modelsel_params"]=parse_int_list(argv[2])170 else:171 kparam['shift'] = int(argv[2])172 argv_rest=argv[3:]173 elif kernelname == 'spec':174 if len(argv)<2:175 sys.stderr.write("kernel usage: spec <degree>\n")176 sys.exit(-1)177 if allow_modelsel_params:178 kparam['degree'] = None179 kparam["modelsel_name"]="degree"180 kparam["modelsel_params"]=parse_int_list(argv[1])181 else:182 kparam['degree'] = int(argv[1])183 argv_rest=argv[2:]184 elif kernelname == 'localalign':185 # no parameters186 argv_rest=argv[1:]187 elif kernelname == 'localimprove':188 if len(argv)<4:189 sys.stderr.write("kernel usage: localimprove <length> <indegree> <outdegree>\n")190 sys.exit(-1)191 kparam['length'] = int(argv[1])192 if allow_modelsel_params:193 kparam['width'] = None194 kparam["modelsel_name"]="indeg"195 kparam["modelsel_params"]=parse_int_list(argv[2])196 else:197 kparam['indeg'] = int(argv[2])198 kparam['outdeg'] = int(argv[3])199 argv_rest=argv[4:]200 else:201 sys.stderr.write( 'Unknown kernel name %s in parse_kernel_param\n' % kernelname )202 sys.exit(-1)...
parse.js
Source:parse.js
1var parse = require('../');2var test = require('tape');3test('parse args', function (t) {4 t.deepEqual(5 parse([ '--no-moo' ]),6 { moo : false, _ : [] },7 'no'8 );9 t.deepEqual(10 parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]),11 { v : ['a','b','c'], _ : [] },12 'multi'13 );14 t.end();15});16 17test('comprehensive', function (t) {18 t.deepEqual(19 parse([20 '--name=meowmers', 'bare', '-cats', 'woo',21 '-h', 'awesome', '--multi=quux',22 '--key', 'value',23 '-b', '--bool', '--no-meep', '--multi=baz',24 '--', '--not-a-flag', 'eek'25 ]),26 {27 c : true,28 a : true,29 t : true,30 s : 'woo',31 h : 'awesome',32 b : true,33 bool : true,34 key : 'value',35 multi : [ 'quux', 'baz' ],36 meep : false,37 name : 'meowmers',38 _ : [ 'bare', '--not-a-flag', 'eek' ]39 }40 );41 t.end();42});43test('nums', function (t) {44 var argv = parse([45 '-x', '1234',46 '-y', '5.67',47 '-z', '1e7',48 '-w', '10f',49 '--hex', '0xdeadbeef',50 '789'51 ]);52 t.deepEqual(argv, {53 x : 1234,54 y : 5.67,55 z : 1e7,56 w : '10f',57 hex : 0xdeadbeef,58 _ : [ 789 ]59 });60 t.deepEqual(typeof argv.x, 'number');61 t.deepEqual(typeof argv.y, 'number');62 t.deepEqual(typeof argv.z, 'number');63 t.deepEqual(typeof argv.w, 'string');64 t.deepEqual(typeof argv.hex, 'number');65 t.deepEqual(typeof argv._[0], 'number');66 t.end();67});68test('flag boolean', function (t) {69 var argv = parse([ '-t', 'moo' ], { boolean: 't' });70 t.deepEqual(argv, { t : true, _ : [ 'moo' ] });71 t.deepEqual(typeof argv.t, 'boolean');72 t.end();73});74test('flag boolean value', function (t) {75 var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], {76 boolean: [ 't', 'verbose' ],77 default: { verbose: true }78 });79 80 t.deepEqual(argv, {81 verbose: false,82 t: true,83 _: ['moo']84 });85 86 t.deepEqual(typeof argv.verbose, 'boolean');87 t.deepEqual(typeof argv.t, 'boolean');88 t.end();89});90test('flag boolean default false', function (t) {91 var argv = parse(['moo'], {92 boolean: ['t', 'verbose'],93 default: { verbose: false, t: false }94 });95 96 t.deepEqual(argv, {97 verbose: false,98 t: false,99 _: ['moo']100 });101 102 t.deepEqual(typeof argv.verbose, 'boolean');103 t.deepEqual(typeof argv.t, 'boolean');104 t.end();105});106test('boolean groups', function (t) {107 var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], {108 boolean: ['x','y','z']109 });110 111 t.deepEqual(argv, {112 x : true,113 y : false,114 z : true,115 _ : [ 'one', 'two', 'three' ]116 });117 118 t.deepEqual(typeof argv.x, 'boolean');119 t.deepEqual(typeof argv.y, 'boolean');120 t.deepEqual(typeof argv.z, 'boolean');121 t.end();122});123test('newlines in params' , function (t) {124 var args = parse([ '-s', "X\nX" ])125 t.deepEqual(args, { _ : [], s : "X\nX" });126 127 // reproduce in bash:128 // VALUE="new129 // line"130 // node program.js --s="$VALUE"131 args = parse([ "--s=X\nX" ])132 t.deepEqual(args, { _ : [], s : "X\nX" });133 t.end();134});135test('strings' , function (t) {136 var s = parse([ '-s', '0001234' ], { string: 's' }).s;137 t.equal(s, '0001234');138 t.equal(typeof s, 'string');139 140 var x = parse([ '-x', '56' ], { string: 'x' }).x;141 t.equal(x, '56');142 t.equal(typeof x, 'string');143 t.end();144});145test('stringArgs', function (t) {146 var s = parse([ ' ', ' ' ], { string: '_' })._;147 t.same(s.length, 2);148 t.same(typeof s[0], 'string');149 t.same(s[0], ' ');150 t.same(typeof s[1], 'string');151 t.same(s[1], ' ');152 t.end();153});154test('empty strings', function(t) {155 var s = parse([ '-s' ], { string: 's' }).s;156 t.equal(s, '');157 t.equal(typeof s, 'string');158 var str = parse([ '--str' ], { string: 'str' }).str;159 t.equal(str, '');160 t.equal(typeof str, 'string');161 var letters = parse([ '-art' ], {162 string: [ 'a', 't' ]163 });164 t.equal(letters.a, '');165 t.equal(letters.r, true);166 t.equal(letters.t, '');167 t.end();168});169test('slashBreak', function (t) {170 t.same(171 parse([ '-I/foo/bar/baz' ]),172 { I : '/foo/bar/baz', _ : [] }173 );174 t.same(175 parse([ '-xyz/foo/bar/baz' ]),176 { x : true, y : true, z : '/foo/bar/baz', _ : [] }177 );178 t.end();179});180test('alias', function (t) {181 var argv = parse([ '-f', '11', '--zoom', '55' ], {182 alias: { z: 'zoom' }183 });184 t.equal(argv.zoom, 55);185 t.equal(argv.z, argv.zoom);186 t.equal(argv.f, 11);187 t.end();188});189test('multiAlias', function (t) {190 var argv = parse([ '-f', '11', '--zoom', '55' ], {191 alias: { z: [ 'zm', 'zoom' ] }192 });193 t.equal(argv.zoom, 55);194 t.equal(argv.z, argv.zoom);195 t.equal(argv.z, argv.zm);196 t.equal(argv.f, 11);197 t.end();198});199test('nested dotted objects', function (t) {200 var argv = parse([201 '--foo.bar', '3', '--foo.baz', '4',202 '--foo.quux.quibble', '5', '--foo.quux.o_O',203 '--beep.boop'204 ]);205 206 t.same(argv.foo, {207 bar : 3,208 baz : 4,209 quux : {210 quibble : 5,211 o_O : true212 }213 });214 t.same(argv.beep, { boop : true });215 t.end();216});217test('boolean and alias with chainable api', function (t) {218 var aliased = [ '-h', 'derp' ];219 var regular = [ '--herp', 'derp' ];220 var opts = {221 herp: { alias: 'h', boolean: true }222 };223 var aliasedArgv = parse(aliased, {224 boolean: 'herp',225 alias: { h: 'herp' }226 });227 var propertyArgv = parse(regular, {228 boolean: 'herp',229 alias: { h: 'herp' }230 });231 var expected = {232 herp: true,233 h: true,234 '_': [ 'derp' ]235 };236 237 t.same(aliasedArgv, expected);238 t.same(propertyArgv, expected); 239 t.end();240});241test('boolean and alias with options hash', function (t) {242 var aliased = [ '-h', 'derp' ];243 var regular = [ '--herp', 'derp' ];244 var opts = {245 alias: { 'h': 'herp' },246 boolean: 'herp'247 };248 var aliasedArgv = parse(aliased, opts);249 var propertyArgv = parse(regular, opts);250 var expected = {251 herp: true,252 h: true,253 '_': [ 'derp' ]254 };255 t.same(aliasedArgv, expected);256 t.same(propertyArgv, expected);257 t.end();258});259test('boolean and alias using explicit true', function (t) {260 var aliased = [ '-h', 'true' ];261 var regular = [ '--herp', 'true' ];262 var opts = {263 alias: { h: 'herp' },264 boolean: 'h'265 };266 var aliasedArgv = parse(aliased, opts);267 var propertyArgv = parse(regular, opts);268 var expected = {269 herp: true,270 h: true,271 '_': [ ]272 };273 t.same(aliasedArgv, expected);274 t.same(propertyArgv, expected); 275 t.end();276});277// regression, see https://github.com/substack/node-optimist/issues/71278test('boolean and --x=true', function(t) {279 var parsed = parse(['--boool', '--other=true'], {280 boolean: 'boool'281 });282 t.same(parsed.boool, true);283 t.same(parsed.other, 'true');284 parsed = parse(['--boool', '--other=false'], {285 boolean: 'boool'286 });287 288 t.same(parsed.boool, true);289 t.same(parsed.other, 'false');290 t.end();...
datagen.py
Source:datagen.py
1#!/usr/bin/env python2#############################################################################################3# #4# This program is free software; you can redistribute it and/or modify #5# it under the terms of the GNU General Public License as published by #6# the Free Software Foundation; either version 3 of the License, or #7# (at your option) any later version. #8# #9# This program is distributed in the hope that it will be useful, #10# but WITHOUT ANY WARRANTY; without even the implied warranty of #11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12# GNU General Public License for more details. #13# #14# You should have received a copy of the GNU General Public License # 15# along with this program; if not, see http://www.gnu.org/licenses #16# or write to the Free Software Foundation, Inc., 51 Franklin Street, #17# Fifth Floor, Boston, MA 02110-1301 USA #18# #19#############################################################################################20import sys21import random22from numpy import array23import esvm.parse24import esvm.plots25from esvm.datafuncs import MotifDataDef, fastawrite_sequence, arffwrite_sequence, arffwrite_real26from esvm.mldata import init_datasetfile27if __name__ == '__main__':28 if len(sys.argv)<3 or (sys.argv[1]=='motif' and sys.argv[2]!='arff' and sys.argv[2]!='fasta') \29 or (sys.argv[1]=='motif' and sys.argv[2]=='fasta' and len(sys.argv)<9) \30 or (sys.argv[1]=='motif' and sys.argv[2]=='arff' and len(sys.argv)<14) \31 or (sys.argv[1]=='cloud' and len(sys.argv)<7) or (sys.argv[1]!='motif') \32 and (sys.argv[1]!='cloud'):33 sys.stderr.write( "usage: %s motif fasta MOTIF numSeq seqLenRange"+\34 "positionRange mutationRate output.fa\n"+\35 "or: %s motif arff MOTIFPOS numSeq-pos seqLenRange-pos "+\36 "positionRange-pos mutationRate-pos \\\n"+\37 "motif-neg numSeq-neg seqLenRange-neg positionRange-neg "+\38 "mutationRange-neg output.arff\n"+\39 "or: %s cloud numpoints dimensions fractionOfPositives "+\40 "cloudWidth output.arff\n" % (sys.argv[0],sys.argv[0],sys.argv[0]) )41 sys.exit(-1)42 random.seed()43 if sys.argv[1] == 'motif':44 if sys.argv[2]=='fasta':45 # generate sequences in FASTA format46 p = MotifDataDef()47 p.motif = sys.argv[3]48 p.numseq = int(sys.argv[4])49 (p.seqlenmin,p.seqlenmax) = esvm.parse.parse_range(sys.argv[5])50 (p.posstart,p.posend) = esvm.parse.parse_range(sys.argv[6])51 p.mutrate = float(sys.argv[7])52 filename = sys.argv[8]53 fastawrite_sequence(filename, p)54 else:55 # generate sequences in ARFF format56 assert(sys.argv[2]=='arff')57 p = MotifDataDef()58 p.motif = sys.argv[3]59 p.numseq = int(sys.argv[4])60 (p.seqlenmin,p.seqlenmax) = esvm.parse.parse_range(sys.argv[5])61 (p.posstart,p.posend) = esvm.parse.parse_range(sys.argv[6])62 p.mutrate = float(sys.argv[7])63 64 n = MotifDataDef()65 n.motif = sys.argv[8]66 n.numseq = int(sys.argv[9])67 (n.seqlenmin,n.seqlenmax) = esvm.parse.parse_range(sys.argv[10])68 (n.posstart,n.posend) = esvm.parse.parse_range(sys.argv[11])69 n.mutrate = float(sys.argv[12])70 71 filename = sys.argv[13]72 arffwrite_sequence(filename, p, n)73 74 elif sys.argv[1] == 'cloud':75 # generate a data cloud in ARFF format76 numpoint = int(sys.argv[2])77 numfeat = int(sys.argv[3])78 fracpos = float(sys.argv[4])79 width = float(sys.argv[5])80 filename = sys.argv[6]81 arffwrite_real(filename, numpoint, numfeat, fracpos, width)82 if len(sys.argv)>=8:83 fp = init_datasetfile(filename,'vec')84 (examples,labels) = fp.readlines()85 pointcloud = []86 for ix in xrange(numpoint):87 pointcloud.append(array([labels[ix],examples[0,ix],examples[1,ix]]))88 esvm.plots.plotcloud(pointcloud,sys.argv[7],'Pointcloud')89 90 #(examples,labels,metadata)=arffwrite_real(filename, numpoint, numfeat, fracpos, width)91 #if len(sys.argv)>=8:92 # plots.plotcloud(pointcloud,sys.argv[7],metadata)93 else:...
resolve-args.js
Source:resolve-args.js
1var fs = require('fs'),2 path = require('path'),3 nodeResolve = require('resolve');4var layoutDir = __dirname + '/../layouts/';5module.exports = function(argv) {6 // defaults7 argv.input = path.resolve(process.cwd(), argv.input || './input/');8 argv.output = path.resolve(process.cwd(), argv.output || './output/');9 if (!argv.layout) {10 if (argv['export']) {11 argv.layout = argv['export'];12 } else {13 argv.layout = 'github';14 }15 }16 if (argv.template) {17 throw new Error('--template is deprecated in v2.0, please point --layout to ' +18 'the layout directory with ./page.html in it.');19 }20 if (argv['asset-dir'] || argv.assetDir) {21 throw new Error('--asset-dir is deprecated in v2.0, please point --layout to ' +22 'the layout directory with ./page.html and ./assets in it.');23 }24 if (argv.command) {25 throw new Error('--command is deprecated in v2.0');26 }27 if (argv.runner) {28 throw new Error('--runner is deprecated in v2.0');29 }30 // we only accept a single layout argument, --layout31 if (argv.layout && argv.layout.charAt(0) === '/' && fs.existsSync(argv.layout)) {32 // 1) it can be an absolute path to a folder with ./page.html33 argv.layout = path.normalize(argv.layout);34 } else if (fs.existsSync(process.cwd() + '/' + argv.layout)) {35 // 2) it can be a relative path36 argv.layout = path.normalize(process.cwd() + '/' + argv.layout);37 } else if (fs.existsSync(layoutDir + argv.layout + '/')) {38 // 3c) it can be the name of a builtin layout39 argv.layout = path.normalize(layoutDir + argv.layout + '/');40 }41 if (argv['export']) {42 argv['export'] = argv.layout;43 }44 // set up partials and helpers directories45 var layoutBase = path.dirname(argv.template);46 ['partials', 'helpers'].forEach(function(name) {47 if (argv[name]) {48 argv[name] = path.resolve(process.cwd(), argv[name]);49 } else if (fs.existsSync(layoutBase + '/' + name)) {50 // if the folder exists in the layout, use it automatically51 argv[name] = layoutBase + '/' + name;52 }53 });54 // parse --highlight-<extension>55 var hl = {};56 Object.keys(argv).forEach(function(name) {57 var matched = (typeof name === 'string' ? name.match(/highlight\-(.*)/) : false);58 if (matched) {59 var ext = matched[1];60 argv[name] = findModule(argv[name], [process.cwd, __dirname]);61 hl[ext] = require(argv[name]);62 }63 });64 argv['highlight'] = hl;65 return argv;66};67function findModule(name) {68 var result = '';69 try {70 result = nodeResolve.sync(name, { basedir: process.cwd() });71 } catch(e) {72 try {73 result = nodeResolve.sync(name, { basedir: __dirname });74 } catch(e) {75 console.error('Cannot find module ' + name + ' from ' + process.cwd() + ' or ' + __dirname);76 throw e;77 }78 }79 return result;...
Call.py
Source:Call.py
1# -*- coding: iso-8859-1 -*-2import os3import unittest4import sys5import CopyData6arguments = sys.argv7if sys.argv[1] == '0':8 if sys.argv[2] == '3D0':9 d = CopyData.Data(0)10 else:11 d = CopyData.Data()12 13 if sys.argv[2] == '3D0' or sys.argv[2] == '3D5':14 compareWith = '3D'15 elif sys.argv[2] == 'SBRT' or sys.argv[2] == 'int':16 compareWith = sys.argv[2]17 else:18 print "Unknown argument " + sys.argv[2]19 20 for i in range(0,6):21 d.comparePatients(i, compareWith)22elif sys.argv[1] == '1':23 if sys.argv[3] == '1':24 d = CopyData.Data(0)25 else:26 d = CopyData.Data()27 if sys.argv[3] == '0':28 d.compareMotion(True,int(sys.argv[2]),'int')29 elif sys.argv[3] == '1' or sys.argv[3] == '2':30 d.compareMotion(False,int(sys.argv[2]),'3D')31 elif sys.argv[3] == '3':32 d.compareMotion(False,int(sys.argv[2]),'rescan')33 elif sys.argv[3] == '4':34 d.compareMotion(False,int(sys.argv[2]),'bio')35 else:36 print "Unknown argument " + sys.argv[3]37 38elif sys.argv[1] == '2':39 d = CopyData.Data()40 metric = [0,2]41 for i in range(len(metric)):42 d.exportMetricToClipboard2(metric[i])43 44elif sys.argv[1] == '3':45 d = CopyData.Data()46 metric = [0,2]47 for i in range(len(metric)):48 d.exportMetricToClipboard3(metric[i]) 49 50else:51 print "Unknown argument"...
Using AI Code Generation
1var BestFriend = require("./bestFriend");2var myBestFriend = new BestFriend("Bob", 16);3myBestFriend.printInfo();4function BestFriend(name, age) {5 this.name = name;6 this.age = age;7}8BestFriend.prototype.printInfo = function() {9 console.log("My best friend is " + this.name + " and he is " + this.age + " years old.");10};11module.exports = BestFriend;12var BestFriend = require("./bestFriend");13var myBestFriend = new BestFriend("Bob", 16);14myBestFriend.printInfo();15function BestFriend(name, age) {16 this.name = name;17 this.age = age;18}19BestFriend.prototype.printInfo = function() {20 console.log("My best friend is " + this.name + " and he is " + this.age + " years old.");21};22module.exports = BestFriend;23var BestFriend = require("./bestFriend");24var myBestFriend = new BestFriend("Bob", 16);25myBestFriend.printInfo();26function BestFriend(name, age) {27 this.name = name;28 this.age = age;29}30BestFriend.prototype.printInfo = function() {31 console.log("My best friend is " + this.name + " and he is " + this.age + " years old.");32};33module.exports = BestFriend;34var BestFriend = require("./bestFriend");35var myBestFriend = new BestFriend("Bob", 16);36myBestFriend.printInfo();37function BestFriend(name, age) {38 this.name = name;39 this.age = age;40}41BestFriend.prototype.printInfo = function() {42 console.log("My best friend is " + this.name + " and he is " + this.age + " years old.");43};44module.exports = BestFriend;
Using AI Code Generation
1var BestFriend = require("./BestFriend.js");2var myBestFriend = new BestFriend(process.argv[2], process.argv[3]);3console.log(myBestFriend.name + " loves " + myBestFriend.hobby);4var BestFriend = require("./BestFriend.js");5var myBestFriend = new BestFriend(process.argv[2], process.argv[3]);6console.log(myBestFriend.name + " loves " + myBestFriend.hobby);7var BestFriend = require("./BestFriend.js");8var myBestFriend = new BestFriend(process.argv[2], process.argv[3]);9console.log(myBestFriend.name + " loves " + myBestFriend.hobby);10var BestFriend = require("./BestFriend.js");11var myBestFriend = new BestFriend(process.argv[2], process.argv[3]);12console.log(myBestFriend.name + " loves " + myBestFriend.hobby);13var BestFriend = require("./BestFriend.js");14var myBestFriend = new BestFriend(process.argv[2], process.argv[3]);15console.log(myBestFriend.name + " loves " + myBestFriend.hobby);16var BestFriend = require("./BestFriend.js");17var myBestFriend = new BestFriend(process.argv[2], process.argv[3]);18console.log(myBestFriend.name + " loves " + myBestFriend.h
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!!