Best Python code snippet using green
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__':...
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!!