Best Python code snippet using autotest_python
device_bot_phone_test.js
Source:device_bot_phone_test.js  
...3describe('device', function() {    4    describe('1.Accoona-AI-Agent 1.1.2',function(){5        it('should get device type bot', function(){6            var parser = new device.Parser({ headers: { 'user-agent': 'Accoona-AI-Agent/1.1.2' } });7            assert.equal(parser.get_type(), 'bot');8        });9    });10    describe('2.Arachmo',function(){11        it('should get device type bot', function(){12            var parser = new device.Parser({ headers: { 'user-agent': 'Mozilla/4.0 (compatible; Arachmo)' } });13            assert.equal(parser.get_type(), 'bot');14        });15    });16    describe('3.B-l-i-t-z-B-O-T',function(){17        it('should get device type bot', function(){18            var parser = new device.Parser({ headers: { 'user-agent': 'Mozilla/4.0 (compatible; B-l-i-t-z-B-O-T)' } });19            assert.equal(parser.get_type(), 'bot');20        });21    });22    describe('4.Cerberian Drtrs 3.2',function(){23        it('should get device type bot', function(){24            var parser = new device.Parser({ headers: { 'user-agent': 'Mozilla/4.0 (compatible; Cerberian Drtrs Version-3.2-Build-1)' } });25            assert.equal(parser.get_type(), 'bot');26        });27    });28    describe('5.Cerberian Drtrs 3.2',function(){29        it('should get device type bot', function(){30            var parser = new device.Parser({ headers: { 'user-agent': 'Mozilla/4.0 (compatible; Cerberian Drtrs Version-3.2-Build-0)' } });31            assert.equal(parser.get_type(), 'bot');32        });33    });34    describe('6.Charlotte 0.9t',function(){35        it('should get device type bot', function(){36            var parser = new device.Parser({ headers: { 'user-agent': 'Mozilla/5.0 (compatible; Charlotte/0.9t; http://www.searchme.com/support/)' } });37            assert.equal(parser.get_type(), 'bot');38        });39    });40    describe('7.Charlotte 0.9t',function(){41        it('should get device type bot', function(){42            var parser = new device.Parser({ headers: { 'user-agent': 'Mozilla/5.0 (compatible; Charlotte/0.9t; +http://www.searchme.com/support/)' } });43            assert.equal(parser.get_type(), 'bot');44        });45    });46    describe('8.Charlotte 1.0b',function(){47        it('should get device type bot', function(){48            var parser = new device.Parser({ headers: { 'user-agent': 'Mozilla/5.0 (compatible; Charlotte/1.0b; http://www.searchme.com/support/)' } });49            assert.equal(parser.get_type(), 'bot');50        });51    });52    describe('9.Charlotte 1.0t',function(){53        it('should get device type bot', function(){54            var parser = new device.Parser({ headers: { 'user-agent': 'Mozilla/5.0 (compatible; Charlotte/1.0t; http://www.searchme.com/support/)' } });55            assert.equal(parser.get_type(), 'bot');56        });57    });58    describe('10.Charlotte 1.1',function(){59        it('should get device type bot', function(){60            var parser = new device.Parser({ headers: { 'user-agent': 'Mozilla/5.0 (compatible; Charlotte/1.1; http://www.searchme.com/support/)' } });61            assert.equal(parser.get_type(), 'bot');62        });63    });64    describe('11.Holmes 3.9',function(){65        it('should get device type bot', function(){66            var parser = new device.Parser({ headers: { 'user-agent': 'holmes/3.9 (someurl.co.cc)' } });67            assert.equal(parser.get_type(), 'bot');68        });69    });70    describe('12.htdig 3.1.5',function(){71        it('should get device type bot', function(){72            var parser = new device.Parser({ headers: { 'user-agent': 'htdig/3.1.5 (webmaster@online-medien.de)' } });73            assert.equal(parser.get_type(), 'bot');74        });75    });76    describe('13.htdig 3.1.5',function(){77        it('should get device type bot', function(){78            var parser = new device.Parser({ headers: { 'user-agent': 'htdig/3.1.5 (root@localhost)' } });79            assert.equal(parser.get_type(), 'bot');80        });81    });82    describe('14.htdig 3.1.5',function(){83        it('should get device type bot', function(){84            var parser = new device.Parser({ headers: { 'user-agent': 'htdig/3.1.5 (infosys@storm.rmi.org)' } });85            assert.equal(parser.get_type(), 'bot');86        });87    });88    describe('15.htdig 3.1.5',function(){89        it('should get device type bot', function(){90            var parser = new device.Parser({ headers: { 'user-agent': 'htdig/3.1.5' } });91            assert.equal(parser.get_type(), 'bot');92        });93    });94    describe('16.htdig 3.1.6',function(){95        it('should get device type bot', function(){96            var parser = new device.Parser({ headers: { 'user-agent': 'htdig/3.1.6 (unconfigured@htdig.searchengine.maintainer)' } });97            assert.equal(parser.get_type(), 'bot');98        });99    });100    describe('17.htdig 3.1.6',function(){101        it('should get device type bot', function(){102            var parser = new device.Parser({ headers: { 'user-agent': 'htdig/3.1.6 (mathieu.peltier@inrialpes.fr)' } });103            assert.equal(parser.get_type(), 'bot');104        });105    });106    describe('18.ichiro 2.0',function(){107        it('should get device type bot', function(){108            var parser = new device.Parser({ headers: { 'user-agent': 'ichiro/2.0 (ichiro@nttr.co.jp)' } });109            assert.equal(parser.get_type(), 'bot');110        });111    });112    describe('19.igdeSpyder',function(){113        it('should get device type bot', function(){114            var parser = new device.Parser({ headers: { 'user-agent': 'igdeSpyder (compatible; igde.ru; +http://igde.ru/doc/tech.html)' } });115            assert.equal(parser.get_type(), 'bot');116        });117    });118    describe('20.L.webis 0.87',function(){119        it('should get device type bot', function(){120            var parser = new device.Parser({ headers: { 'user-agent': 'L.webis/0.87 (http://webalgo.iit.cnr.it/index.php?pg=lwebis)' } });121            assert.equal(parser.get_type(), 'bot');122        });123    });124    describe('21.LinkWalker',function(){125        it('should get device type bot', function(){126            var parser = new device.Parser({ headers: { 'user-agent': 'LinkWalker' } });127            assert.equal(parser.get_type(), 'bot');128        });129    });130    describe('22.LinkWalker 2.0',function(){131        it('should get device type bot', function(){132            var parser = new device.Parser({ headers: { 'user-agent': 'LinkWalker/2.0' } });133            assert.equal(parser.get_type(), 'bot');134        });135    });136    describe('23.lwp-trivial 1.33',function(){137        it('should get device type bot', function(){138            var parser = new device.Parser({ headers: { 'user-agent': 'lwp-trivial/1.33' } });139            assert.equal(parser.get_type(), 'bot');140        });141    });142    describe('24.lwp-trivial 1.35',function(){143        it('should get device type bot', function(){144            var parser = new device.Parser({ headers: { 'user-agent': 'lwp-trivial/1.35' } });145            assert.equal(parser.get_type(), 'bot');146        });147    });148    describe('25.lwp-trivial 1.36',function(){149        it('should get device type bot', function(){150            var parser = new device.Parser({ headers: { 'user-agent': 'lwp-trivial/1.36' } });151            assert.equal(parser.get_type(), 'bot');152        });153    });154    describe('26.lwp-trivial 1.38',function(){155        it('should get device type bot', function(){156            var parser = new device.Parser({ headers: { 'user-agent': 'lwp-trivial/1.38' } });157            assert.equal(parser.get_type(), 'bot');158        });159    });160    describe('27.lwp-trivial 1.41',function(){161        it('should get device type bot', function(){162            var parser = new device.Parser({ headers: { 'user-agent': 'lwp-trivial/1.41' } });163            assert.equal(parser.get_type(), 'bot');164        });165    });166    describe('28.Mnogosearch 3.1.21',function(){167        it('should get device type bot', function(){168            var parser = new device.Parser({ headers: { 'user-agent': 'Mnogosearch-3.1.21' } });169            assert.equal(parser.get_type(), 'bot');170        });171    });172    describe('29.mogimogi 1.0',function(){173        it('should get device type bot', function(){174            var parser = new device.Parser({ headers: { 'user-agent': 'mogimogi/1.0' } });175            assert.equal(parser.get_type(), 'bot');176        });177    });178    describe('30.MVAClient',function(){179        it('should get device type bot', function(){180            var parser = new device.Parser({ headers: { 'user-agent': 'MVAClient' } });181            assert.equal(parser.get_type(), 'bot');182        });183    });184    describe('31.NetResearchServer',function(){185        it('should get device type bot', function(){186            var parser = new device.Parser({ headers: { 'user-agent': 'NetResearchServer(http://www.look.com)' } });187            assert.equal(parser.get_type(), 'bot');188        });189    });190    describe('32.Nymesis 1.0',function(){191        it('should get device type bot', function(){192            var parser = new device.Parser({ headers: { 'user-agent': 'Nymesis/1.0 (http://nymesis.com)' } });193            assert.equal(parser.get_type(), 'bot');194        });195    });196    describe('33.oegp 1.3.0',function(){197        it('should get device type bot', function(){198            var parser = new device.Parser({ headers: { 'user-agent': 'oegp v. 1.3.0' } });199            assert.equal(parser.get_type(), 'bot');200        });201    });202    describe('34.Pompos 1.1',function(){203        it('should get device type bot', function(){204            var parser = new device.Parser({ headers: { 'user-agent': 'Pompos/1.1 http://pompos.iliad.fr' } });205            assert.equal(parser.get_type(), 'bot');206        });207    });208    describe('35.Pompos 1.2',function(){209        it('should get device type bot', function(){210            var parser = new device.Parser({ headers: { 'user-agent': 'Pompos/1.2 http://pompos.iliad.fr' } });211            assert.equal(parser.get_type(), 'bot');212        });213    });214    describe('36.Pompos 1.3',function(){215        it('should get device type bot', function(){216            var parser = new device.Parser({ headers: { 'user-agent': 'Pompos/1.3 http://dir.com/pompos.html' } });217            assert.equal(parser.get_type(), 'bot');218        });219    });220    describe('37.PycURL',function(){221        it('should get device type bot', function(){222            var parser = new device.Parser({ headers: { 'user-agent': 'PycURL' } });223            assert.equal(parser.get_type(), 'bot');224        });225    });226    describe('38.PycURL 7.13.2',function(){227        it('should get device type bot', function(){228            var parser = new device.Parser({ headers: { 'user-agent': 'PycURL/7.13.2' } });229            assert.equal(parser.get_type(), 'bot');230        });231    });232    describe('39.PycURL 7.15.5',function(){233        it('should get device type bot', function(){234            var parser = new device.Parser({ headers: { 'user-agent': 'PycURL/7.15.5' } });235            assert.equal(parser.get_type(), 'bot');236        });237    });238    describe('40.PycURL 7.16.4',function(){239        it('should get device type bot', function(){240            var parser = new device.Parser({ headers: { 'user-agent': 'PycURL/7.16.4' } });241            assert.equal(parser.get_type(), 'bot');242        });243    });244    describe('41.PycURL 7.18.0',function(){245        it('should get device type bot', function(){246            var parser = new device.Parser({ headers: { 'user-agent': 'PycURL/7.18.0' } });247            assert.equal(parser.get_type(), 'bot');248        });249    });250    describe('42.PycURL 7.18.2',function(){251        it('should get device type bot', function(){252            var parser = new device.Parser({ headers: { 'user-agent': 'PycURL/7.18.2' } });253            assert.equal(parser.get_type(), 'bot');254        });255    });256    describe('43.PycURL 7.19.0',function(){257        it('should get device type bot', function(){258            var parser = new device.Parser({ headers: { 'user-agent': 'PycURL/7.19.0' } });259            assert.equal(parser.get_type(), 'bot');260        });261    });262    describe('44.PycURL 7.19.3',function(){263        it('should get device type bot', function(){264            var parser = new device.Parser({ headers: { 'user-agent': 'PycURL/7.19.3' } });265            assert.equal(parser.get_type(), 'bot');266        });267    });268    describe('45.PycURL 7.19.5',function(){269        it('should get device type bot', function(){270            var parser = new device.Parser({ headers: { 'user-agent': 'PycURL/7.19.5' } });271            assert.equal(parser.get_type(), 'bot');272        });273    });274    describe('46.PycURL 7.19.7',function(){275        it('should get device type bot', function(){276            var parser = new device.Parser({ headers: { 'user-agent': 'PycURL/7.19.7' } });277            assert.equal(parser.get_type(), 'bot');278        });279    });280    describe('47.Qseero 1.0.0',function(){281        it('should get device type bot', function(){282            var parser = new device.Parser({ headers: { 'user-agent': 'Qseero v1.0.0' } });283            assert.equal(parser.get_type(), 'bot');284        });285    });286    describe('48.SBIder 0.8-dev',function(){287        it('should get device type bot', function(){288            var parser = new device.Parser({ headers: { 'user-agent': 'SBIder/0.8-dev (SBIder; http://www.sitesell.com/sbider.html; http://support.sitesell.com/contact-support.html)' } });289            assert.equal(parser.get_type(), 'bot');290        });291    });292    describe('49.ScoutJet',function(){293        it('should get device type bot', function(){294            var parser = new device.Parser({ headers: { 'user-agent': 'Mozilla/5.0 (compatible; ScoutJet; http://www.scoutjet.com/)' } });295            assert.equal(parser.get_type(), 'bot');296        });297    });298    describe('50.Scrubby 2.1',function(){299        it('should get device type bot', function(){300            var parser = new device.Parser({ headers: { 'user-agent': 'Scrubby/2.1 (http://www.scrubtheweb.com/)' } });301            assert.equal(parser.get_type(), 'bot');302        });303    });304    describe('51.Scrubby 2.1',function(){305        it('should get device type bot', function(){306            var parser = new device.Parser({ headers: { 'user-agent': 'Mozilla/5.0 (compatible; Scrubby/2.1; +http://www.scrubtheweb.com/abs/meta-check.html)' } });307            assert.equal(parser.get_type(), 'bot');308        });309    });310    describe('52.Scrubby 2.2',function(){311        it('should get device type bot', function(){312            var parser = new device.Parser({ headers: { 'user-agent': 'Scrubby/2.2 (http://www.scrubtheweb.com/)' } });313            assert.equal(parser.get_type(), 'bot');314        });315    });316    describe('53.Scrubby 2.2',function(){317        it('should get device type bot', function(){318            var parser = new device.Parser({ headers: { 'user-agent': 'Mozilla/5.0 (compatible; Scrubby/2.2; +http://www.scrubtheweb.com/)' } });319            assert.equal(parser.get_type(), 'bot');320        });321    });322    describe('54.Scrubby 2.2',function(){323        it('should get device type bot', function(){324            var parser = new device.Parser({ headers: { 'user-agent': 'Mozilla/5.0 (compatible; Scrubby/2.2; http://www.scrubtheweb.com/)' } });325            assert.equal(parser.get_type(), 'bot');326        });327    });328    describe('55.SearchSight 2.0',function(){329        it('should get device type bot', function(){330            var parser = new device.Parser({ headers: { 'user-agent': 'SearchSight/2.0 (http://SearchSight.com/)' } });331            assert.equal(parser.get_type(), 'bot');332        });333    });334    describe('56.semanticdiscovery 0.1',function(){335        it('should get device type bot', function(){336            var parser = new device.Parser({ headers: { 'user-agent': 'semanticdiscovery/0.1' } });337            assert.equal(parser.get_type(), 'bot');338        });339    });340    describe('57.silk 1.0',function(){341        it('should get device type bot', function(){342            var parser = new device.Parser({ headers: { 'user-agent': 'silk/1.0 (+http://www.slider.com/silk.htm)/3.7' } });343            assert.equal(parser.get_type(), 'bot');344        });345    });346    describe('58.silk 1.0',function(){347        it('should get device type bot', function(){348            var parser = new device.Parser({ headers: { 'user-agent': 'Silk/1.0' } });349            assert.equal(parser.get_type(), 'bot');350        });351    });352    describe('59.Sqworm 2.9.85-BETA',function(){353        it('should get device type bot', function(){354            var parser = new device.Parser({ headers: { 'user-agent': 'Sqworm/2.9.85-BETA (beta_release; 20011115-775; i686-pc-linux-gnu)' } });355            assert.equal(parser.get_type(), 'bot');356        });357    });358    describe('60.StackRambler 2.0',function(){359        it('should get device type bot', function(){360            var parser = new device.Parser({ headers: { 'user-agent': 'StackRambler/2.0 (MSIE incompatible)' } });361            assert.equal(parser.get_type(), 'bot');362        });363    });364    describe('61.StackRambler 2.0',function(){365        it('should get device type bot', function(){366            var parser = new device.Parser({ headers: { 'user-agent': 'StackRambler/2.0' } });367            assert.equal(parser.get_type(), 'bot');368        });369    });370    describe('62.truwoGPS 1.0',function(){371        it('should get device type bot', function(){372            var parser = new device.Parser({ headers: { 'user-agent': 'truwoGPS/1.0 (GNU/Linux; U; i686; en-US; +http://www.lan4lano.net/browser.html )' } });373            assert.equal(parser.get_type(), 'bot');374        });375    });376    describe('63.updated 0.1-beta',function(){377        it('should get device type bot', function(){378            var parser = new device.Parser({ headers: { 'user-agent': 'updated/0.1-beta (updated; http://www.updated.com; updated@updated.com)' } });379            assert.equal(parser.get_type(), 'bot');380        });381    });382    describe('64.voyager 1.0',function(){383        it('should get device type bot', function(){384            var parser = new device.Parser({ headers: { 'user-agent': 'voyager/1.0' } });385            assert.equal(parser.get_type(), 'bot');386        });387    });388    describe('65.VYU2',function(){389        it('should get device type bot', function(){390            var parser = new device.Parser({ headers: { 'user-agent': 'VYU2 (GNU; OpenRISC)' } });391            assert.equal(parser.get_type(), 'bot');392        });393    });394    describe('66.webcollage 1.114',function(){395        it('should get device type bot', function(){396            var parser = new device.Parser({ headers: { 'user-agent': 'webcollage/1.114' } });397            assert.equal(parser.get_type(), 'bot');398        });399    });400    describe('67.webcollage 1.117',function(){401        it('should get device type bot', function(){402            var parser = new device.Parser({ headers: { 'user-agent': 'webcollage/1.117' } });403            assert.equal(parser.get_type(), 'bot');404        });405    });406    describe('68.webcollage 1.125',function(){407        it('should get device type bot', function(){408            var parser = new device.Parser({ headers: { 'user-agent': 'webcollage/1.125' } });409            assert.equal(parser.get_type(), 'bot');410        });411    });412    describe('69.webcollage 1.129',function(){413        it('should get device type bot', function(){414            var parser = new device.Parser({ headers: { 'user-agent': 'webcollage/1.129' } });415            assert.equal(parser.get_type(), 'bot');416        });417    });418    describe('70.webcollage 1.93',function(){419        it('should get device type bot', function(){420            var parser = new device.Parser({ headers: { 'user-agent': 'webcollage/1.93' } });421            assert.equal(parser.get_type(), 'bot');422        });423    });424    describe('71.yacybot',function(){425        it('should get device type bot', function(){426            var parser = new device.Parser({ headers: { 'user-agent': 'yacy (i386 Linux 2.6.14-1.1653_FC4smp; java 1.5.0_04; Europe/de) yacy.net' } });427            assert.equal(parser.get_type(), 'bot');428        });429    });430    describe('72.yacybot',function(){431        it('should get device type bot', function(){432            var parser = new device.Parser({ headers: { 'user-agent': 'yacy (i386 Linux 2.4.20-021stab028.17.777-enterprise; java 1.4.2_08; Europe/en) yacy.net' } });433            assert.equal(parser.get_type(), 'bot');434        });435    });436    describe('73.yoogliFetchAgent 0.1',function(){437        it('should get device type bot', function(){438            var parser = new device.Parser({ headers: { 'user-agent': 'yoogliFetchAgent/0.1' } });439            assert.equal(parser.get_type(), 'bot');440        });441    });442    describe('74.Zao 0.1',function(){443        it('should get device type bot', function(){444            var parser = new device.Parser({ headers: { 'user-agent': 'Zao/0.1 (http://www.kototoi.org/zao/)' } });445            assert.equal(parser.get_type(), 'bot');446        });447    });448    describe('75.Zao 0.1',function(){449        it('should get device type bot', function(){450            var parser = new device.Parser({ headers: { 'user-agent': 'Zao/0.1 (http://www.kototoi.org/zao/)' } });451            assert.equal(parser.get_type(), 'bot');452        });453    });...core_mlg.js
Source:core_mlg.js  
...39};40function filter(f, xs) { 41return (function() { 42	var el_to_match = xs;43	if (get_type(el_to_match) == 'Array') {44		if (el_to_match.length == 0) {45			return [];46		}47	}48	if (get_type(el_to_match) == 'Array') {49		if (typeof el_to_match[0] != 'undefined') {50			var x = el_to_match[0];51			var rest = el_to_match.slice(1);52			return (function() { 53if (f(x)) { 54return cons(x, filter(f, rest));} else { 55return filter(f, rest);}})();56		}57	}})();58};59function take(n, xs) { 60return (function() { 61	var el_to_match = [n, xs];62	if (get_type(el_to_match) == 'Array') {63		if (el_to_match.length == 2) {64			if (0 == el_to_match[0]) {65				return [];66			}67		}68	}69	if (get_type(el_to_match) == 'Array') {70		if (el_to_match.length == 2) {71			if (get_type(el_to_match[1]) == 'Array') {72				if (el_to_match[1].length == 0) {73					return [];74				}75			}76		}77	}78	if (get_type(el_to_match) == 'Array') {79		if (el_to_match.length == 2) {80			var a = el_to_match[0];81			if (get_type(el_to_match[1]) == 'Array') {82				if (typeof el_to_match[1][0] != 'undefined') {83					var x = el_to_match[1][0];84					var rest = el_to_match[1].slice(1);85					return cons(x, take(dec(a), rest));86				}87			}88		}89	}})();90};91function foldl(acc, f, xs) { 92return (function() { 93if (empty(xs)) { 94return acc;} else { 95return foldl(f(acc, head(xs)), f, tail(xs));}})();96};97function remove_nth(n, xs) { 98return (function() { 99	var el_to_match = [n, xs];100	if (get_type(el_to_match) == 'Array') {101		if (el_to_match.length == 2) {102			if (0 == el_to_match[0]) {103				if (get_type(el_to_match[1]) == 'Array') {104					if (el_to_match[1].length == 0) {105						return [];106					}107				}108			}109		}110	}111	if (get_type(el_to_match) == 'Array') {112		if (el_to_match.length == 2) {113			if (0 == el_to_match[0]) {114				if (get_type(el_to_match[1]) == 'Array') {115					if (typeof el_to_match[1][0] != 'undefined') {116						var x = el_to_match[1][0];117						var rest = el_to_match[1].slice(1);118						return rest;119					}120				}121			}122		}123	}124	if (get_type(el_to_match) == 'Array') {125		if (el_to_match.length == 2) {126			var i = el_to_match[0];127			if (get_type(el_to_match[1]) == 'Array') {128				if (typeof el_to_match[1][0] != 'undefined') {129					var x = el_to_match[1][0];130					var rest = el_to_match[1].slice(1);131					return cons(x, remove_nth(dec(i), rest));132				}133			}134		}135	}})();136};137function sum(xs) { 138return foldl(0, (function(a,b) { return a + b; }), xs);139};140function str(xs) { 141return foldl("", (function(a,b) { return a + b; }), xs);142};143function flatten(xs) { 144return foldl([], concat, xs);145};146function any(f, xs) { 147return (function() { 148	var el_to_match = xs;149	if (get_type(el_to_match) == 'Array') {150		if (el_to_match.length == 0) {151			return false;152		}153	}154	if (get_type(el_to_match) == 'Array') {155		if (typeof el_to_match[0] != 'undefined') {156			var x = el_to_match[0];157			var rest = el_to_match.slice(1);158			return (function() { 159if (f(x)) { 160return true;} else { 161return any(f, rest);}})();162		}163	}})();164};165function all(f, xs) { 166return (function() { 167	var el_to_match = xs;168	if (get_type(el_to_match) == 'Array') {169		if (el_to_match.length == 0) {170			return true;171		}172	}173	if (get_type(el_to_match) == 'Array') {174		if (typeof el_to_match[0] != 'undefined') {175			var x = el_to_match[0];176			var rest = el_to_match.slice(1);177			return (function() { 178if (f(x)) { 179return all(f, rest);} else { 180return false;}})();181		}182	}})();183};184function and(bools) { 185return all(id, bools);186};187function or(bools) { 188return any(id, bools);189};190function find(f, xs) { 191return (function() { 192	var el_to_match = xs;193	if (get_type(el_to_match) == 'Array') {194		if (el_to_match.length == 0) {195			return null;196		}197	}198	if (get_type(el_to_match) == 'Array') {199		if (typeof el_to_match[0] != 'undefined') {200			var x = el_to_match[0];201			var rest = el_to_match.slice(1);202			return (function() { 203if (f(x)) { 204return x;} else { 205return find(f, rest);}})();206		}207	}})();208};209function join(s, xs) { 210return (function() { 211	var el_to_match = xs;212	if (get_type(el_to_match) == 'Array') {213		if (el_to_match.length == 0) {214			return "";215		}216	}217	if (get_type(el_to_match) == 'Array') {218		if (el_to_match.length == 1) {219			var x = el_to_match[0];220			return (function(a,b) { return a + b; })("", x);221		}222	}223	if (get_type(el_to_match) == 'Array') {224		if (typeof el_to_match[0] != 'undefined') {225			var x = el_to_match[0];226			var rest = el_to_match.slice(1);227			return str([x, s, join(s, rest)]);228		}229	}})();230};231function inc(a) { 232return (function(a,b) { return a + b; })(a, 1);233};234function dec(a) { 235return (function(a,b) { return a - b; })(a, 1);236};237function mod(a, b) { 238return (function(a,b) { return a % b; })((function(a,b) { return a + b; })((function(a,b) { return a % b; })(a, b), b), b);239};240function min(a, b) { 241return (function() { 242if ((function(a,b) { return a <= b; })(a, b)) { 243return a;} else { 244return b;}})();245};246function max(a, b) { 247return (function() { 248if ((function(a,b) { return a >= b; })(a, b)) { 249return a;} else { 250return b;}})();251};252function range(start, end) { 253return (function() { 254if ((function(a,b) { return a == b; })(start, end)) { 255return [end];} else { 256return cons(start, range(inc(start), end));}})();257};258function insert_at(n, el, xs) { 259return (function() { 260	var el_to_match = [n, xs];261	if (get_type(el_to_match) == 'Array') {262		if (el_to_match.length == 2) {263			if (get_type(el_to_match[1]) == 'Array') {264				if (el_to_match[1].length == 0) {265					return [el];266				}267			}268		}269	}270	if (get_type(el_to_match) == 'Array') {271		if (el_to_match.length == 2) {272			if (0 == el_to_match[0]) {273				if (get_type(el_to_match[1]) == 'Array') {274					if (typeof el_to_match[1][0] != 'undefined') {275						var x = el_to_match[1][0];276						var rest = el_to_match[1].slice(1);277						return concat([el, x], rest);278					}279				}280			}281		}282	}283	if (get_type(el_to_match) == 'Array') {284		if (el_to_match.length == 2) {285			if (get_type(el_to_match[1]) == 'Array') {286				if (typeof el_to_match[1][0] != 'undefined') {287					var x = el_to_match[1][0];288					var rest = el_to_match[1].slice(1);289					return cons(x, insert_at(dec(n), el, rest));290				}291			}292		}293	}})();294};295function starts_with(s, input) { 296return (function(a,b) { return a == b; })(input.indexOf(s), 0);...dmesg.py
Source:dmesg.py  
...27    def invoke(self, arg, from_tty):28        inf = gdb.inferiors()[0]29        # read in prb structure30        prb_addr = int(str(gdb.parse_and_eval("(void *)'printk.c'::prb")).split()[0], 16)31        sz = printk_ringbuffer_type.get_type().sizeof32        prb = utils.read_memoryview(inf, prb_addr, sz).tobytes()33        # read in descriptor ring structure34        off = printk_ringbuffer_type.get_type()['desc_ring'].bitpos // 835        addr = prb_addr + off36        sz = prb_desc_ring_type.get_type().sizeof37        desc_ring = utils.read_memoryview(inf, addr, sz).tobytes()38        # read in descriptor array39        off = prb_desc_ring_type.get_type()['count_bits'].bitpos // 840        desc_ring_count = 1 << utils.read_u32(desc_ring, off)41        desc_sz = prb_desc_type.get_type().sizeof42        off = prb_desc_ring_type.get_type()['descs'].bitpos // 843        addr = utils.read_ulong(desc_ring, off)44        descs = utils.read_memoryview(inf, addr, desc_sz * desc_ring_count).tobytes()45        # read in info array46        info_sz = printk_info_type.get_type().sizeof47        off = prb_desc_ring_type.get_type()['infos'].bitpos // 848        addr = utils.read_ulong(desc_ring, off)49        infos = utils.read_memoryview(inf, addr, info_sz * desc_ring_count).tobytes()50        # read in text data ring structure51        off = printk_ringbuffer_type.get_type()['text_data_ring'].bitpos // 852        addr = prb_addr + off53        sz = prb_data_ring_type.get_type().sizeof54        text_data_ring = utils.read_memoryview(inf, addr, sz).tobytes()55        # read in text data56        off = prb_data_ring_type.get_type()['size_bits'].bitpos // 857        text_data_sz = 1 << utils.read_u32(text_data_ring, off)58        off = prb_data_ring_type.get_type()['data'].bitpos // 859        addr = utils.read_ulong(text_data_ring, off)60        text_data = utils.read_memoryview(inf, addr, text_data_sz).tobytes()61        counter_off = atomic_long_type.get_type()['counter'].bitpos // 862        sv_off = prb_desc_type.get_type()['state_var'].bitpos // 863        off = prb_desc_type.get_type()['text_blk_lpos'].bitpos // 864        begin_off = off + (prb_data_blk_lpos_type.get_type()['begin'].bitpos // 8)65        next_off = off + (prb_data_blk_lpos_type.get_type()['next'].bitpos // 8)66        ts_off = printk_info_type.get_type()['ts_nsec'].bitpos // 867        len_off = printk_info_type.get_type()['text_len'].bitpos // 868        # definitions from kernel/printk/printk_ringbuffer.h69        desc_committed = 170        desc_finalized = 271        desc_sv_bits = utils.get_long_type().sizeof * 872        desc_flags_shift = desc_sv_bits - 273        desc_flags_mask = 3 << desc_flags_shift74        desc_id_mask = ~desc_flags_mask75        # read in tail and head descriptor ids76        off = prb_desc_ring_type.get_type()['tail_id'].bitpos // 877        tail_id = utils.read_u64(desc_ring, off + counter_off)78        off = prb_desc_ring_type.get_type()['head_id'].bitpos // 879        head_id = utils.read_u64(desc_ring, off + counter_off)80        did = tail_id81        while True:82            ind = did % desc_ring_count83            desc_off = desc_sz * ind84            info_off = info_sz * ind85            # skip non-committed record86            state = 3 & (utils.read_u64(descs, desc_off + sv_off +87                                        counter_off) >> desc_flags_shift)88            if state != desc_committed and state != desc_finalized:89                if did == head_id:90                    break91                did = (did + 1) & desc_id_mask92                continue...node_params.js
Source:node_params.js  
...15 * Get type of node for identification in parameter functions16 * @param d dictionary representing attributes of node17 * @returns {string} indicates type of node18 */19function get_type(d) {20    return d.labels.includes('Host') ? 'Host'21        : d.labels.includes('Conn') ? 'Conn'22            : d.labels.includes('DNS') ? 'DNS'23                : d.labels.includes('File') ? 'File'24                    : d.labels.includes('SMTP') ? 'SMTP'25                        : d.labels.includes('FTP') ? 'FTP'26                            : d.labels.includes('HTTP') ? 'HTTP'27                                : d.labels.includes('Weird') ? 'Weird'28                                    : 'Unknown';29}30/*31Node attribute template32function node_(d) {33    return get_type(d) === 'Host' ?34        : get_type(d) === 'Conn' ?35            : ;36}37 */38/**39 * Get radius for node type, in pixels40 * @param d dictionary representing attributes of node41 * @returns {number} radius value42 */43function node_size(d) {44    return get_type(d) === 'Host' ? 3545        : get_type(d) === 'Conn' ? 1846            : get_type(d) === 'DNS' ? 1847                : get_type(d) === 'File' ? 1948                    : get_type(d) === 'SMTP' ? 1949                        : get_type(d) === 'FTP' ? 1950                            : get_type(d) === 'HTTP' ? 1951                                : get_type(d) === 'Weird' ? 1952                                    : 25;53}54/**55 * Get circle background color by node type56 * @param d dictionary representing attributes of node57 * @returns {string} color value58 */59function node_color(d) {60    return get_type(d) === 'Host' ? '#ffffff'61        : get_type(d) === 'Conn' ? '#515151'62            : get_type(d) === 'DNS' ? '#b13738'63                : get_type(d) === 'File' ? '#57c65c'64                    : get_type(d) === 'SMTP' ? '#ffc65c'65                        : get_type(d) === 'FTP' ? '#ddc65c'66                            : get_type(d) === 'HTTP' ? '#ccc65c'67                                : get_type(d) === 'Weird' ? '#57ff5c'68                                    : '#141010';69}70/**71 * Get text color and opacity for node type72 * @param d dictionary representing attributes of node73 * @returns {string} rgb value specifying color and opacity74 */75function node_text_color(d) {76    return get_type(d) === 'Host' ? 'rgba(0,0,0,1)'77        : get_type(d) === 'Conn' ? 'rgb(255,255,255)'78            : get_type(d) === 'DNS' ? '#181818'79                : get_type(d) === 'File' ? '#221f21'80                    : get_type(d) === 'SMTP' ? '#221f21'81                        : get_type(d) === 'FTP' ? '#221f21'82                            : get_type(d) === 'HTTP' ? '#221f21'83                                : get_type(d) === 'Weird' ? '#221f21'84                                    : 'rgba(255,255,255,0.8)';85}86/**87 * Get configured node property to be displayed as an identification label88 * @param d dictionary representing attributes of node89 * @returns {string} identifier value90 */91function node_label(d) {92    return get_type(d) === 'Host' ? d.properties.address93        : get_type(d) === 'Conn' ? d.properties.id_resp_p94            : get_type(d) === 'DNS' ? d.properties.qtype_name95                : get_type(d) === 'SMTP' ? d.properties.helo96                    : get_type(d) === 'FTP' ? d.properties.arg97                        : get_type(d) === 'HTTP' ? d.properties.id_resp_p98                            : get_type(d) === 'Weird' ? d.properties.id_resp_p99                                : d.id;100}101/**102 * Get a formatted string showing all properties for a node103 * @param d dictionary representing attributes of node104 * @returns {string} formatted string105 */106function node_tooltip(d) {107    let content = get_type(d) + '<br>';108    content += 'ID: ' + d.id + '<br>';109    for (let key in d.properties) {110        content += key + ': ' + d.properties[key] + '<br>';111    }112    return content;...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!!
