Best JavaScript code snippet using nightwatch
enum.convert.js
Source:enum.convert.js  
1/**2 * è·å产åç±»åæè¿°3 * @type {{getDescription: ProductType.getDescription}}4 */5var ProductType = {6    getDescription: function (index) {7        switch (index) {8            case 1001:9                return "æ°æä¸äº«";10            case 1101:11                return "天添ç";12            case 1102:13                return "ä¼çå®";14            case 1201:15                return "ä¿¡æ";16            case 1301:17                return "éªèµå®";18            case 1302:19                return "éªè¿å®";20            case 1401:21                return "0å
è´æº";22            case 1501:23                return "ææ¯å®";24            case 1601:25                return "éªå©å®";26            case 1602:27                return "éªå©å®C款";28            case 1701:29                return "æµ®å¨æ";30            case 1702:31                return "宿´»å®";32            case 1801:33                return "å®çå®";34            case 1802:35                return "å®çå®";36            case 1901:37                return "åæå®";38            case 2101:39                return "ææ°ç";40            case 2201:41                return "æ¥çå®";42            case 3101 :43                return "æ´»æå®";44            case 3201:45                return "é¶æ´»å®";46            case 1902:47                return "é±ä¿¡å®";48            default:49                return null;50        }51    }52}53/**54 * è·å产åç¶ææè¿°55 * @type {{getDescription: ProductStatus.getDescription}}56 */57var ProductStatus = {58    getDescription: function (index) {59        switch (index) {60            case -1:61                return "<span style='color: #ab1e1e'>å·²å é¤</span>";62            case 1:63                return "<span style='color: #ACCD3C'>å¾
审核</span>";64            case 2:65                return "<span style='color: #00dd1c'>éå®ä¸</span>";66            case 3:67                return "<span style='color: #1006F1'>å·²å®å®</span>";68            case 4:69                return "<span style='color: #2fa4e7'>忬¾ä¸</span>";70            case 5:71                return "<span style='color: #117700'>已忬¾</span>";72            case 8:73                return "<span style='color: #770088'>æ°æ®å¼å¸¸</span>";74            case 9:75                return "<span style='color: #95B8E7'>é¢ä¸æ¶</span>";76            case 10:77                return "<span style='color: #95B8E7'>æµæ </span>";78            case 11:79                return "<span style='color: #95B8E7'>åéåè¦</span>";80        }81    }82}83/**84 * å©çæè¿°85 * @type {{getDescription: Rate.getDescription}}86 */87var Rate = {88    getDescription: function (index) {89        return index + "%";90    }91}92/**93 *æèµç¶ææè¿°94 * @type{{getDescription:InvestStatus.getDescription}}95 */96var InvestStatus = {97    getDescription: function (index) {98        switch (index) {99            case 1:100                return "å¾
æ¯ä»";101            case 2:102                return "æèµæå";103            case 3:104                return "已忬¾";105            case 4:106                return "æ¯ä»å¤±è´¥";107            case 5:108                return "åéä¸";109            case 6:110                return "åé失败";111            case 7:112                return "ç管è¡å¤çä¸";113            default:114                return null;115        }116    }117}118/**119 * äº§åæ¾ç¤ºé
ç½®ä½ç½®120 * @type {{getDescription: ProductShowPosition.getDescription}}121 */122var ProductShowPosition = {123    getDescription: function (index) {124        switch (index) {125            case 1:126                return "é¦é¡µ";127            case 2:128                return "å表";129            case 3:130                return "产ååç±»";131        }132    }133}134/**135 * èµåç¶æ136 * @type{{getDescription:RedeemStatus.getDescription}}137 */138var RedeemStatus = {139    getDescription: function (index) {140        switch (index) {141            case 1:142                return "ä¸å¯èµå";143            case 2:144                return "å¯èµå";145            case 3:146                return "é¨åèµå";147            case 4:148                return "å·²èµå";149            default:150                return null;151        }152    }153}154/**155 * 产å详æ
æ¾ç¤ºä½ç½®156 * @type {{getDescription: ProductDetailsShowPage.getDescription}}157 */158var ProductDetailsShowPage = {159    getDescription: function (index) {160        switch (index) {161            case 1:162                return "产åä¿¡æ¯é¡µ";163            case 2:164                return "项ç®å忬¾äººé¡µ";165            default:166                return null;167        }168    }169}170/**171 * å©çç±»å172 * @type{{getDescription:RateType.getDescription}}173 */174var RateType = {175    getDescription: function (index) {176        switch (index) {177            case 1:178                return "åºç¡å©ç";179            case 2:180                return "ä¼åå©ç";181            case 3:182                return "æ´»å¨å©ç";183            case 4:184                return "转让å©ç";185            case 5:186                return "åéå©ç";187            default:188                return null;189        }190    }191}192/**193 * 产åéå±ä¿¡æ¯194 * @type {{getDescription: ProductFeatureType.getDescription}}195 */196var ProductFeatureType = {197    getDescription: function (index) {198        switch (index) {199            case 1:200                return "产å详æ
";201            case 2:202                return "å®å
¨ä¿é";203            case 3:204                return "产ååè®®";205            case 4:206                return "产åç¹ç¹åéå人群";207            case 5:208                return "产åç®ä»ååç";209            case 6:210                return "åéææ¶ç";211            case 301:212                return "产ååè®®";213            case 302:214                return "ä¿¡æ¯å¨è¯¢ä¸ç®¡çæå¡åè®®";215            case 303:216                return "åºæè½¬è®©æå¡åè®®";217            default:218                return null;219        }220    }221}222/**223 * èµå请æ±ç¶æ224 * @type{{getDescription:RedeemRequestStatus.getDescription}}225 */226var RedeemRequestStatus = {227    getDescription: function (index) {228        switch (index) {229            case 1:230                return "å¾
忬¾";231            case 2:232                return "忬¾ä¸";233            case 3:234                return "已忬¾";235            case 4:236                return "忬¾å¤±è´¥";237            case 5:238                return "å¾
确认";239            case 6:240                return "å·²æ¤é";241            default:242                return null;243        }244    }245}246/**247 * 广åç±»å248 * @type {{getDescription: ProductAdType.getDescription}}249 */250var ProductAdType = {251    getDescription: function (index) {252        switch (index) {253            case 1:254                return "产å宣传";255            case 2:256                return "ä¼å宣传";257            case 3:258                return "æ´»å¨å®£ä¼ ";259            default:260                return null;261        }262    }263}264/**265 * 忬¾äººç±»å266 * @type {{getDescription: BorrowerType.getDescription}}267 */268var BorrowerType = {269    getDescription: function (index) {270        switch (index) {271            case 1:272                return "ä¼ä¸";273            case 2:274                return "个人";275            default:276                return null;277        }278    }279}280/**281 * 忬¾ç¶æ282 * @type{{getDescription:RefundStatus.getDescription}}283 */284var RefundStatus = {285    getDescription: function (index) {286        switch (index) {287            case 1:288                return "å¾
å¤ç";289            case 2:290                return "忬¾ä¸";291            case 3:292                return "已忬¾";293            case 4:294                return "忬¾å¤±è´¥";295            default:296                return null;297        }298    }299}300/**301 *å¹¿åæ¾ç¤ºä½ç½®302 *@type{{getDescription: ProductAdShowPosition.getDescription}}303 */304var ProductAdShowPosition = {305    getDescription: function (index) {306        switch (index) {307            case 1:308                return "å表";309            case 2:310                return "详æ
页|å表";311            case 3:312                return "详æ
页";313        }314    }315}316/**317 * å¹¿åæ¯å¦ç»å½318 * @type {{getDescription: ProductAdIsLogin.getDescription}}319 */320var ProductAdIsLogin = {321    getDescription: function (index) {322        switch (index) {323            case 0:324                return "å
¨é¨";325            case 1:326                return "ç»å½";327            case 2:328                return "ä¸ç»å½";329            default:330                return "å
¨é¨";331        }332    }333}334/**335 * å æ¯å©çç±»å336 * @type {{getDescription: RateType.getDescription}}337 */338var RateType = {339    getDescription: function (index) {340        switch (index) {341            case 1:342                return "产åå©ç";343            case 2:344                return "ä¼åå æ¯";345            case 3:346                return "æ´»å¨å æ¯";347            case 5:348                return "åéå©ç";349        }350    }351}352var CreateEvent = {353    getDescription: function (index) {354        switch (index) {355            case 1:356                return "注å";357            case 2:358                return "è´ä¹°";359            case 4:360                return "è±æ";361        }362    }363}364var SealType = {365    getDescription: function (index) {366        switch (index) {367            case 1:368                return "ç¨æ·ç¾å";369            case 2:370                return "å
¬å¸ç¾ç« ";371        }372    }373}374var UserType = {375    getDescription: function (index) {376        switch (index) {377            case 1:378                return "åºå人";379            case 2:380                return "忬¾äºº";381            default:382                return "";383        }384    }385}386var holidayFlagType = {387    getDescription: function (index) {388        if (index) {389            return "è忥";390        } else {391            return "工使¥";392        }393    }394}395var productBidType = {396    getDescription: function (index) {397        switch (index) {398            case 0:399                return "ä¸éå¶";400            case 1:401                return "æ®éæ ";402            case 2:403                return "æ°ææ ";404            case 3:405                return "ç¹æ æ ";406        }407    }408}409var ListModelType = {410    getDescription: function (index) {411        switch (index) {412            case 0:413                return "详æ
";414            case 1:415                return "å表";416        }417    }418}419var newbieFlagType = {420    getDescription: function (index) {421        if (index) {422            return "æ°æä¸åº";423        } else {424            return "éæ°æä¸åº";425        }426    }427}428var showFlag = {429    getDescription: function (index) {430        if (index) {431            return "æ¾ç¤º";432        } else {433            return "䏿¾ç¤º";434        }435    }436}437var ProductModuleBizType = {438    getDescription: function (index) {439        switch (index) {440            case 1:441                return "产åç±»å";442            case 2:443                return "ææ ç±»å";444        }445    }446}447var PriorityType = {448    getDescription: function (index) {449        switch (index) {450            case 0:451                return "æ®é";452            case 1:453                return "ä¼å
";454        }455    }456}457var ProductPriStatus = {458    getDescription: function (index) {459        switch (index) {460            case 1:461                return "ææ";462            case 2:463                return "已宿";464            case -1:465                return "å·²å é¤";466        }467    }468}469var ReportType = {470    getDescription: function (index) {471        switch (index) {472            case 1:473                return "æ¥æ¥";474            case 2:475                return "ææ¥";476            case 3:477                return "å¹´æ¥";478        }479    }480}481var PeriodUnit = {482    getDescription: function (index) {483        switch (index) {484            case 1:485                return "天";486            case 2:487                return "æ";488        }489    }490}491var ReportStatus ={492    getDescription: function (index) {493        switch (index) {494            case 1:495                return "æå";496            case 2:497                return "<span style='color:red'>失败</span>";498            default:499                return "ææ æ°æ®";500        }501    }502}503var IsTransfer ={504    getDescription: function (index) {505        switch (index) {506            case 1:507                return "ä¸å¯è½¬è®©";508            case 2:509                return "å¯è½¬è®©";510        }511    }512}513var RefundWay = {514    getDescription: function (index) {515        switch (index) {516            case 1:517                return "䏿¬¡æ§è¿æ¬ä»æ¯";518            case 2:519                return "ææ¥è®¡æ¯";520            case 3:521                return "æ¯æä»æ¯å°æè¿æ¬";522            case 4:523                return "ç颿¬æ¯";524            case 5:525                return "çæ¬çæ¯";526            case 6:527                return "çé¢çæ¯";528            case 7:529                return "å
æ¯åæ¬";530        }531    }...Restaurants.js
Source:Restaurants.js  
...9        'name'10    ],11    12    data: [13        { description: getDescription(), rating: Math.random() * 5, name: 'Cheesecake Factory', cuisine: 'American' },14        { description: getDescription(), rating: Math.random() * 5, name: 'University Cafe', cuisine: 'American' },15        { description: getDescription(), rating: Math.random() * 5, name: 'Slider Bar', cuisine: 'American' },16        { description: getDescription(), rating: Math.random() * 5, name: 'Shokolaat', cuisine: 'American' },17        { description: getDescription(), rating: Math.random() * 5, name: 'Gordon Biersch', cuisine: 'American' },18        { description: getDescription(), rating: Math.random() * 5, name: 'Crepevine', cuisine: 'American' },19        { description: getDescription(), rating: Math.random() * 5, name: 'Creamery', cuisine: 'American' },20        { description: getDescription(), rating: Math.random() * 5, name: 'Old Pro', cuisine: 'American' },21        { description: getDescription(), rating: Math.random() * 5, name: 'Nola\'s', cuisine: 'Cajun' },22        { description: getDescription(), rating: Math.random() * 5, name: 'House of Bagels', cuisine: 'Bagels' },23        { description: getDescription(), rating: Math.random() * 5, name: 'The Prolific Oven', cuisine: 'Sandwiches' },24        { description: getDescription(), rating: Math.random() * 5, name: 'La Strada', cuisine: 'Italian' },25        { description: getDescription(), rating: Math.random() * 5, name: 'Buca di Beppo', cuisine: 'Italian' },26        { description: getDescription(), rating: Math.random() * 5, name: 'Pasta?', cuisine: 'Italian' },27        { description: getDescription(), rating: Math.random() * 5, name: 'Madame Tam', cuisine: 'Asian' },28        { description: getDescription(), rating: Math.random() * 5, name: 'Sprout Cafe', cuisine: 'Salad' },29        { description: getDescription(), rating: Math.random() * 5, name: 'Pluto\'s', cuisine: 'Salad' },30        { description: getDescription(), rating: Math.random() * 5, name: 'Junoon', cuisine: 'Indian' },31        { description: getDescription(), rating: Math.random() * 5, name: 'Bistro Maxine', cuisine: 'French' },32        { description: getDescription(), rating: Math.random() * 5, name: 'Three Seasons', cuisine: 'Vietnamese' },33        { description: getDescription(), rating: Math.random() * 5, name: 'Sancho\'s Taquira', cuisine: 'Mexican' },34        { description: getDescription(), rating: Math.random() * 5, name: 'Reposado', cuisine: 'Mexican' },35        { description: getDescription(), rating: Math.random() * 5, name: 'Siam Royal', cuisine: 'Thai' },36        { description: getDescription(), rating: Math.random() * 5, name: 'Krung Siam', cuisine: 'Thai' },37        { description: getDescription(), rating: Math.random() * 5, name: 'Thaiphoon', cuisine: 'Thai' },38        { description: getDescription(), rating: Math.random() * 5, name: 'Tamarine', cuisine: 'Vietnamese' },39        { description: getDescription(), rating: Math.random() * 5, name: 'Joya', cuisine: 'Tapas' },40        { description: getDescription(), rating: Math.random() * 5, name: 'Jing Jing', cuisine: 'Chinese' },41        { description: getDescription(), rating: Math.random() * 5, name: 'Patxi\'s Pizza', cuisine: 'Pizza' },42        { description: getDescription(), rating: Math.random() * 5, name: 'Evvia Estiatorio', cuisine: 'Mediterranean' },43        { description: getDescription(), rating: Math.random() * 5, name: 'Cafe 220', cuisine: 'Mediterranean' },44        { description: getDescription(), rating: Math.random() * 5, name: 'Cafe Renaissance', cuisine: 'Mediterranean' },45        { description: getDescription(), rating: Math.random() * 5, name: 'Kan Zeman', cuisine: 'Mediterranean' },46        { description: getDescription(), rating: Math.random() * 5, name: 'Gyros-Gyros', cuisine: 'Mediterranean' },47        { description: getDescription(), rating: Math.random() * 5, name: 'Mango Caribbean Cafe', cuisine: 'Caribbean' },48        { description: getDescription(), rating: Math.random() * 5, name: 'Coconuts Caribbean Restaurant & Bar', cuisine: 'Caribbean' },49        { description: getDescription(), rating: Math.random() * 5, name: 'Rose & Crown', cuisine: 'English' },50        { description: getDescription(), rating: Math.random() * 5, name: 'Baklava', cuisine: 'Mediterranean' },51        { description: getDescription(), rating: Math.random() * 5, name: 'Mandarin Gourmet', cuisine: 'Chinese' },52        { description: getDescription(), rating: Math.random() * 5, name: 'Bangkok Cuisine', cuisine: 'Thai' },53        { description: getDescription(), rating: Math.random() * 5, name: 'Darbar Indian Cuisine', cuisine: 'Indian' },54        { description: getDescription(), rating: Math.random() * 5, name: 'Mantra', cuisine: 'Indian' },55        { description: getDescription(), rating: Math.random() * 5, name: 'Janta', cuisine: 'Indian' },56        { description: getDescription(), rating: Math.random() * 5, name: 'Hyderabad House', cuisine: 'Indian' },57        { description: getDescription(), rating: Math.random() * 5, name: 'Starbucks', cuisine: 'Coffee' },58        { description: getDescription(), rating: Math.random() * 5, name: 'Peet\'s Coffee', cuisine: 'Coffee' },59        { description: getDescription(), rating: Math.random() * 5, name: 'Coupa Cafe', cuisine: 'Coffee' },60        { description: getDescription(), rating: Math.random() * 5, name: 'Lytton Coffee Company', cuisine: 'Coffee' },61        { description: getDescription(), rating: Math.random() * 5, name: 'Il Fornaio', cuisine: 'Italian' },62        { description: getDescription(), rating: Math.random() * 5, name: 'Lavanda', cuisine: 'Mediterranean' },63        { description: getDescription(), rating: Math.random() * 5, name: 'MacArthur Park', cuisine: 'American' },64        { description: getDescription(), rating: Math.random() * 5, name: 'St Michael\'s Alley', cuisine: 'Californian' },65        { description: getDescription(), rating: Math.random() * 5, name: 'Cafe Renzo', cuisine: 'Italian' },66        { description: getDescription(), rating: Math.random() * 5, name: 'Osteria', cuisine: 'Italian' },67        { description: getDescription(), rating: Math.random() * 5, name: 'Vero', cuisine: 'Italian' },68        { description: getDescription(), rating: Math.random() * 5, name: 'Cafe Renzo', cuisine: 'Italian' },69        { description: getDescription(), rating: Math.random() * 5, name: 'Miyake', cuisine: 'Sushi' },70        { description: getDescription(), rating: Math.random() * 5, name: 'Sushi Tomo', cuisine: 'Sushi' },71        { description: getDescription(), rating: Math.random() * 5, name: 'Kanpai', cuisine: 'Sushi' },72        { description: getDescription(), rating: Math.random() * 5, name: 'Pizza My Heart', cuisine: 'Pizza' },73        { description: getDescription(), rating: Math.random() * 5, name: 'New York Pizza', cuisine: 'Pizza' },74        { description: getDescription(), rating: Math.random() * 5, name: 'California Pizza Kitchen', cuisine: 'Pizza' },75        { description: getDescription(), rating: Math.random() * 5, name: 'Round Table', cuisine: 'Pizza' },76        { description: getDescription(), rating: Math.random() * 5, name: 'Loving Hut', cuisine: 'Vegan' },77        { description: getDescription(), rating: Math.random() * 5, name: 'Garden Fresh', cuisine: 'Vegan' },78        { description: getDescription(), rating: Math.random() * 5, name: 'Cafe Epi', cuisine: 'French' },79        { description: getDescription(), rating: Math.random() * 5, name: 'Tai Pan', cuisine: 'Chinese' }80    ]81});82function getDescription(){83    var description;84    if (!getDescription.description) {85        getDescription.description = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.".split(/[\W]+/);86    }87    description = getDescription.description.sort(randomSorter);88    return description.join(' ');89}90function randomSorter(a,b) {91    return 0.5 - Math.random();...sceneloader.py
Source:sceneloader.py  
...56                    desc = dict(classname='CylinderAffordanceItem', Name=name, uuid=newUUID(), pose=p, Color=color, Radius=float(col.geometry_data['radius']), Length = float(col.geometry_data['length']))57                    self.affordanceManager.newAffordanceFromDescription(desc)58    59    def generateBoxLinkNode(self, aff):60        link = etree.Element('link', {'name':aff.getDescription()['Name']})61        link.append(etree.Element('pose'))62        pose = np.append(aff.getDescription()['pose'][0], transformUtils.quaternionToRollPitchYaw(aff.getDescription()['pose'][1]))63        link.find('pose').text = ' '.join(map(str, pose))64        dimensions = aff.getDescription()['Dimensions']65        66        if aff.getDescription()['Collision Enabled']:67            link.append(etree.Element('collision', {'name': 'collision'}))68            link.find('collision').append(etree.Element('geometry'))69            link.find('collision/geometry').append(etree.Element('box'))70            link.find('collision/geometry/box').append(etree.Element('size'))71            link.find('collision/geometry/box/size').text = ' '.join(map(str, dimensions))72        73        link.append(etree.Element('visual', {'name': 'visual'}))74        link.find('visual').append(etree.Element('geometry'))75        link.find('visual/geometry').append(etree.Element('box'))76        link.find('visual/geometry/box').append(etree.Element('size'))77        link.find('visual/geometry/box/size').text = ' '.join(map(str, dimensions))78        link.find('visual').append(etree.Element('material'))79        link.find('visual/material').append(etree.Element('diffuse'))80        link.find('visual/material/diffuse').text = '{:s} {:.1f}'.format(' '.join(map(str, aff.getDescription()['Color'])), aff.getDescription()['Alpha'])81        link.find('visual/material').append(etree.Element('ambient'))82        link.find('visual/material/ambient').text = '0 0 0 1'83        84        return link85    86    def generateCylinderLinkNode(self, aff):87        link = etree.Element('link', {'name':aff.getDescription()['Name']})88        link.append(etree.Element('pose'))89        pose = np.append(aff.getDescription()['pose'][0], transformUtils.quaternionToRollPitchYaw(aff.getDescription()['pose'][1]))90        link.find('pose').text = ' '.join(map(str, pose))91        92        if aff.getDescription()['Collision Enabled']:93            link.append(etree.Element('collision', {'name': 'collision'}))94            link.find('collision').append(etree.Element('geometry'))95            link.find('collision/geometry').append(etree.Element('cylinder'))96            link.find('collision/geometry/cylinder').append(etree.Element('radius'))97            link.find('collision/geometry/cylinder/radius').text = '{:.4f}'.format(aff.getDescription()['Radius'])98            link.find('collision/geometry/cylinder').append(etree.Element('length'))99            link.find('collision/geometry/cylinder/length').text = '{:.4f}'.format(aff.getDescription()['Length'])100        101        link.append(etree.Element('visual', {'name': 'visual'}))102        link.find('visual').append(etree.Element('geometry'))103        link.find('visual/geometry').append(etree.Element('cylinder'))104        link.find('visual/geometry/cylinder').append(etree.Element('radius'))105        link.find('visual/geometry/cylinder/radius').text = '{:.4f}'.format(aff.getDescription()['Radius'])106        link.find('visual/geometry/cylinder').append(etree.Element('length'))107        link.find('visual/geometry/cylinder/length').text = '{:.4f}'.format(aff.getDescription()['Length'])108        link.find('visual').append(etree.Element('material'))109        link.find('visual/material').append(etree.Element('diffuse'))110        link.find('visual/material/diffuse').text = '{:s} {:.1f}'.format(' '.join(map(str, aff.getDescription()['Color'])), aff.getDescription()['Alpha'])111        link.find('visual/material').append(etree.Element('ambient'))112        link.find('visual/material/ambient').text = '0 0 0 1'113        114        return link115        116                    117    def generateSDFfromAffordances(self):118        filename= os.environ['DRC_BASE'] + '/software/models/worlds/directorAffordances.sdf'119        sdfFile = open(filename, 'w')120        am = segmentation.affordanceManager121        affordances = am.getAffordances()122        123        root = etree.Element('sdf', {'version': '1.4'})124        tree = etree.ElementTree(root)125        world = etree.Element('world', {'name': 'directorAffordances'})126        root.append(world)127        128        for aff in affordances:129            if aff.getDescription()['classname'] in ['BoxAffordanceItem', 'CylinderAffordanceItem']:130                131                model = etree.Element('model', {'name': aff.getDescription()['Name']})132                world.append(model)133                134                model.append(etree.Element('pose'))135                model.find('pose').text = '0 0 0 0 0 0'136                137                if aff.getDescription()['classname'] == 'BoxAffordanceItem':138                    model.append(self.generateBoxLinkNode(aff))139                elif aff.getDescription()['classname'] == 'CylinderAffordanceItem':140                    model.append(self.generateCylinderLinkNode(aff))141            else:142                print '{:s} is unsupported skipping {:s} affordance!'.format(aff.getDescription()['classname'], aff.getDescription()['Name'])143        144        tree.write(sdfFile)145        sdfFile.close()...crondescriptor_test.py
Source:crondescriptor_test.py  
...5from crondescriptor.crondescriptor import Options6class CodeTest(unittest.TestCase):7    def testCron(self):8        descriptor = CronDescriptor()9        self.assertEqual("æ¯åé", descriptor.getDescription("* * * * *"))10        self.assertEqual("æ¯åé", descriptor.getDescription("*/1 * * * *"))11        self.assertEqual("æ¯åé", descriptor.getDescription("0 0/1 * * * ?"))12        self.assertEqual("æ¯å°æ¶", descriptor.getDescription("0 0 * * * ?"))13        self.assertEqual("æ¯å°æ¶", descriptor.getDescription("0 0 0/1 * * ?"))14        self.assertEqual("å¨ 23:00, ææä¸ å° ææäº", descriptor.getDescription("0 23 ? * MON-FRI"))15        self.assertEqual("æ¯ç§", descriptor.getDescription("* * * * * *"))16        self.assertEqual("æ¯ 45 ç§", descriptor.getDescription("*/45 * * * * *"))17        self.assertEqual("æ¯ 05 åé", descriptor.getDescription("*/5 * * * *"))18        self.assertEqual("æ¯ 10 åé", descriptor.getDescription("0 0/10 * * * ?"))19        self.assertEqual("æ¯ 05 åé", descriptor.getDescription("0 */5 * * * *"))20        self.assertEqual("å¨ 11:30, ææä¸ å° ææäº", descriptor.getDescription("30 11 * * 1-5"))21        self.assertEqual("å¨ 11:30", descriptor.getDescription("30 11 * * *"))22        self.assertEqual("å¨ 11:00 å 11:10 ä¹é´çæ¯åé", descriptor.getDescription("0-10 11 * * *"))23        self.assertEqual("æ¯åé, ä»
å¨ ä¸æ", descriptor.getDescription("* * * 3 *"))24        self.assertEqual("æ¯åé, ä»
å¨ ä¸æ å å
æ", descriptor.getDescription("* * * 3,6 *"))25        self.assertEqual("å¨ 14:30 å 16:30", descriptor.getDescription("30 14,16 * * *"))26        self.assertEqual("å¨ 06:30, 14:30 å 16:30", descriptor.getDescription("30 6,14,16 * * *"))27        self.assertEqual("å¨ 09:46, ä»
å¨ ææä¸", descriptor.getDescription("46 9 * * 1"))28        self.assertEqual("å¨ 12:23, æ¯æç 15 å·", descriptor.getDescription("23 12 15 * *"))29        self.assertEqual("å¨ 12:23, ä»
å¨ ä¸æ", descriptor.getDescription("23 12 * JAN *"))30        self.assertEqual("å¨ 12:23, ä»
å¨ ä¸æ", descriptor.getDescription("23 12 ? JAN *"))31        self.assertEqual("å¨ 12:23, 䏿 å° äºæ", descriptor.getDescription("23 12 * JAN-FEB *"))32        self.assertEqual("å¨ 12:23, 䏿 å° ä¸æ", descriptor.getDescription("23 12 * JAN-MAR *"))33        self.assertEqual("å¨ 12:23, ä»
å¨ æææ¥", descriptor.getDescription("23 12 * * SUN"))34        self.assertEqual("æ¯ 05 åé, å¨ 15:00, ææä¸ å° ææäº", descriptor.getDescription("*/5 15 * * MON-FRI"))35        self.assertEqual("æ¯åé, å¨ ç¬¬ä¸ä¸ªææä¸ æ¯æ", descriptor.getDescription("* * * * MON#3"))36        self.assertEqual("æ¯åé, æ¯æçæåä¸ä¸ª ææå ", descriptor.getDescription("* * * * 4L"))37        self.assertEqual("æ¯ 05 åé, æ¯æçæåä¸å¤©, ä»
å¨ ä¸æ", descriptor.getDescription("*/5 * L JAN *"))38        self.assertEqual("æ¯åé, æ¯æçæåä¸ä¸ªå¹³æ¥", descriptor.getDescription("* * LW * *"))39        self.assertEqual("æ¯åé, æ¯æçæåä¸ä¸ªå¹³æ¥", descriptor.getDescription("* * WL * *"))40        self.assertEqual("æ¯åé, æ¯æç 第ä¸ä¸ªå¹³æ¥ ", descriptor.getDescription("* * 1W * *"))41        self.assertEqual("æ¯åé, æ¯æç 第ä¸ä¸ªå¹³æ¥ ", descriptor.getDescription("* * W1 * *"))42        self.assertEqual("æ¯åé, æ¯æç ææ¥è¿ 5 å·çå¹³æ¥ ", descriptor.getDescription("* * 5W * *"))43        self.assertEqual("æ¯åé, æ¯æç ææ¥è¿ 5 å·çå¹³æ¥ ", descriptor.getDescription("* * W5 * *"))44        self.assertEqual("å¨ 14:02:30", descriptor.getDescription("30 02 14 * * *"))45        self.assertEqual("卿¯åéç 05 å° 10 ç§", descriptor.getDescription("5-10 * * * * *"))46        self.assertEqual("卿¯åéç 05 å° 10 ç§, 卿¯å°æ¶ç 30 å° 35 åé, å¨ 10:00 å 12:59 ä¹é´", descriptor.getDescription("5-10 30-35 10-12 * * *"))47        self.assertEqual("卿¯åéç 30 ç§, æ¯ 05 åé", descriptor.getDescription("30 */5 * * * *"))48        self.assertEqual("卿¯å°æ¶ç 30 å, å¨ 10:00 å 13:59 ä¹é´, ä»
å¨ ææä¸ å ææäº", descriptor.getDescription("0 30 10-13 ? * WED,FRI"))49        self.assertEqual("卿¯åéç 10 ç§, æ¯ 05 åé", descriptor.getDescription("10 0/5 * * * ?"))50        self.assertEqual("æ¯ 03 åé, 卿¯å°æ¶ç 02 å° 59 åé, å¨ 01:00, 09:00, å 22:00, 卿¯æç 11 å 26 å·ä¹é´, 䏿 å° å
æ", descriptor.getDescription("2-59/3 1,9,22 11-26 1-6 ?"))51        self.assertEqual("å¨ 06:00", descriptor.getDescription("0 0 6 1/1 * ?"))52        self.assertEqual("卿¯å°æ¶ç 05 å", descriptor.getDescription("0 5 0/1 * * ?"))53        self.assertEqual("æ¯ç§, ä»
å¨ 2013", descriptor.getDescription("* * * * * * 2013"))54        self.assertEqual("æ¯åé, ä»
å¨ 2013 å 2014", descriptor.getDescription("* * * * * 2013,2014"))55        self.assertEqual("å¨ 12:23, 䏿 å° äºæ, 2013 å° 2014", descriptor.getDescription("23 12 * JAN-FEB * 2013-2014"))56        self.assertEqual("å¨ 12:23, 䏿 å° ä¸æ, 2013 å° 2015", descriptor.getDescription("23 12 * JAN-MAR * 2013-2015"))57        self.assertEqual("æ¯ 30 åé, å¨ 08:00 å 09:59 ä¹é´, æ¯æç 5 å 20 å·", descriptor.getDescription("0 0/30 8-9 5,20 * ?"))58        self.assertEqual("å¨ 12:23, å¨ ç¬¬äºä¸ªæææ¥ æ¯æ", descriptor.getDescription("23 12 * * SUN#2"))59        60        options = Options()61        options.dayOfWeekStartIndexZero = False62        self.assertEqual("å¨ 12:23, å¨ ç¬¬äºä¸ªæææ¥ æ¯æ", descriptor.getDescription("23 12 * * 1#2", options))63        self.assertEqual("卿¯å°æ¶ç 25 å, æ¯ 13 å°æ¶, å¨ 07:00 å 19:59 ä¹é´", descriptor.getDescription("0 25 7-19/13 ? * *"))64        self.assertEqual("卿¯å°æ¶ç 25 å, æ¯ 13 å°æ¶, å¨ 07:00 å 20:59 ä¹é´", descriptor.getDescription("0 25 7-20/13 ? * *"))65if __name__ == '__main__':...test-lib-bmi.js
Source:test-lib-bmi.js  
...22    return done();23};24// bmi.getDescription tests25exports.it_should_return_correct_string_in_finnish_depending_on_the_bmi = function (done) {26    var bmiUnder16 = bmi.getDescription(11.7, "fi");27    var bmiUnder16Border = bmi.getDescription(15.9, "fi");28    assert.ok(bmiUnder16 === 'Vaikea alipaino' && bmiUnder16Border === 'Vaikea alipaino');29    var bmiFrom16To17Border = bmi.getDescription(16.0, "fi");30    var bmiFrom16To17 = bmi.getDescription(16.5, "fi");31    assert.ok(bmiFrom16To17Border === 'Merkittävä alipaino' && bmiFrom16To17 === 'Merkittävä alipaino');32    var bmiFrom17To18AndAHalfBorder = bmi.getDescription(17.0, "fi");33    var bmiFrom17To18AndAHalf = bmi.getDescription(18.2, "fi");34    assert.ok(bmiFrom17To18AndAHalfBorder === 'Lievä alipaino' && bmiFrom17To18AndAHalf === 'Lievä alipaino');35    var bmiFrom25To30Border = bmi.getDescription(25, "fi");36    var bmiFrom25To30 = bmi.getDescription(28.7, "fi");37    assert.ok(bmiFrom25To30Border === 'Lievä lihavuus' && bmiFrom25To30 === 'Lievä lihavuus');38    var bmiFrom30To35Border = bmi.getDescription(30, "fi");39    var bmiFrom30To35 = bmi.getDescription(32.3, "fi");40    assert.ok(bmiFrom30To35Border === 'Merkittävä lihavuus' && bmiFrom30To35 === 'Merkittävä lihavuus');41    var bmiFrom35To40Border = bmi.getDescription(35, "fi");42    var bmiFrom35To40 = bmi.getDescription(36.4, "fi");43    assert.ok(bmiFrom35To40Border === 'Vaikea lihavuus' && bmiFrom35To40 === 'Vaikea lihavuus');44    var bmiOver40Border = bmi.getDescription(40, "fi");45    var bmiOver40 = bmi.getDescription(100, "fi");46    assert.ok(bmiOver40Border === 'Sairaalloinen lihavuus' && bmiOver40 === 'Sairaalloinen lihavuus');47    return done();48};49exports.it_should_return_correct_string_in_english_depending_on_the_bmi = function (done) {50    var bmiInEnglishUnder16 = bmi.getDescription(11.7, "en");51    var bmiInEnglishUnder16Border = bmi.getDescription(15.9, "en");52    assert.ok(bmiInEnglishUnder16 === 'Severe underweight' && bmiInEnglishUnder16Border === 'Severe underweight');53    var bmiInEnglishFrom16To17Border = bmi.getDescription(16.0, "en");54    var bmiInEnglishFrom16To17 = bmi.getDescription(16.5, "en");55    assert.ok(bmiInEnglishFrom16To17Border === 'Significant underweight' && bmiInEnglishFrom16To17 === 'Significant underweight');56    var bmiInEnglishFrom17To18AndAHalfBorder = bmi.getDescription(17.0, "en");57    var bmiInEnglishFrom17To18AndAHalf = bmi.getDescription(18.2, "en");58    assert.ok(bmiInEnglishFrom17To18AndAHalfBorder === 'Mild underweight' && bmiInEnglishFrom17To18AndAHalf === 'Mild underweight');59    var bmiInEnglishFrom18AndAHalfTo25Border = bmi.getDescription(18.5, "en");60    var bmiInEnglishFrom18AndAHalfTo25 = bmi.getDescription(22.56, "en");61    assert.ok(bmiInEnglishFrom18AndAHalfTo25Border === 'Normal weight' && bmiInEnglishFrom18AndAHalfTo25 === 'Normal weight');62    var bmiInEnglishFrom25To30Border = bmi.getDescription(25, "en");63    var bmiInEnglishFrom25To30 = bmi.getDescription(28.7, "en");64    assert.ok(bmiInEnglishFrom25To30Border === 'Slight obesity' && bmiInEnglishFrom25To30 === 'Slight obesity');65    var bmiInEnglishFrom30To35Border = bmi.getDescription(30, "en");66    var bmiInEnglishFrom30To35 = bmi.getDescription(32.3, "en");67    assert.ok(bmiInEnglishFrom30To35Border === 'Significant obesity' && bmiInEnglishFrom30To35 === 'Significant obesity');68    var bmiInEnglishFrom35To40Border = bmi.getDescription(35, "en");69    var bmiInEnglishFrom35To40 = bmi.getDescription(36.4, "en");70    assert.ok(bmiInEnglishFrom35To40Border === 'Severe obesity' && bmiInEnglishFrom35To40 === 'Severe obesity');71    72    var bmiInEnglishOver40Border = bmi.getDescription(40, "en");73    var bmInEnglishOver40 = bmi.getDescription(100, "en");74    assert.ok(bmiInEnglishOver40Border === 'Patient obesity' && bmInEnglishOver40 === 'Patient obesity');75    return done();...level.py
Source:level.py  
1def toggle_snap_to_pivot():2    """3    CCommandDescription("Toggle snapping to pivot").GetDescription()4    """5    pass6def toggle_snap_to_surface_normal():7    """8    CCommandDescription("Toggle snapping to surface normal").GetDescription()9    """10    pass11def snap_to_geometry(arg1):12    """13    CCommandDescription("Enable/Disable snapping to geometry").Param("enable", "0: Disable, 1: Enable").GetDescription()14    15    :param bool arg1:16    """17    pass18def new_layer():19    """20    Create new layer21    22    :rtype: bool23    """24    pass25def new_folder():26    """27    Create new folder for layers28    29    :rtype: bool30    """31    pass32def toggle_snap_to_geometry():33    """34    CCommandDescription("Toggle snapping to geometry").GetDescription()35    """36    pass37def snap_to_vertex(arg1):38    """39    CCommandDescription("Enable/Disable snapping to vertex").Param("enable", "0: Disable, 1: Enable").GetDescription()40    41    :param bool arg1:42    """43    pass44def snap_to_surface_normal(arg1):45    """46    CCommandDescription("Enable/Disable snapping to surface normal").Param("enable", "0: Disable, 1: Enable").GetDescription()47    48    :param bool arg1:49    """50    pass51def snap_to_angle(arg1):52    """53    CCommandDescription("Enable/Disable snapping to angle").Param("enable", "0: Disable, 1: Enable").GetDescription()54    55    :param bool arg1:56    """57    pass58def snap_to_grid(arg1):59    """60    CCommandDescription("Enable/Disable snapping to grid").Param("enable", "0: Disable, 1: Enable").GetDescription()61    62    :param bool arg1:63    """64    pass65def snap_to_terrain(arg1):66    """67    CCommandDescription("Enable/Disable snapping to terrain").Param("enable", "0: Disable, 1: Enable").GetDescription()68    69    :param bool arg1:70    """71    pass72def toggle_snap_to_angle():73    """74    CCommandDescription("Toggle snapping to angle").GetDescription()75    """76    pass77def freeze_read_only():78    """79    Freeze read only layers80    81    :rtype: bool82    """83    pass84def toggle_snap_to_vertex():85    """86    CCommandDescription("Toggle snapping to vertex").GetDescription()87    """88    pass89def snap_to_pivot(arg1):90    """91    CCommandDescription("Enable/Disable snapping to privot").Param("enable", "0: Disable, 1: Enable").GetDescription()92    93    :param bool arg1:94    """95    pass96def go_to_selection():97    """98    Focus camera on selection99    """100    pass101def toggle_snap_to_grid():102    """103    CCommandDescription("Toggle snapping to grid").GetDescription()104    """105    pass106def toggle_snap_to_terrain():107    """108    CCommandDescription("Toggle snapping to terrain").GetDescription()109    """...Decorator.py
Source:Decorator.py  
1class Coffee:2    def getCost(self):3        pass4    def getDescription(self):5        pass6class SimpleCoffee(Coffee):7    def getCost(self):8        return 109    def getDescription(self):10        return 'Simple Coffee'11class MilkCoffee(Coffee):12    _coffee = None13    def __init__(self, coffee):14        self._coffee = coffee15    def getCost(self):16        return self._coffee.getCost() + 217    def getDescription(self):18        return self._coffee.getDescription() + ', milk'19class WhipCoffee(Coffee):20    _coffee = None21    def __init__(self, coffee):22        self._coffee = coffee23    def getCost(self):24        return self._coffee.getCost() + 525    def getDescription(self):26        return self._coffee.getDescription() + ', whip'27class VanillaCoffee(Coffee):28    _coffee = None29    def __init__(self, coffee):30        self._coffee = coffee31    def getCost(self):32        return self._coffee.getCost() + 333    def getDescription(self):34        return self._coffee.getDescription() + ', vanilla'35if __name__ == '__main__':36    someCoffee = SimpleCoffee()37    print someCoffee.getCost()38    print someCoffee.getDescription()39    someCoffee = MilkCoffee(someCoffee)40    print someCoffee.getCost()41    print someCoffee.getDescription()42    someCoffee = VanillaCoffee(someCoffee)43    print someCoffee.getCost()44    print someCoffee.getDescription()45    someCoffee = WhipCoffee(someCoffee)46    print someCoffee.getCost()...Using AI Code Generation
1module.exports = {2  'Demo test Google' : function (browser) {3      .waitForElementVisible('body', 1000)4      .assert.title('Google')5      .assert.visible('input[type=text]')6      .setValue('input[type=text]', 'nightwatch')7      .waitForElementVisible('button[name=btnG]', 1000)8      .click('button[name=btnG]')9      .pause(1000)10      .assert.containsText('#main', 'Night Watch')11      .end();12  }13};14describe('group name', functionUsing AI Code Generation
1module.exports = {2  'Demo test Google' : function (browser) {3      .waitForElementVisible('body', 1000)4      .assert.title('Google')5      .assert.visible('input[type=text]')6      .setValue('input[type=text]', 'nightwatch')7      .waitForElementVisible('button[name=btnG]', 1000)8      .click('button[name=btnG]')9      .pause(1000)10      .assert.containsText('#main', 'Night Watch')11      .end();12  }13};14* **Sergio Díaz** - *Initial work* - [sergiodiaz](Using AI Code Generation
1module.exports = {2  'Demo test Google' : function (browser) {3      .waitForElementVisible('body', 1000)4      .pause(5000)5      .assert.title('Google')6      .assert.visible('input[type=text]')7      .setValue('input[type=text]', 'nightwatch')8      .pause(5000)9      .assert.visible('input[name=btnK]')10      .click('input[name=btnK]')11      .pause(5000)12      .assert.containsText('#main', 'Night Watch')13      .end();14  }15};Using AI Code Generation
1module.exports = {2  'Demo test Google' : function (browser) {3      .pause(1000)4      .assert.title('Google')5      .assert.visible('input[type=text]')6      .setValue('input[type=text]', 'nightwatch')7      .pause(1000)8      .assert.containsText('#main', 'Night Watch')9      .end();10  }11};12module.exports = {13  'Demo test Google' : function (browser) {14      .pause(1000)15      .assert.title('Google')16      .assert.visible('input[type=text]')17      .setValue('input[type=text]', 'nightwatch')18      .pause(1000)19      .assert.containsText('#main', 'Night Watch')20      .end();21  }22};23module.exports = {24  'Demo test Google' : function (browser) {25      .pause(1000)26      .assert.title('Google')27      .assert.visible('input[type=text]')28      .setValue('input[type=text]', 'nightwatch')29      .pause(1000)30      .assert.containsText('#main', 'Night Watch')31      .end();32  }33};34module.exports = {35  'Demo test Google' : function (browser) {36      .pause(1000)37      .assert.title('Google')38      .assert.visible('input[type=text]')39      .setValue('input[type=text]', 'nightwatch')40      .pause(1000)41      .assert.containsText('#main', 'Night Watch')42      .end();43  }44};45module.exports = {46  'Demo test Google' : function (browser) {47      .pause(1000)48      .assert.title('Google')49      .assert.visible('input[type=text]')50      .setValue('input[type=text]', 'nightwatch')51      .pause(1000)52      .assert.containsText('#main', 'Night Watch')53      .end();54  }55};Using AI Code Generation
1module.exports = {2  'Test Demo' : function (browser) {3      .waitForElementVisible('body', 1000)4      .assert.title('Google')5      .assert.visible('input[type=text]')6      .setValue('input[type=text]', 'rembrandt van rijn')7      .waitForElementVisible('button[name=btnG]', 1000)8      .click('button[name=btnG]')9      .pause(1000)10      .assert.containsText('#main', 'Rembrandt van Rijn')11      .end();12  }13};14{15  "selenium" : {Using AI Code Generation
1module.exports = {2  'Test Description': function (browser) {3      .waitForElementVisible('body')4      .assert.title('Nightwatch.js')5      .end();6  }7};Using AI Code Generation
1var description = this.client.api.getDescription();2console.log(description);3{4  "selenium" : {5    "cli_args" : {6    }7  },8  "test_settings" : {9    "default" : {10      "screenshots" : {11      },12      "desiredCapabilities": {13      }14    },15    "chrome" : {16      "desiredCapabilities": {17      }18    }19  }20}Using AI Code Generation
1module.exports = {2  'Test description': function (browser) {3      .assert.title('Google')4      .end();5  }6};7I'm trying to use the client.assert.description('text') in a custom command. I have a custom command that looks like this:8exports.command = function (text) {9    .assert.description(text)10    .end();11};12I'm trying to use the client.assert.description('text') in a custom command. I have a custom command that looks like this:13exports.command = function (text) {14    .assert.description(text)15    .end();16};Using AI Code Generation
1this.api.getDescription(function(result) {2  console.log(result);3});4### .getLogTypes(callback)5this.api.getLogTypes(function(result) {6  console.log(result);7});8### .getLog(logType, callback)9this.api.getLog('browser', function(result) {10  console.log(result);11});12### .getAvailableLogTypes(callback)13this.api.getAvailableLogTypes(function(result) {14  console.log(result);15});16### .getLogEntries(logType, callback)17this.api.getLogEntries('browser', function(result) {18  console.log(result);19});20### .setCookie(cookie, callback)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!!
