Best Python code snippet using localstack_python
recipe-577652.py
Source:recipe-577652.py  
...160"""161tables = [162    [163    ["Distance","meters"],164    ["meters","m","Decimal(self)","self._update(Decimal(value))"],165    ["miles","mi","Decimal(self) * MI_IN_M","self._update(Decimal(value) * Decimal('1.0')/MI_IN_M)"],166    ["yard","yd","Decimal(self) * YD_IN_M","self._update(Decimal(value) * Decimal('1.0')/YD_IN_M)"],167    ["feet","ft","Decimal(self) * FT_IN_M","self._update(Decimal(value) * Decimal('1.0')/FT_IN_M)"],168    ["inch","inch","Decimal(self) * INCH_IN_M","self._update(Decimal(value) * Decimal('1.0')/INCH_IN_M)"],169    ["kilometers","km","Decimal(self) * KM_IN_M","self._update(Decimal(value) * Decimal('1.0')/KM_IN_M)"],170    ["centimeters","cm","Decimal(self) * CM_IN_M","self._update(Decimal(value) * Decimal('1.0')/CM_IN_M)"],171    ["millimeters","mm","Decimal(self) * MM_IN_M","self._update(Decimal(value) * Decimal('1.0')/MM_IN_M)"],172    ["nanometer","nm","Decimal(self) * NM_IN_M","self._update(Decimal(value) * Decimal('1.0')/NM_IN_M)"],173    ],174    [175    ["Area","sq_meters"],176    ["sq_meters","m2","Decimal(self)","self._update(Decimal(value))"],177    ["sq_miles","mi2","Decimal(self) * (MI_IN_M * MI_IN_M)","self._update(Decimal(value) * Decimal('1.0')/(MI_IN_M * MI_IN_M))"],178    ["sq_yard","yd2","Decimal(self) * (YD_IN_M * YD_IN_M)","self._update(Decimal(value) * Decimal('1.0')/(YD_IN_M * YD_IN_M))"],179    ["sq_feet","ft2","Decimal(self) * (FT_IN_M * FT_IN_M)","self._update(Decimal(value) * Decimal('1.0')/(FT_IN_M * FT_IN_M))"],180    ["sq_inch","inch2","Decimal(self) * (INCH_IN_M * INCH_IN_M)","self._update(Decimal(value) * Decimal('1.0')/(INCH_IN_M * INCH_IN_M))"],181    ["sq_kilometers","km2","Decimal(self) * (KM_IN_M * KM_IN_M)","self._update(Decimal(value) * Decimal('1.0')/(KM_IN_M * KM_IN_M))"],182    ["sq_centimeters","cm2","Decimal(self) * (CM_IN_M * CM_IN_M)","self._update(Decimal(value) * Decimal('1.0')/(CM_IN_M * CM_IN_M))"],183    ["sq_millimeters","mm2","Decimal(self) * (MM_IN_M * MM_IN_M)","self._update(Decimal(value) * Decimal('1.0')/(MM_IN_M * MM_IN_M))"],184    ],185    [186    ["Volumn","cubic_meters"],187    ["cubic_meters","m3","Decimal(self)","self._update(Decimal(value))"],188    ["cubic_miles","mi3","Decimal(self) * (MI_IN_M * MI_IN_M * MI_IN_M)","self._update(Decimal(value) * Decimal('1.0')/(MI_IN_M * MI_IN_M * MI_IN_M))"],189    ["cubic_yard","yd3","Decimal(self) * (YD_IN_M * YD_IN_M * YD_IN_M)","self._update(Decimal(value) * Decimal('1.0')/(YD_IN_M * YD_IN_M * YD_IN_M))"],190    ["cubic_feet","ft3","Decimal(self) * (FT_IN_M * FT_IN_M * FT_IN_M)","self._update(Decimal(value) * Decimal('1.0')/(FT_IN_M * FT_IN_M * FT_IN_M))"],191    ["cubic_inch","inch3","Decimal(self) * (INCH_IN_M * INCH_IN_M * INCH_IN_M)","self._update(Decimal(value) * Decimal('1.0')/(INCH_IN_M * INCH_IN_M * INCH_IN_M))"],192    ["cubic_kilometers","km3","Decimal(self) * (KM_IN_M * KM_IN_M * KM_IN_M)","self._update(Decimal(value) * Decimal('1.0')/(KM_IN_M * KM_IN_M * KM_IN_M))"],193    ["cubic_centimeters","cm3","Decimal(self) * (CM_IN_M * CM_IN_M * CM_IN_M)","self._update(Decimal(value) * Decimal('1.0')/(CM_IN_M * CM_IN_M * CM_IN_M))"],194    ["cubic_millimeters","mm3","Decimal(self) * (MM_IN_M * MM_IN_M * MM_IN_M)","self._update(Decimal(value) * Decimal('1.0')/(MM_IN_M * MM_IN_M * MM_IN_M))"],195    ],196    [197    ["Time","sec"],198    ["sec","sec","Decimal(self)","self._update(Decimal(value))"],199    ["min","min","Decimal(self) * Decimal('1.0')/SEC_IN_MIN","self._update(Decimal(value) * SEC_IN_MIN)"],200    ["hour","hr","Decimal(self) * Decimal('1.0')/(SEC_IN_MIN*MIN_IN_HR)","self._update(Decimal(value) * (SEC_IN_MIN*MIN_IN_HR))"],201    ["day","day","Decimal(self) * Decimal('1.0')/(HR_IN_DAY*SEC_IN_MIN*MIN_IN_HR)","self._update(Decimal(value) * (HR_IN_DAY*SEC_IN_MIN*MIN_IN_HR))"],202    ["week","wk","Decimal(self) * Decimal('1.0')/(DAY_IN_WK*HR_IN_DAY*SEC_IN_MIN*MIN_IN_HR)","self._update(Decimal(value) * (DAY_IN_WK*HR_IN_DAY*SEC_IN_MIN*MIN_IN_HR))"],203    ["year","yr","Decimal(self) * Decimal('1.0')/(DAY_IN_YR*HR_IN_DAY*SEC_IN_MIN*MIN_IN_HR)","self._update(Decimal(value) * (DAY_IN_YR*HR_IN_DAY*SEC_IN_MIN*MIN_IN_HR))"],204    ],205    [206    ["Velocity","meters_per_sec"],207    ["meters_per_sec","mps","Decimal(self)","self._update(Decimal(value))"],208    ["miles_per_sec","mips","Decimal(self) * MI_IN_M","self._update(Decimal(value) * Decimal('1.0')/MI_IN_M)"],209    ["miles_per_hr","mph","Decimal(self) * (MI_IN_M * SEC_IN_MIN * MIN_IN_HR)","self._update(Decimal(value) * Decimal('1.0')/(MI_IN_M * SEC_IN_MIN * MIN_IN_HR))"],210    ["ft_per_sec","fps","Decimal(self) * FT_IN_M","self._update(Decimal(value) * Decimal('1.0')/FT_IN_M)"],211    ["inch_per_sec","inchps","Decimal(self) * INCH_IN_M","self._update(Decimal(value) * Decimal('1.0')/INCH_IN_M)"],212    ["km_per_hour","kmph","Decimal(self) * (KM_IN_M * SEC_IN_MIN * MIN_IN_HR)","self._update(Decimal(value) * Decimal('1.0')/(KM_IN_M * SEC_IN_MIN * MIN_IN_HR))"],213    ["km_per_sec","kmps","Decimal(self) * KM_IN_M","self._update(Decimal(value) * Decimal('1.0')/KM_IN_M)"],214    ],215    [216    ["Acceleration","meters_per_sq_sec"],217    ["meters_per_sq_sec","mps2","Decimal(self)","self._update(Decimal(value))"],218    ["miles_per_sq_sec","mips2","Decimal(self) * MI_IN_M","self._update(Decimal(value) * Decimal('1.0')/MI_IN_M)"],219    ["miles_per_hr_per_sec","mphps","Decimal(self) * (MI_IN_M * SEC_IN_MIN * MIN_IN_HR)","self._update(Decimal(value) * Decimal('1.0')/(MI_IN_M * SEC_IN_MIN * MIN_IN_HR))"],220    ["ft_per_sq_sec","fps2","Decimal(self) * FT_IN_M","self._update(Decimal(value) * Decimal('1.0')/FT_IN_M)"],221    ["inch_per_sq_sec","ips2","Decimal(self) * INCH_IN_M","self._update(Decimal(value) * Decimal('1.0')/INCH_IN_M)"],222    ["km_per_hour_per_sec","kmphps","Decimal(self) * (KM_IN_M * SEC_IN_MIN * MIN_IN_HR)","self._update(Decimal(value) * Decimal('1.0')/(KM_IN_M * SEC_IN_MIN * MIN_IN_HR))"],223    ["km_per_sq_sec","kmps2","Decimal(self) * KM_IN_M","self._update(Decimal(value) * Decimal('1.0')/KM_IN_M)"],224    ],225    [226    ["Mass","kilogram"],227    ["kilogram","kg","Decimal(self)","self._update(Decimal(value))"],228    ["gram","g","Decimal(self) * Decimal('1000.0')","self._update(Decimal(value) / Decimal('1000.0'))"],229    ["ounce","oz","Decimal(self) * OZ_IN_G * Decimal('1000.0')","self._update(Decimal(value) / OZ_IN_G / Decimal('1000.0'))"],230    ["pounds","lbm","Decimal(self) * (OZ_IN_G / OZ_IN_LB) * Decimal('1000.0')","self._update(Decimal(value)* OZ_IN_LB / OZ_IN_G / Decimal('1000.0') )"],231    ],232    [233    ["Force","newton"], # m*kg*s**2234    ["newton","N","Decimal(self)","self._update(Decimal(value))"],235    ["kilogram-force","kgf","Decimal(self) / GRAVITY","self._update(Decimal(value) * GRAVITY)"],236    ["dyne","dyn","Decimal(self) * Decimal('100000.0')","self._update(Decimal(value) / Decimal('100000.0'))"],237    ["pound-force","lbf","Decimal(self) * (G_IN_KG * OZ_IN_G) / (OZ_IN_LB*GRAVITY)","self._update(Decimal(value) * (OZ_IN_LB * GRAVITY) / (G_IN_KG * OZ_IN_G))"],238    ], 239    [240    ["Weight","kilogram"], # m*kg*s**2241    ["kilogram","kg","Decimal(self)","self._update(Decimal(value))"],242    ["gram","g","Decimal(self) * G_IN_KG ","self._update(Decimal(value) / G_IN_KG)"],243    ["ounce","oz","Decimal(self) * G_IN_KG * OZ_IN_G ","self._update(Decimal(value) / (G_IN_KG * OZ_IN_G))"],244    ["pounds","lbm","Decimal(self) * (G_IN_KG * OZ_IN_G) / (OZ_IN_LB)","self._update(Decimal(value) * (OZ_IN_LB ) / (G_IN_KG * OZ_IN_G))"],245    ], 246    [247    ["Pressure","pascal "],248    ["pascal","Pa","Decimal(self)","self._update(Decimal(value))"],249    ["newton_per_sq_m","Nm2","Decimal(self)","self._update(Decimal(value))"],250    ["kilogram_per_sq_m","kgfpm2","Decimal(self) * Decimal('1.0')/GRAVITY","self._update(Decimal(value) * GRAVITY)"],251    ["pound_per_sq_inch","psi","Decimal(self) * (LB_IN_NEWTON/(INCH_IN_M * INCH_IN_M))","self._update(Decimal(value) * (INCH_IN_M * INCH_IN_M) / LB_IN_NEWTON)"],252    ["pound_per_sq_ft","psf","Decimal(self) * LB_IN_NEWTON/(FT_IN_M * FT_IN_M)","self._update(Decimal(value) * (FT_IN_M * FT_IN_M) / LB_IN_NEWTON)"],253    ],254    [255    ["Frequency","Frequency"],256    ["hertz","Hz","Decimal(self)","self._update(Decimal(value))"],257    ["KHz","KHz","Decimal(self) * Decimal('1.0')/Decimal(1.0e3)","self._update(Decimal(value) * Decimal('1.0e3'))"],258    ["MHz","MHz","Decimal(self) * Decimal('1.0')/Decimal(1.0e6)","self._update(Decimal(value) * Decimal('1.0e6'))"],259    ["GHz","GHz","Decimal(self) * Decimal('1.0')/Decimal(1.0e9)","self._update(Decimal(value) * Decimal('1.0e9'))"],260    ],261    [262    ["Power","Power"],263    ["watts","W","Decimal(self)","self._update(Decimal(value))"],264    ["kilowatt","KW","Decimal(self) * Decimal('1.0')/Decimal('1.0e3')","self._update(Decimal(value) * Decimal('1.0e3'))"],265    ["megawatt","MW","Decimal(self) * Decimal('1.0')/Decimal('1.0e6')","self._update(Decimal(value) * Decimal('1.0e6'))"],266    ["Horsepower","hp","Decimal(self) * Decimal('1.0')/W_IN_HP","self._update(Decimal(value) * W_IN_HP)"],267    ["joulepersec","jps","Decimal(self)","self._update(Decimal(value))"],268    ],269    [270    ["Temperature","degreeK"],271    ["Kelvin","K","Decimal(self)","self._update(Decimal(value))"],272    ["Fahrenheit","F","((Decimal(self) - Decimal('273.15')) * Decimal('9.0')/Decimal('5.0')) + Decimal('32.0')","self._update((Decimal(value) - Decimal('32.0')) * (Decimal('5.0')/Decimal('9.0')) + Decimal('273.15'))"],273    ["Celsius","C","Decimal(self) - Decimal('273.15')","self._update(Decimal(value) + Decimal('273.15'))"],274    ],275]276def build_class(table):277    "build a class for each table i.e. Distance,Velocity,etc."278    name, baseunits = table[0]279    s = '\nclass %(name)s(Decimal):\n' % locals()280    s += '    __slots__ = ("_update",) # generate AttributeError on illegal property; example: if d.yds instead of d.ydgenerate AttributeError example: if d.yds not d.yd\n'281    return s282def build_init(table):283    "update method"284    s = """285    def _update(self,dec):286        self._exp  = dec._exp287        self._sign = dec._sign288        self._int  = dec._int289        self._is_special  = dec._is_special290"""291    return s292def build_str_funct(table):293    "str method"294    fmt1 = "    def __str__(self):\n        s = ''\n"295    fmt2 = "        s += '%%g %(units)s (%(abrev)s)\\n' %% self.%(abrev)s\n"296    name, baseunits = table[0]297    s = fmt1 % locals()298    for data in table[1:]:299        if len(data) == 3:...ArrayFlat.js
Source:ArrayFlat.js  
1var arr1 = [1,2,3,[1,2,3,4, [2,3,4]]];2function flatten(input) {3  const stack = [...input];4  const res = [];5  while (stack.length) {6    // ä½¿ç¨ pop ä» stack ä¸ååºå¹¶ç§»é¤å¼7    const next = stack.pop();8    if (Array.isArray(next)) {9      // ä½¿ç¨ push éåå
屿°ç»ä¸çå
ç´ ï¼ä¸ä¼æ¹å¨åå§è¾å
¥ original input10      stack.push(...next);11    } else {12      res.push(next);13    }14  }15  // ä½¿ç¨ reverse æ¢å¤åæ°ç»ç顺åº16  return res.reverse();17}18flatten(arr1);// [1, 2, 3, 1, 2, 3, 4, 2, 3, 4]192021var arr2 = [22    {23        "NODE_ID": "9259411CB6F3AB41B5FBCDF8139A6E2B",24        "PARENT_NODE_ID": null,25        "ROOT_TAG_ID": "9259411CB6F3AB41B5FBCDF8139A6E2B",26        "SEQUENCE_NUMBER": 20,27        "TYPE": "CAT",28        "SHORT_TEXT": "ç«æ | Athletics",29        "EXERCISE_COUNT": 1,30        "_DELETE": 1,31        "_UPDATE": 1,32        "_ADD": 1,33        "_MANAGE_PERMISSIONS": 1,34        "nodes": [35            {36                "NODE_ID": "F13E5CD37DF45E43B1F29E46536D2901",37                "PARENT_NODE_ID": "9259411CB6F3AB41B5FBCDF8139A6E2B",38                "ROOT_TAG_ID": "9259411CB6F3AB41B5FBCDF8139A6E2B",39                "SEQUENCE_NUMBER": 10,40                "TYPE": "CAT",41                "SHORT_TEXT": "èå | Stamina ",42                "EXERCISE_COUNT": 6,43                "_DELETE": 1,44                "_UPDATE": 1,45                "_ADD": 1,46                "_MANAGE_PERMISSIONS": 1,47                "nodes": [48                    {49                        "NODE_ID": "31CEA0B0B0CF0E40A581839E1069A47E",50                        "EXERCISE_TAG_ID": "54D382DC5F6B304DB142387E7330DB32",51                        "PARENT_NODE_ID": "F13E5CD37DF45E43B1F29E46536D2901",52                        "TYPE": "EX",53                        "SHORT_TEXT": "30,60,90 | 30,60,90",54                        "_DELETE": 1,55                        "_UPDATE": 156                    },57                    {58                        "NODE_ID": "D02C47DF5BB8FA4F91F72C0F40540FA2",59                        "EXERCISE_TAG_ID": "055C3785AA50BF4B920C8D2F65298D1D",60                        "PARENT_NODE_ID": "F13E5CD37DF45E43B1F29E46536D2901",61                        "TYPE": "EX",62                        "SHORT_TEXT": "test",63                        "_DELETE": 1,64                        "_UPDATE": 165                    },66                    {67                        "NODE_ID": "392AC8599930344490D7500BB67B1022",68                        "EXERCISE_TAG_ID": "D039F476A7A6B147A336640C26313B44",69                        "PARENT_NODE_ID": "F13E5CD37DF45E43B1F29E46536D2901",70                        "TYPE": "EX",71                        "SHORT_TEXT": "循ç¯è®ç» | Circle training ",72                        "_DELETE": 1,73                        "_UPDATE": 174                    },75                    {76                        "NODE_ID": "87BCC13F25F16447AA8214BCD88F2E07",77                        "EXERCISE_TAG_ID": "7DC036BC60231C4A8C45650BAE346B95",78                        "PARENT_NODE_ID": "F13E5CD37DF45E43B1F29E46536D2901",79                        "TYPE": "EX",80                        "SHORT_TEXT": "èåè· | Endurance run",81                        "_DELETE": 1,82                        "_UPDATE": 183                    },84                    {85                        "NODE_ID": "E2D0200A54ED24428EFE6F934C5DD98E",86                        "EXERCISE_TAG_ID": "2627B796433EBA4FA88003C14AA7B252",87                        "PARENT_NODE_ID": "F13E5CD37DF45E43B1F29E46536D2901",88                        "TYPE": "EX",89                        "SHORT_TEXT": "è·¨æ  | Hurdle jumps",90                        "_DELETE": 1,91                        "_UPDATE": 192                    },93                    {94                        "NODE_ID": "16DE9DC506E1294EB9E144153568C154",95                        "EXERCISE_TAG_ID": "E20BF5E3021AE640B07A8B4990A4ABA1",96                        "PARENT_NODE_ID": "F13E5CD37DF45E43B1F29E46536D2901",97                        "TYPE": "EX",98                        "SHORT_TEXT": "éç¢è· | Parcours",99                        "_DELETE": 1,100                        "_UPDATE": 1101                    }102                ]103            },104            {105                "NODE_ID": "5B8049276F63BE43ACC0006085432C79",106                "EXERCISE_TAG_ID": "C65DB0A18103B94685A334C014FAE57B",107                "PARENT_NODE_ID": "9259411CB6F3AB41B5FBCDF8139A6E2B",108                "TYPE": "EX",109                "SHORT_TEXT": "4:3æ
å½¢ | 4:3 situation",110                "_DELETE": 1,111                "_UPDATE": 1112            }113        ]114    },115    {116        "NODE_ID": "BCB86BE4983A3D45A2BA6151DC3544A1",117        "PARENT_NODE_ID": null,118        "ROOT_TAG_ID": "BCB86BE4983A3D45A2BA6151DC3544A1",119        "SEQUENCE_NUMBER": 20,120        "TYPE": "CAT",121        "SHORT_TEXT": "ææ¯ | Technique",122        "EXERCISE_COUNT": 1,123        "_DELETE": 1,124        "_UPDATE": 1,125        "_ADD": 1,126        "_MANAGE_PERMISSIONS": 1,127        "nodes": [128            {129                "NODE_ID": "2FFA8FB663F13849AE74A3000582F650",130                "PARENT_NODE_ID": "BCB86BE4983A3D45A2BA6151DC3544A1",131                "ROOT_TAG_ID": "BCB86BE4983A3D45A2BA6151DC3544A1",132                "SEQUENCE_NUMBER": 10,133                "TYPE": "CAT",134                "SHORT_TEXT": "è¿ç | Dribbling ",135                "EXERCISE_COUNT": 2,136                "_DELETE": 1,137                "_UPDATE": 1,138                "_ADD": 1,139                "_MANAGE_PERMISSIONS": 1,140                "nodes": [141                    {142                        "NODE_ID": "170afdd50bc05d0aefb27a9af2ce5859",143                        "PARENT_NODE_ID": "2FFA8FB663F13849AE74A3000582F650",144                        "ROOT_TAG_ID": "BCB86BE4983A3D45A2BA6151DC3544A1",145                        "SEQUENCE_NUMBER": 10,146                        "TYPE": "CAT",147                        "SHORT_TEXT": "é«éè·å¨æ¶è¿ç",148                        "EXERCISE_COUNT": 0,149                        "_DELETE": 1,150                        "_UPDATE": 1,151                        "_ADD": 1,152                        "_MANAGE_PERMISSIONS": 1,153                        "nodes": []154                    },155                    {156                        "NODE_ID": "5B8049276F63BE43ACC0006085432C79",157                        "EXERCISE_TAG_ID": "24EEB3FAF452C24F9B657A9082018DF4",158                        "PARENT_NODE_ID": "2FFA8FB663F13849AE74A3000582F650",159                        "TYPE": "EX",160                        "SHORT_TEXT": "4:3æ
å½¢ | 4:3 situation",161                        "_DELETE": 1,162                        "_UPDATE": 1163                    },164                    {165                        "NODE_ID": "E2D0200A54ED24428EFE6F934C5DD98E",166                        "EXERCISE_TAG_ID": "34B51CF5D527A84B830CD9BA53ED6C3E",167                        "PARENT_NODE_ID": "2FFA8FB663F13849AE74A3000582F650",168                        "TYPE": "EX",169                        "SHORT_TEXT": "è·¨æ  | Hurdle jumps",170                        "_DELETE": 1,171                        "_UPDATE": 1172                    }173                ]174            },175            {176                "NODE_ID": "653D5DBD6DC1684DBA9B7144DE61376C",177                "PARENT_NODE_ID": "BCB86BE4983A3D45A2BA6151DC3544A1",178                "ROOT_TAG_ID": "BCB86BE4983A3D45A2BA6151DC3544A1",179                "SEQUENCE_NUMBER": 20,180                "TYPE": "CAT",181                "SHORT_TEXT": "ä¼ ç | Passing  ",182                "EXERCISE_COUNT": 3,183                "_DELETE": 1,184                "_UPDATE": 1,185                "_ADD": 1,186                "_MANAGE_PERMISSIONS": 1,187                "nodes": [188                    {189                        "NODE_ID": "5B8049276F63BE43ACC0006085432C79",190                        "EXERCISE_TAG_ID": "98A3668A698C914AB5D09D72CD4B687F",191                        "PARENT_NODE_ID": "653D5DBD6DC1684DBA9B7144DE61376C",192                        "TYPE": "EX",193                        "SHORT_TEXT": "4:3æ
å½¢ | 4:3 situation",194                        "_DELETE": 1,195                        "_UPDATE": 1196                    },197                    {198                        "NODE_ID": "25257F98DFD0694F8E075989FFCC985B",199                        "EXERCISE_TAG_ID": "38D98A307CE9CC488D36EF1EC0E018E5",200                        "PARENT_NODE_ID": "653D5DBD6DC1684DBA9B7144DE61376C",201                        "TYPE": "EX",202                        "SHORT_TEXT": "åè¿«ä¸è¿è¡ä¼ ç | Passing drill with opponents",203                        "_DELETE": 1,204                        "_UPDATE": 1205                    },206                    {207                        "NODE_ID": "1DF2A53268A77E428AF4C482D3582B37",208                        "EXERCISE_TAG_ID": "48B71F416045064FBFE43F869C69BA2D",209                        "PARENT_NODE_ID": "653D5DBD6DC1684DBA9B7144DE61376C",210                        "TYPE": "EX",211                        "SHORT_TEXT": "é¿ä¼ ç»ä¹  | Long pass drill",212                        "_DELETE": 1,213                        "_UPDATE": 1214                    }215                ]216            },217            {218                "NODE_ID": "6662CC8805BB074D8CCC1FC866B1086D",219                "PARENT_NODE_ID": "BCB86BE4983A3D45A2BA6151DC3544A1",220                "ROOT_TAG_ID": "BCB86BE4983A3D45A2BA6151DC3544A1",221                "SEQUENCE_NUMBER": 30,222                "TYPE": "CAT",223                "SHORT_TEXT": "å°é¨ | Shooting",224                "EXERCISE_COUNT": 1,225                "_DELETE": 1,226                "_UPDATE": 1,227                "_ADD": 1,228                "_MANAGE_PERMISSIONS": 1,229                "nodes": [230                    {231                        "NODE_ID": "555A6B5A58BD2B49ABDBC25DE6C6D189",232                        "EXERCISE_TAG_ID": "559B07B2692F7146B2D5F940297592C5",233                        "PARENT_NODE_ID": "6662CC8805BB074D8CCC1FC866B1086D",234                        "TYPE": "EX",235                        "SHORT_TEXT": "å¨å®é¨åé²å®ä¸å°é¨ | Shooting on goal practice",236                        "_DELETE": 1,237                        "_UPDATE": 1238                    }239                ]240            },241            {242                "NODE_ID": "F646CAEF54D2644F92A3BE9603E62690",243                "PARENT_NODE_ID": "BCB86BE4983A3D45A2BA6151DC3544A1",244                "ROOT_TAG_ID": "BCB86BE4983A3D45A2BA6151DC3544A1",245                "SEQUENCE_NUMBER": 40,246                "TYPE": "CAT",247                "SHORT_TEXT": "ä¼ ä¸   | Crosses",248                "EXERCISE_COUNT": 2,249                "_DELETE": 1,250                "_UPDATE": 1,251                "_ADD": 1,252                "_MANAGE_PERMISSIONS": 1,253                "nodes": [254                    {255                        "NODE_ID": "95D2CD8B79F6BC40A88B30B930B1E57E",256                        "EXERCISE_TAG_ID": "9CB3C1DA0B42D346B4CBE70503A41FF5",257                        "PARENT_NODE_ID": "F646CAEF54D2644F92A3BE9603E62690",258                        "TYPE": "EX",259                        "SHORT_TEXT": "sss",260                        "_DELETE": 1,261                        "_UPDATE": 1262                    },263                    {264                        "NODE_ID": "9F37BD348AB57F44B878A827522470A8",265                        "EXERCISE_TAG_ID": "B668952C7EDCD84F99F53B0FCFD47ECB",266                        "PARENT_NODE_ID": "F646CAEF54D2644F92A3BE9603E62690",267                        "TYPE": "EX",268                        "SHORT_TEXT": "è§çä¼ ä¸ | Crosses from corner",269                        "_DELETE": 1,270                        "_UPDATE": 1271                    }272                ]273            },274            {275                "NODE_ID": "46C7118318EF0A4B815136C1223F5CD8",276                "EXERCISE_TAG_ID": "A4126CF01572DF47BAB8A8E285F42622",277                "PARENT_NODE_ID": "BCB86BE4983A3D45A2BA6151DC3544A1",278                "TYPE": "EX",279                "SHORT_TEXT": "æµè¯01",280                "_DELETE": 1,281                "_UPDATE": 1282            }283        ]284    }
...GridColumn.js
Source:GridColumn.js  
...48  members : {49    setLeft : function( value ) {50      if( rwt.remote.EventUtil.getSuspended() ) {51        this._left = value;52        this._update();53      } else {54        this._sendMove( value );55      }56    },57    getLeft : function() {58      return this._left;59    },60    setWidth : function( value ) {61      if( rwt.remote.EventUtil.getSuspended() ) {62        this._width = value;63        this._update();64      } else {65        this._sendResize( value );66      }67    },68    getWidth : function() {69      return this._width;70    },71    setHeight : function( value ) {72      this._height = value;73      this._update();74    },75    getHeight : function() {76      return this._height;77    },78    setVisibility : function( value ) {79      this._visibility = value;80      this._update();81    },82    getVisibility : function() {83      return this._visibility;84    },85    setExpanded : function( value ) {86      this._expanded = value;87      this._update();88    },89    isExpanded : function() {90      return this._expanded;91    },92    setGroup : function( value ) {93      this._group = value;94    },95    getGroup : function() {96      return this._group;97    },98    setToolTipText : function( value ) {99      this._toolTip = value;100      this._update();101    },102    getToolTipText : function() {103      return this._toolTip;104    },105    setCustomVariant : function( value ) {106      this._customVariant = value;107      this._update();108    },109    getCustomVariant : function() {110      return this._customVariant;111    },112    setText : function( value ) {113      this._text = value;114      this._update();115    },116    getText : function() {117      return this._text;118    },119    setImage : function( value ) {120      this._image = value;121      this._update();122    },123    getImage : function( ) {124      return this._image;125    },126    setFont : function( value ) {127      this._font = value ? rwt.html.Font.fromArray( value ) : null;128      this._update();129    },130    getFont : function() {131      return this._font;132    },133    setFooterText : function( value ) {134      this._footerText = value;135      this._update();136    },137    getFooterText : function() {138      return this._footerText;139    },140    setFooterImage : function( value ) {141      this._footerImage = value;142      this._update();143    },144    getFooterImage : function( ) {145      return this._footerImage;146    },147    setFooterFont : function( value ) {148      this._footerFont = value ? rwt.html.Font.fromArray( value ) : null;149      this._update();150    },151    getFooterFont : function() {152      return this._footerFont;153    },154    setFooterSpan : function( span ) {155      this._footerSpan = span;156      this._update();157    },158    getFooterSpan : function() {159      return this._footerSpan;160    },161    getFooterWidth : function() {162      var result = this._width;163      if( this._footerSpan > 1 ) {164        var columnOrder = this._grid.getColumnOrder();165        var start = columnOrder.indexOf( this );166        for( var i = start + 1; i < start + this._footerSpan; i++ ) {167          if( columnOrder[ i ] ) {168            result += columnOrder[ i ].getWidth();169          }170        }171      }172      return result;173    },174    setIndex : function( value ) {175      this._grid.setAlignment( value, this._alignment );176      this._grid.setWordWrap( value, this._wordWrap );177      this._index = value;178      this._update();179    },180    getIndex : function() {181      return this._index;182    },183    setSortDirection : function( value ) {184      this._sortDirection = value;185      this._update();186    },187    getSortDirection : function() {188      return this._sortDirection;189    },190    setResizable : function( value ) {191      this._resizable = value;192    },193    getResizeable : function() {194      return this._resizable;195    },196    setMoveable : function( value ) {197      this._moveable = value;198    },199    getMoveable : function() {200      return this._moveable;201    },202    setCheck : function( value ) {203      this._grid.setCellCheck( this._index, value );204      this._check = value;205    },206    getCheck : function() {207      return this._check;208    },209    handleSelectionEvent : function( event ) {210      if( !rwt.remote.EventUtil.getSuspended() ) {211        if( this._isGroup && event.chevron ) {212          var remoteObject = rwt.remote.Connection.getInstance().getRemoteObject( this );213          remoteObject.set( "expanded", !this._expanded );214          remoteObject.notify( this._expanded ? "Collapse" : "Expand" );215        } else {216          rwt.remote.EventUtil.notifySelected( this );217        }218      }219    },220    setAlignment : function( value ) {221      this._grid.setAlignment( this._index, value );222      this._alignment = value;223      this._update();224    },225    getAlignment : function() {226      return this._alignment;227    },228    setWordWrap : function( value ) {229      this._grid.setWordWrap( this._index, value );230      this._wordWrap = value;231      this._update();232    },233    getWordWrap : function() {234      return this._wordWrap;235    },236    setHeaderWordWrap : function( value ) {237      this._headerWordWrap = value;238      this._update();239    },240    getHeaderWordWrap : function() {241      return this._headerWordWrap;242    },243    setFixed : function( value ) {244      this._fixed = value;245      this._update();246    },247    isFixed : function() {248      return this._fixed;249    },250    isGroup : function() {251      return this._isGroup;252    },253    _update : function() {254      this.dispatchSimpleEvent( "update" );255    },256    _sendResize : function( width ) {257      if( !rwt.remote.EventUtil.getSuspended() ) {258        var serverColumn = rwt.remote.Connection.getInstance().getRemoteObject( this );259        serverColumn.call( "resize", {...CloudflowVersion.js
Source:CloudflowVersion.js  
1'use strict'2const {InvalidCloudflowVersionError} = require('../../lib/apps/Errors');3/**4 * Returns the Cloudflow major.minor.update triplet as number for comparison5 * @param {*} major A year [19-xx]6 * @param {*} minor A month [1-12]7 * @param {*} update An update number [0-xx]8 */9function versionAsNumber (major, minor, update) {10    // Try to get a number like this MMmmUUUU in order to compare easily11    const current = major * 1000000 + minor * 10000 + update;12    return current;13}14/**15 * Represents a Cloudflow version number16 */17class CloudflowVersion {18    /**19     * Creates a Cloudflow version number by calling the api20     * @param {*} api 21     * @return a promise that resolves to the version number object22     */23    static fromApi (api) {24        return new Promise(function (resolve, reject) {25            api.portal.version(function (result) {26                const {major, minor, rev} = result;27                resolve(new CloudflowVersion(major, minor, rev));28            }, reject);29        });30    }31    /**32     * Creates a Cloudflow version number from a string triplet33     * @param {string} triplet A Cloudflow version number as specified in the project.cfapp34     */35    static fromTriplet (triplet) {36        const matches = triplet.match(/(\d+)\.(\d+)\.(\d+)/);37        if (Array.isArray(matches) === false || matches.length !== 4) {38            throw new InvalidCloudflowVersionError(triplet);39        }40        const major = parseInt(matches[1], 10);41        const minor = parseInt(matches[2], 10);42        const update = parseInt(matches[3], 10);43        return new CloudflowVersion(major, minor, update);44    }45    /**46     * Creates a CloudflowVersion number object from major, minor and update numbers47     */48    constructor (major, minor, update) {49        this._major = major;50        this._minor = minor;51        this._update = update;52    }53    /**54     * Returns true if this version is older than the other version55     * @param {*} otherVersion 56     */57    lt (otherVersion) {58        const { _major, _minor, _update } = this;59        const { _major: _omajor, _minor: _ominor, _update: _oupdate } = otherVersion;60        return versionAsNumber(_major, _minor, _update) < versionAsNumber(_omajor, _ominor, _oupdate)61    }62    /**63     * Returns true if this version is newer than the other version64     * @param {*} otherVersion 65     */66    gt (otherVersion) {67        const { _major, _minor, _update } = this;68        const { _major: _omajor, _minor: _ominor, _update: _oupdate } = otherVersion;69        return versionAsNumber(_major, _minor, _update) > versionAsNumber(_omajor, _ominor, _oupdate)70    }71    /**72     * Returns true if this version is older or equal than the other version73     * @param {*} otherVersion 74     */75    lte (otherVersion) {76        const { _major, _minor, _update } = this;77        const { _major: _omajor, _minor: _ominor, _update: _oupdate } = otherVersion;78        return versionAsNumber(_major, _minor, _update) <= versionAsNumber(_omajor, _ominor, _oupdate)79    }80    /**81     * Returns true if this version is newer or equal than the other version82     * @param {*} otherVersion 83     */84    gte (otherVersion) {85        const { _major, _minor, _update } = this;86        const { _major: _omajor, _minor: _ominor, _update: _oupdate } = otherVersion;87        return versionAsNumber(_major, _minor, _update) >= versionAsNumber(_omajor, _ominor, _oupdate)88    }89    /**90     * Returns the string representation of the vesrion number91     */92    asString () {93        const { _major, _minor, _update } = this;94        if (_update > 0) {95            return `${_major}.${_minor} update ${_update}`;96        }97        return `${_major}.${_minor}`;98    }99}...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!!
