Best Python code snippet using Testify_python
JavCan.py
Source:JavCan.py
1import method.algofuncs as _af2####------------------------------------------------------------------------------------------------------------#####3def convertToJapanCandle(ticker_data):4 ticker_data['Height'] = ticker_data.apply(lambda x: x['High'] - x['Low'], axis=1)5 ticker_data['Body'] = ticker_data.apply(lambda x: abs(x['Close'] - x['Open']), axis=1)6 ticker_data['UpShadow'] = ticker_data.apply(7 lambda x: (x['High'] - x['Close']) if (x['Close'] > x['Open']) else (x['High'] - x['Open']), axis=1)8 ticker_data['LowerShadow'] = ticker_data.apply(9 lambda x: (x['Open'] - x['Low']) if (x['Close'] > x['Open']) else (x['Close'] - x['Low']), axis=1)10 if 'Time' in ticker_data.columns:11 from datetime import datetime12 ticker_data['Date'] = ticker_data.apply(13 lambda x: datetime.fromtimestamp(x['Time']).strftime("%m/%d/%Y"), axis=1)14 return ticker_data15####------------------------------------------------------------------------------------------------------------#####16BIG_BODY_PRICE_RATE = 0.04 # 4%17SMALL_BODY_PRICE_RATE = 0.0118UP_SHADOW_HEIGHT_RATE_65 = 0.6519UP_SHADOW_HEIGHT_RATE_30 = 0.3020UP_SHADOW_HEIGHT_RATE_25 = 0.2521UP_SHADOW_HEIGHT_RATE_05 = 0.0522BODY_HEIGHT_RATE_85 = 0.85 # for compare 4/523BODY_HEIGHT_RATE_60 = 0.60 # for compare 1/224BODY_HEIGHT_RATE_45 = 0.45 # for compare 1/225BODY_HEIGHT_RATE_35 = 0.35 # for compare 1/326BODY_HEIGHT_RATE_30 = 0.3 # for compare 1/327BODY_HEIGHT_RATE_20 = 0.2 # for compare 1/428BODY_HEIGHT_RATE_05 = 0.05 # for compare 1/2029LOWER_SHADOW_HEIGHT_RATE_65 = 0.6530LOWER_SHADOW_HEIGHT_RATE_30 = 0.3031LOWER_SHADOW_HEIGHT_RATE_25 = 0.2532LOWER_SHADOW_HEIGHT_RATE_05 = 0.0533##### --------------------------------------------------------------------------------- #####34def isBodyOver85(body, height):35 return True if body > BODY_HEIGHT_RATE_85 * height else False36def isBodyOver60(body, height):37 return True if body > BODY_HEIGHT_RATE_60 * height else False38def isBodyOver45(body, height):39 return True if body > BODY_HEIGHT_RATE_45 * height else False40def isBigBody(body, height, _open, _close):41 maxPrice = _open if _open > _close else _close42 if isBodyOver45(body, height) and body > BIG_BODY_PRICE_RATE * maxPrice:43 return True44 return False45def isSmallBody(body, height, _open, _close):46 maxPrice = _open if _open > _close else _close47 if isBodyLess35(body, height) and body < SMALL_BODY_PRICE_RATE * maxPrice:48 return True49 return False50def isBodyLess45(body, height):51 return True if body < BODY_HEIGHT_RATE_45 * height else False52def isBodyLess35(body, height):53 return True if body < BODY_HEIGHT_RATE_35 * height else False54def isBodyLess20(body, height):55 return True if body < BODY_HEIGHT_RATE_20 * height else False56def isDoji(body, height):57 if body < BODY_HEIGHT_RATE_05 * height:58 return True59 return False60##### --------------------------------------------------------------------------------- #####61def isWhiteCandlestick(open_price, close_price):62 if close_price > open_price:63 return True64 return False65def isBlackCandlestick(open_price, close_price):66 if close_price < open_price:67 return True68 return False69def isSpinningTopCandlestick(body, height, up, bot):70 if body < BODY_HEIGHT_RATE_35 * height:71 if up > UP_SHADOW_HEIGHT_RATE_30 * height:72 if bot > LOWER_SHADOW_HEIGHT_RATE_30 * height:73 return True74 return False75def isHammer(body, height, up, bot):76 if up < UP_SHADOW_HEIGHT_RATE_05 * height:77 if body < BODY_HEIGHT_RATE_30 * height:78 if bot > LOWER_SHADOW_HEIGHT_RATE_65 * height:79 return True80 return False81def isInvertedHammer(body, height, up, bot):82 if up > UP_SHADOW_HEIGHT_RATE_65 * height:83 if body < BODY_HEIGHT_RATE_30 * height:84 if bot < LOWER_SHADOW_HEIGHT_RATE_05 * height:85 return True86 return False87def isShavenHead(height, up):88 """89 Nến cạo Äầu90 :param height:91 :param up:92 :return:93 """94 if up < UP_SHADOW_HEIGHT_RATE_05 * height:95 return True96 return False97def isShavenBottom(height, bot):98 """99 Nến cạo Äáy100 :param height:101 :param bot:102 :return:103 """104 if bot < LOWER_SHADOW_HEIGHT_RATE_05 * height:105 return True106 return False107def isUmbrellaCandlestick(body, height, up, bot):108 return isHammer(body, height, up, bot)109####------------------------------------------------------------------------------------------------------------#####110def isUpTrendV1(_open, _close, _high, _low, _body, _height, _up, _down):111 isUpTrend = False112 if _close[-2] > _close[-3] > _close[-4]:113 isUpTrend = True114 if _high[-2] > _high[-3] > _high[-4]:115 isUpTrend = True116 if isWhiteCandlestick(_open[-2], _close[-2]) \117 and isWhiteCandlestick(_open[-3], _close[-3]) \118 and isWhiteCandlestick(_open[-4], _close[-4]):119 isUpTrend = True120 k = 0121 for i in [-2, -3, -4, -5, -6, -7]:122 if isWhiteCandlestick(_open[i], _close[i]) is True:123 k = k + 1124 if k > 3:125 isUpTrend = True126 return isUpTrend127def isDownTrendV1(_open, _close, _high, _low, _body, _height, _up, _down):128 if isUpTrendV1(_open, _close, _high, _low, _body, _height, _up, _down):129 return False130 isDownTrend = False131 if _close[-2] < _close[-3] < _close[-4]:132 isDownTrend = True133 if _low[-2] < _low[-3] < _low[-4]:134 isDownTrend = True135 if isBlackCandlestick(_open[-2], _close[-2]) \136 and isBlackCandlestick(_open[-3], _close[-3]) \137 and isBlackCandlestick(_open[-4], _close[-4]):138 isDownTrend = True139 k = 0140 for i in [-2, -3, -4, -5, -6, -7]:141 if isBlackCandlestick(_open[i], _close[i]) is True:142 k = k + 1143 if k > 3:144 isDownTrend = True145 return isDownTrend146####------------------------------------------------------------------------------------------------------------#####147def isUpTrendV2ByRSI(_close):148 return True if _af.RSIV2(_close, 5) > 55 else False149def isDownTrendV2ByRSI(_close):150 # return True if _af.RSIV2(_close, 5) < 45 else False151 # RSI for 5 days152 rsi = _af.RSI(_close, 5).tail(1).item()153 return True if rsi < 45 else False154####------------------------------------------------------------------------------------------------------------#####155def isHammerModel(_open, _close, _high, _low, _body, _height, _up, _down):156 """157 # In a down trend158 # today is a hammer candlestick159 :param :160 :return bool:161 """162 isDownTrend = isDownTrendV2ByRSI(_close[:-2])163 _iuc = isHammer(_body[-1], _height[-1], _up[-1], _down[-1])164 # _iwc = isWhiteCandlestick(_open[-1], _close[-1])165 if isDownTrend is True and _iuc is True:166 return True167 else:168 return False169def isHangingManModel(_open, _close, _high, _low, _body, _height, _up, _down):170 """171 # In a up trend (base on High price)172 # Small body height (base on total height)173 # Small or none upper shadow174 :param :175 :return:176 """177 # isUpTrend = isUpTrendV1(_open, _close, _high, _low, _body, _height, _up, _down)178 isUpTrend = isUpTrendV2ByRSI(_close[:-2])179 _iuc = isUmbrellaCandlestick(_body[-1], _height[-1], _up[-1], _down[-1])180 if isUpTrend is True and _iuc is True:181 return True182 else:183 return False184def isBullishEngulfing(_open, _close, _high, _low, _body, _height, _up, _down):185 """186 :param _open numpy array:187 :param _close:188 :param _body:189 :param _height:190 :param _up:191 :param _down:192 :return:193 """194 todayHasBigBody = isBigBody(_body[-1], _height[-1], _open[-1], _close[-1])195 if todayHasBigBody is False:196 return False197 prevDayIsSpinningCandlestick = isSpinningTopCandlestick(_body[-2], _height[-2], _up[-2], _down[-2])198 if prevDayIsSpinningCandlestick is True and _body[-1] < 2 * _body[-2]:199 return False200 isDownTrend = isDownTrendV1(_open, _close, _high, _low, _body, _height, _up, _down)201 prevDayIsBlackCandlestick = isBlackCandlestick(_open[-2], _close[-2])202 prevDayMaxOpenClose = _open[-2] if _open[-2] > _close[-2] else _close[-2]203 prevDayMinOpenClose = _open[-2] if _open[-2] < _close[-2] else _close[-2]204 prevDayIsDoJi = isDoji(_body[-2], _height[-2])205 todayIsWhiteCandlestick = isWhiteCandlestick(_open[-1], _close[-1])206 todayMaxOpenClose = _open[-1] if _open[-1] > _close[-1] else _close[-1]207 todayMinOpenClose = _open[-1] if _open[-1] < _close[-1] else _close[-1]208 if isDownTrend is True \209 and (prevDayIsBlackCandlestick is True or prevDayIsDoJi is True) \210 and prevDayMaxOpenClose <= 0.96 * todayMaxOpenClose \211 and prevDayMinOpenClose >= todayMinOpenClose \212 and todayIsWhiteCandlestick is True:213 return True214 return False215def isBearishEngulfing(_open, _close, _high, _low, _body, _height, _up, _down):216 isUpTrend = isUpTrendV1(_open, _close, _high, _low, _body, _height, _up, _down)217 todayIsBlackCandlestick = isBlackCandlestick(_open[-1], _close[-1])218 prevDayMaxOpenClose = _open[-2] if _open[-2] > _close[-2] else _close[-2]219 prevDayMinOpenClose = _open[-2] if _open[-2] < _close[-2] else _close[-2]220 todayMaxOpenClose = _open[-1] if _open[-1] > _close[-1] else _close[-1]221 todayMinOpenClose = _open[-1] if _open[-1] < _close[-1] else _close[-1]222 if isUpTrend is True \223 and prevDayMaxOpenClose <= todayMaxOpenClose \224 and prevDayMinOpenClose >= todayMinOpenClose \225 and todayIsBlackCandlestick is True:226 return True227 return False228def isPiercingPattern(_open, _close, _high, _low, _body, _height, _up, _down):229 isDownTrend = isDownTrendV1(_open, _close, _high, _low, _body, _height, _up, _down)230 the1stDayIsBlackCandlestick = isBlackCandlestick(_open[-2], _close[-2])231 the1stDayHasBigBody = isBodyOver45(_body[-2], _height[-2])232 the2ndDayIsWhiteCandlestick = isWhiteCandlestick(_open[-1], _close[-1])233 the2ndDayHasBigBody = isBodyOver45(_body[-1], _height[-1])234 the2ndDayFallInThe1stDay = True if _open[-1] < _close[-2] < _close[-1] < _open[-2] else False235 if isDownTrend is True and the1stDayIsBlackCandlestick is True and the1stDayHasBigBody is True \236 and the2ndDayIsWhiteCandlestick is True and the2ndDayHasBigBody is True \237 and the2ndDayFallInThe1stDay is True :238 return True239 return False240def isDarkCloudCoverPattern(_open, _close, _high, _low, _body, _height, _up, _down):241 isUpTrend = isUpTrendV1(_open, _close, _high, _low, _body, _height, _up, _down)242 prevDayIsWhiteCandlestick = isWhiteCandlestick(_open[-2], _close[-2])243 prevDayHasBigBody = isBodyOver45(_body[-2], _height[-2])244 todayIsBlackCandlestick = isBlackCandlestick(_open[-1], _close[-1])245 todayHasBigBody = isBodyOver45(_body[-1], _height[-1])246 todayFallInYesterday = True if _open[-2] < _close[-1] < _close[-2] < _open[-1] else False247 if isUpTrend is True and prevDayIsWhiteCandlestick is True and prevDayHasBigBody is True \248 and todayIsBlackCandlestick is True and todayHasBigBody is True \249 and todayFallInYesterday is True:250 return True251 return False252def isMorningStarsPattern(_open, _close, _high, _low, _body, _height, _up, _down):253 the1stDayIsBlackCandlestick = isBlackCandlestick(_open[-3], _close[-3])254 the1stDayHasBigBody = isBodyOver45(_body[-3], _height[-3])255 the2ndDayIsSmallBody = isBodyLess35(_body[-2], _height[-2])256 the2ndMaxOpenClosePrice = _open[-2] if _open[-2] > _close[-2] else _close[-2]257 the2ndDayHasGap = True if the2ndMaxOpenClosePrice < _close[-3] else False258 todayIsWhiteCandlestick = isWhiteCandlestick(_open[-1], _close[-1])259 todayFallInThe1stDay = True if _open[-3] > _close[-1] > _close[-3] and _body[-1] > 2 * _body[-2] else False260 if the1stDayIsBlackCandlestick is True and the1stDayHasBigBody is True \261 and the2ndDayIsSmallBody is True and the2ndDayHasGap is True \262 and todayIsWhiteCandlestick is True and todayFallInThe1stDay is True:263 return True264 return False265def isEveningStarsPattern(_open, _close, _high, _low, _body, _height, _up, _down):266 the1stDayIsWhiteCandlestick = isWhiteCandlestick(_open[-3], _close[-3])267 the1stDayHasBigBody = isBodyOver45(_body[-3], _height[-3])268 the2ndDayIsSmallBody = isBodyLess35(_body[-2], _height[-2])269 the2ndMinOpenClosePrice = _open[-2] if _open[-2] < _close[-2] else _close[-2]270 the2ndDayHasGap = True if the2ndMinOpenClosePrice > _close[-3] else False271 todayIsBlackCandlestick = isBlackCandlestick(_open[-1], _close[-1])272 todayFallInThe1stDay = True if _open[-3] < _close[-1] < _close[-3] and _body[-1] > 2 * _body[-2] else False273 if the1stDayIsWhiteCandlestick is True and the1stDayHasBigBody is True \274 and the2ndDayIsSmallBody is True and the2ndDayHasGap is True \275 and todayIsBlackCandlestick is True and todayFallInThe1stDay is True:276 return True277 return False278def isThreeBlackCrowsPattern(_open, _close, _high, _low, _body, _height, _up, _down):279 the1stDayIsBlackCandlestick = isBlackCandlestick(_open[-3], _close[-3])280 the2ndDayIsBlackCandlestick = isBlackCandlestick(_open[-2], _close[-2])281 todayIsBlackCandlestick = isBlackCandlestick(_open[-1], _close[-1])282 if the1stDayIsBlackCandlestick is True and the2ndDayIsBlackCandlestick is True and todayIsBlackCandlestick is True:283 return True284 return False285def isBullishHarami(_open, _close, _high, _low, _body, _height, _up, _down):286 isDownTrend = isDownTrendV1(_open, _close, _high, _low, _body, _height, _up, _down)287 yesterdayIsBlackCandlestick = isBlackCandlestick(_open[-2], _close[-2])288 yesterdayIsBigBody = isBodyOver45(_body[-2], _height[-2])289 toDayHasSmallBody = isSmallBody(_body[-1], _height[-1], _open[-1], _close[-1])290 todayIsDeepInYesterday = True if (_open[-2] + _close[-2]) / 2 > _open[-1] > _close[-2] else False291 if isDownTrend is True and yesterdayIsBlackCandlestick is True and yesterdayIsBigBody is True \292 and toDayHasSmallBody is True and todayIsDeepInYesterday is True:293 return True294 return False295def isBearishHarami(_open, _close, _high, _low, _body, _height, _up, _down):296 isUpTrend = isUpTrendV1(_open, _close, _high, _low, _body, _height, _up, _down)297 yesterdayIsWhiteCandlestick = isWhiteCandlestick(_open[-2], _close[-2])298 yesterdayIsBigBody = isBodyOver45(_body[-2], _height[-2])299 toDayHasSmallBody = isSmallBody(_body[-1], _height[-1], _open[-1], _close[-1])300 todayIsDeepInYesterday = True if _open[-2] < _close[-1] < (_open[-2] + _close[-2]) / 2 else False301 if isUpTrend is True and yesterdayIsWhiteCandlestick is True and yesterdayIsBigBody is True \302 and toDayHasSmallBody is True and todayIsDeepInYesterday is True:303 return True304 return False305####------------------------------------------------------------------------------------------------------------#####306def customBuySignal01(_open, _close, _high, _low, _body, _height, _up, _down):307 isDownTrend = isDownTrendV1(_open, _close, _high, _low, _body, _height, _up, _down)308 _ibc = isSpinningTopCandlestick(_body[-2], _height[-2], _up[-2], _down[-2])309 _iwc = isWhiteCandlestick(_open[-1], _close[-1])310 _ibb = isBigBody(_body[-1], _height[-1], _open[-1], _close[-1])311 if isDownTrend is True and _ibc is True \312 and _iwc is True and _ibb is True \313 and _close[-1] > _close[-2]:314 return "hasBuySignal-01"315 return False316def customBuySignal02(_open, _close, _high, _low, _body, _height, _up, _down):317 isDownTrend = isDownTrendV1(_open, _close, _high, _low, _body, _height, _up, _down)318 the2ndDayIsDoji = isDoji(_body[-2], _height[-2])319 todayIsShavenHead = isShavenHead(_height[-1], _up[-1])320 todayIsWhite = isWhiteCandlestick(_open[-1], _close[-1])321 if isDownTrend is True and the2ndDayIsDoji is True and todayIsShavenHead is True and todayIsWhite is True:322 return "hasBuySignal-02"323 return False324def customBuySignal03(_open, _close, _high, _low, _body, _height, _up, _down):325 # isDownTrend = isDownTrendV1(_open, _close, _high, _low, _body, _height, _up, _down)326 prevDayIsShavenBottom = isShavenBottom(_height[-2], _down[-2])327 todayIsShavenHead = isShavenHead(_height[-1], _up[-1])328 todayIsWhite = isWhiteCandlestick(_open[-1], _close[-1])329 if prevDayIsShavenBottom is True and todayIsShavenHead is True and todayIsWhite is True:330 return "hasBuySignal-03"331 return False332def customBuySignal04(_open, _close, _high, _low, _body, _height, _up, _down):333 """ Optimize the Hammer pattern"""334 isDownTrend = isDownTrendV2ByRSI(_close[:-2])335 todayIsHammer = isHammer(_body[-1], _height[-1], _up[-1], _down[-1])336 todayIsWhite = isWhiteCandlestick(_open[-1], _close[-1])337 if isDownTrend is True and todayIsHammer is True and todayIsWhite is True:338 return "hasBuySignal-04"339 return False340def customSellSignal01(_open, _close, _high, _low, _body, _height, _up, _down):341 todayIsDoJi = isDoji(_body[-1], _height[-1])342 prevDayIsDoJi = isDoji(_body[-2], _height[-2])343 if todayIsDoJi is True and prevDayIsDoJi is True:344 return True345def customSellSignal02(_open, _close, _high, _low, _body, _height, _up, _down):346 yesterdayIsBlack = isBlackCandlestick(_open[-1], _close[-1])347 todayIsWhite = isWhiteCandlestick(_open[-1], _close[-1])348 bodyTodayX2Yesterday = True if _body[-1] > 1.5*_body[-2] else False349 if yesterdayIsBlack is True and todayIsWhite is True and bodyTodayX2Yesterday is True:350 return True351####------------------------------------------------------------------------------------------------------------#####352def hasBuySignal(_open, _close, _high, _low, _body, _height, _up, _down, _volume=0, _date=''):353 # Hammer Pattern not working fine with back test, bad result354 # _iHm = isHammerModel(_open, _close, _high, _low, _body, _height, _up, _down)355 # if _iHm is True:356 # return 'isHammerModel'357 _ibu = isBullishEngulfing(_open, _close, _high, _low, _body, _height, _up, _down)358 if _ibu is True:359 return 'isBullishEngulfing'360 _ipp = isPiercingPattern(_open, _close, _high, _low, _body, _height, _up, _down)361 isVolumeUp = True if _volume[-1] > 1.4 * _volume[-2] else False362 if _ipp is True and isVolumeUp is True:363 return 'isPiercingPattern'364 _ims = isMorningStarsPattern(_open, _close, _high, _low, _body, _height, _up, _down)365 if _ims is True:366 return 'isMorningStarsPattern'367 _cBS01 = customBuySignal01(_open, _close, _high, _low, _body, _height, _up, _down)368 if _cBS01 is True:369 return 'customBuySignal01'370 _cBS02 = customBuySignal02(_open, _close, _high, _low, _body, _height, _up, _down)371 if _cBS02 is True:372 return 'customBuySignal02'373 _cBS03 = customBuySignal03(_open, _close, _high, _low, _body, _height, _up, _down)374 if _cBS03 is True:375 return 'customBuySignal03'376 _cBS04 = customBuySignal04(_open, _close, _high, _low, _body, _height, _up, _down)377 if _cBS04 is not False:378 return _cBS04379 return False380def hasSellSignal(_open, _close, _high, _low, _body, _height, _up, _down, _volume=0, _date=''):381 _ibe = isBearishEngulfing(_open, _close, _high, _low, _body, _height, _up, _down)382 if _ibe is True:383 return 'isBearishEngulfing'384 _idc = isDarkCloudCoverPattern(_open, _close, _high, _low, _body, _height, _up, _down)385 if _idc is True:386 return 'isDarkCloudCoverPattern'387 _ies = isEveningStarsPattern(_open, _close, _high, _low, _body, _height, _up, _down)388 if _ies is True:389 return 'isEveningStarsPattern'390 _itb = isThreeBlackCrowsPattern(_open, _close, _high, _low, _body, _height, _up, _down)391 if _itb is True:392 return 'isThreeBlackCrowsPattern'393 _iha = isHangingManModel(_open, _close, _high, _low, _body, _height, _up, _down)394 if _iha is True:395 return 'isHangingManModel'396 _cSS01 = customSellSignal01(_open, _close, _high, _low, _body, _height, _up, _down)397 if _cSS01 is True:398 return 'customSellSignal01'399 _cSS02 = customSellSignal02(_open, _close, _high, _low, _body, _height, _up, _down)400 if _cSS02 is True:401 return 'customSellSignal02'402 return False403def hasCustomBuySignal(_open, _close, _high, _low, _body, _height, _up, _down, version=0):404 if version == 1 or version == 0:405 _cBS01 = customBuySignal01(_open, _close, _high, _low, _body, _height, _up, _down)406 if _cBS01 is True:407 return 'customBuySignal01'408 if version == 2 or version == 0:409 _cBS02 = customBuySignal02(_open, _close, _high, _low, _body, _height, _up, _down)410 if _cBS02 is True:411 return 'customBuySignal02'412 if version == 3 or version == 0:413 _cBS03 = customBuySignal03(_open, _close, _high, _low, _body, _height, _up, _down)414 if _cBS03 is True:415 return 'customBuySignal03'416 return False417def hasCustomSellSignal(_open, _close, _high, _low, _body, _height, _up, _down, version=0):418 todayIsDoJi = isDoji(_body[-1], _height[-1])419 prevDayIsDoJi = isDoji(_body[-2], _height[-2])420 if todayIsDoJi is True and prevDayIsDoJi is True:...
widget.js
Source:widget.js
1var Alloy=require('/alloy'),2Backbone=Alloy.Backbone,3_=Alloy._;4function WPATH(s){var5index=s.lastIndexOf('/'),6path=-1===index?7'tf.app.dialog/'+s:8s.substring(0,index)+'/tf.app.dialog/'+s.substring(index+1);9return 0===path.indexOf('/')?path:'/'+path;10}11function __processArg(obj,key){12var arg=null;13return obj&&(arg=obj[key]||null),arg;14}15function Controller(){16var Widget=new(require('/alloy/widget'))('tf.app.dialog');17if(this.__widgetId='tf.app.dialog',require('/alloy/controllers/BaseController').apply(this,Array.prototype.slice.call(arguments)),this.__controllerPath='widget',this.args=arguments[0]||{},arguments[0])var18__parentSymbol=__processArg(arguments[0],'__parentSymbol'),19$model=__processArg(arguments[0],'$model'),20__itemTemplate=__processArg(arguments[0],'__itemTemplate');var21$=this,22exports={},23__defers={};24$.__views.winDialog=(require('/ui/common/custom_window').createWindow||Ti.UI.createWindow)(25{orientationModes:[Ti.UI.PORTRAIT],navBarHidden:!0,fullscreen:'true',exitOnClose:!1,id:'winDialog'}),26$.__views.winDialog&&$.addTopLevelView($.__views.winDialog),27$.__views.overlay=Ti.UI.createView(28{opacity:.5,backgroundColor:'#022632',id:'overlay'}),29$.__views.winDialog.add($.__views.overlay),30$.__views.welcomeBack=Alloy.createWidget('tf.app.dialog','welcomeBack',{id:'welcomeBack',__parentSymbol:$.__views.winDialog}),31$.__views.welcomeBack.setParent($.__views.winDialog),32_close?$.__views.welcomeBack.on('close',_close):__defers['$.__views.welcomeBack!close!_close']=!0,$.__views.showWelcome=Alloy.createWidget('tf.app.dialog','showWelcome',{id:'showWelcome',__parentSymbol:$.__views.winDialog}),33$.__views.showWelcome.setParent($.__views.winDialog),34_close?$.__views.showWelcome.on('close',_close):__defers['$.__views.showWelcome!close!_close']=!0,$.__views.done=Alloy.createWidget('tf.app.dialog','done',{id:'done',__parentSymbol:$.__views.winDialog}),35$.__views.done.setParent($.__views.winDialog),36_close?$.__views.done.on('close',_close):__defers['$.__views.done!close!_close']=!0,$.__views.enablePush=Alloy.createWidget('tf.app.dialog','enablePush',{id:'enablePush',__parentSymbol:$.__views.winDialog}),37$.__views.enablePush.setParent($.__views.winDialog),38_close?$.__views.enablePush.on('close',_close):__defers['$.__views.enablePush!close!_close']=!0,$.__views.deviceSyncing=Alloy.createWidget('tf.app.dialog','deviceSyncing',{id:'deviceSyncing',__parentSymbol:$.__views.winDialog}),39$.__views.deviceSyncing.setParent($.__views.winDialog),40_close?$.__views.deviceSyncing.on('close',_close):__defers['$.__views.deviceSyncing!close!_close']=!0,$.__views.mobileSyncing=Alloy.createWidget('tf.app.dialog','mobileSyncing',{id:'mobileSyncing',__parentSymbol:$.__views.winDialog}),41$.__views.mobileSyncing.setParent($.__views.winDialog),42_close?$.__views.mobileSyncing.on('close',_close):__defers['$.__views.mobileSyncing!close!_close']=!0,$.__views.fitbitSyncing=Alloy.createWidget('tf.app.dialog','fitbitSyncing',{id:'fitbitSyncing',__parentSymbol:$.__views.winDialog}),43$.__views.fitbitSyncing.setParent($.__views.winDialog),44_close?$.__views.fitbitSyncing.on('close',_close):__defers['$.__views.fitbitSyncing!close!_close']=!0,$.__views.linkFitbit=Alloy.createWidget('tf.app.dialog','linkFitbit',{id:'linkFitbit',__parentSymbol:$.__views.winDialog}),45$.__views.linkFitbit.setParent($.__views.winDialog),46_close?$.__views.linkFitbit.on('close',_close):__defers['$.__views.linkFitbit!close!_close']=!0,$.__views.linkFitbitActivity=Alloy.createWidget('tf.app.dialog','linkFitbitActivity',{id:'linkFitbitActivity',__parentSymbol:$.__views.winDialog}),47$.__views.linkFitbitActivity.setParent($.__views.winDialog),48_close?$.__views.linkFitbitActivity.on('close',_close):__defers['$.__views.linkFitbitActivity!close!_close']=!0,$.__views.syncFitbit=Alloy.createWidget('tf.app.dialog','syncFitbit',{id:'syncFitbit',__parentSymbol:$.__views.winDialog}),49$.__views.syncFitbit.setParent($.__views.winDialog),50_close?$.__views.syncFitbit.on('close',_close):__defers['$.__views.syncFitbit!close!_close']=!0,$.__views.enableTracking=Alloy.createWidget('tf.app.dialog','enableTracking',{id:'enableTracking',__parentSymbol:$.__views.winDialog}),51$.__views.enableTracking.setParent($.__views.winDialog),52_close?$.__views.enableTracking.on('close',_close):__defers['$.__views.enableTracking!close!_close']=!0,$.__views.rewardRedeemed=Alloy.createWidget('tf.app.dialog','rewardRedeemed',{id:'rewardRedeemed',__parentSymbol:$.__views.winDialog}),53$.__views.rewardRedeemed.setParent($.__views.winDialog),54_close?$.__views.rewardRedeemed.on('close',_close):__defers['$.__views.rewardRedeemed!close!_close']=!0,exports.destroy=function(){},55_.extend($,$.__views),56'use strict';var57Q=require('vendor/q'),58cus=require('services/current_user_service'),59open=!1,60_show=function(evt){61evt&&(62'link-fitbit'===evt.type?63$.linkFitbit.show():64'link-fitbit-activity'===evt.type?65$.linkFitbitActivity.show():66'sync-fitbit'===evt.type?67$.syncFitbit.show():68'enable-tracking'===evt.type?69$.enableTracking.show():70'show-welcome'===evt.type?(71$.overlay.backgroundColor='#FFF',72$.overlay.opacity=1,73$.showWelcome.show()):74'show-welcome-back'===evt.type?75$.welcomeBack.show():76'enable-push'===evt.type?77$.enablePush.show():78'device-syncing'===evt.type?79$.deviceSyncing.show():80'mobile-syncing'===evt.type?81$.mobileSyncing.show(evt.data):82'fitbit-syncing'===evt.type?83$.fitbitSyncing.show(evt.data):84'done'===evt.type?85$.done.show(evt.data):86'reward-redeemed'===evt.type&&87$.rewardRedeemed.show(evt.data));88},89_open=function(evt){90open?91LOGGER.warn('Cannot open dialog ['+evt.type+'] as modal dialog already open!'):(open=!0,$.winDialog.addEventListener('open',function open(){!1,$.winDialog.removeEventListener('open',open),_show(evt)}),require('ui/common/custom_window').openWindow($.winDialog));92},93_close=function(evt){94evt&&'close'!==evt.type?95_show(evt):(96require('ui/common/custom_window').closeWindow($.winDialog),97open=!1,98$.overlay.backgroundColor='#022632',99$.overlay.opacity=.5);100},101_init=function(){102DISPATCHER.on('tf:app.dialog.show',_open),103DISPATCHER.once('tf:logout',function cleanup(){104DISPATCHER.off('tf:app.dialog.show',_open);105}),106$.winDialog.onBack=function(){107DISPATCHER.trigger('tf:app.dialog.back');108};109};110exports.init=_init,111__defers['$.__views.welcomeBack!close!_close']&&$.__views.welcomeBack.on('close',_close),__defers['$.__views.showWelcome!close!_close']&&$.__views.showWelcome.on('close',_close),__defers['$.__views.done!close!_close']&&$.__views.done.on('close',_close),__defers['$.__views.enablePush!close!_close']&&$.__views.enablePush.on('close',_close),__defers['$.__views.deviceSyncing!close!_close']&&$.__views.deviceSyncing.on('close',_close),__defers['$.__views.mobileSyncing!close!_close']&&$.__views.mobileSyncing.on('close',_close),__defers['$.__views.fitbitSyncing!close!_close']&&$.__views.fitbitSyncing.on('close',_close),__defers['$.__views.linkFitbit!close!_close']&&$.__views.linkFitbit.on('close',_close),__defers['$.__views.linkFitbitActivity!close!_close']&&$.__views.linkFitbitActivity.on('close',_close),__defers['$.__views.syncFitbit!close!_close']&&$.__views.syncFitbit.on('close',_close),__defers['$.__views.enableTracking!close!_close']&&$.__views.enableTracking.on('close',_close),__defers['$.__views.rewardRedeemed!close!_close']&&$.__views.rewardRedeemed.on('close',_close),112_.extend($,exports);113}...
window.js
Source:window.js
...25 this._close = function (r) {26 this.close();27 if ($.isFunction(selected)) selected(r);28 };29 var html = '<div class="win"><div class="mask-layer"></div><div class="window-panel question"><div class="title-panel" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"></div><div class="title title-question"></div><a href="javascript:void(0)" onclick="win._close(false);" class="close-btn" title="å
³é">Ã</a><div class="body-panel"><p class="content"></p><p class="btns"><a href="#" class="w-btn" tabindex="1" onclick="win._close(true);">ç¡®å®</a><a href="#" class="w-btn qx" onclick="win._close(false);">åæ¶</a></p></div></div></div>';30 messageBox(html, message);31 };32 // å·¥ä½æ示-确认æ¡33 this.confirm_1 = function (message, selected) {34 this._close = function (r) {35 this.close();36 if ($.isFunction(selected)) selected(r);37 };38 var html = '<div class="win"><div class="mask-layer"></div><div class="window-panel question"><div class="title-panel" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"></div><div class="title title-question"></div><a href="javascript:void(0)" onclick="win.close();" class="close-btn" title="å
³é">Ã</a><div class="body-panel"><p class="content"></p><p class="btns"><a href="#" class="w-btn" tabindex="1" onclick="win._close(true);">æ¯</a><a href="#" class="w-btn qx" onclick="win._close(false);">å¦</a></p></div></div></div>';39 messageBox(html, message);40 };41 // æ示æ¡42 this.generalAlert = function (message, closed) {43 this._close = function () {44 this.close();45 if ($.isFunction(closed)) closed();46 };47 var html = '<div class="win"><div class="mask-layer"></div><div class="window-panel"><div class="title-panel" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"></div><div class="title"><h3></h3></div><a href="javascript:void(0)" onclick="win._close();" class="close-btn" title="å
³é">Ã</a><div class="body-panel"><p class="content"></p><p class="btns"><a href="#" class="w-btn" tabindex="1" onclick="win._close();">ç¡®å®</a></p></div></div></div>';48 messageBox(html, message);49 50 }51 52 //æåæ示æ¡53 this.successAlert = function (message, closed) {54 this._close = function () {55 this.close();56 if ($.isFunction(closed)) closed();57 };58 var html = '<div class="win"><div class="mask-layer"></div><div class="window-panel success"><div class="title-panel" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"></div><div class="title title-success"></div><a href="javascript:void(0)" onclick="win._close();" class="close-btn" title="å
³é">Ã</a><div class="body-panel"><p class="content"></p><p class="btns"></p></div></div></div>';59 messageBox(html, message);60 setTimeout(function () { win.close();}, 2000);61 }62 63 //é误æ示æ¡64 this.errorAlert = function (message, closed) {65 this._close = function () {66 this.close();67 if ($.isFunction(closed)) closed();68 }69 var html = '<div class="win"><div class="mask-layer"></div><div class="window-panel error"><div class="title-panel" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"></div><div class="title title-error"></div><a href="javascript:void(0)" onclick="win._close();" class="close-btn" title="å
³é">Ã</a><div class="body-panel"><p class="content"></p><p class="btns"><a href="#" class="w-btn" tabindex="1" onclick="win._close();">ç¡®å®</a></p></div></div></div>';70 messageBox(html, message);71 }72 73 //ä¿¡æ¯æ示æ¡74 this.infoAlert= function ( message, closed) {75 this._close = function () {76 this.close();77 if ($.isFunction(closed)) closed();78 }79 var html = '<div class="win"><div class="mask-layer"></div><div class="window-panel info"><div class="title-panel" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"></div><div class="title title-info"></div><a href="javascript:void(0)" onclick="win._close();" class="close-btn" title="å
³é">Ã</a><div class="body-panel"><p class="content"></p><p class="btns"><a href="#" class="w-btn" tabindex="1" onclick="win._close();">ç¡®å®</a></p></div></div></div>';80 messageBox(html, message);81 //setTimeout(function () { win.close();}, 2000);82 }83 84 // 审æ¹éè¿ç¡®è®¤æ¡85 this.approveConfirm = function (message, selected) {86 this._close = function (r) {87 this.close();88 if ($.isFunction(selected)) selected(r);89 };90 91 var html = '<div class="win"><div class="mask-layer"></div><div class="window-panel question"><div class="title-panel" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"></div><div class="title title-question"></div><a href="javascript:void(0)" onclick="win._close(false);" class="close-btn" title="å
³é">Ã</a><div class="body-panel"><p class="content"></p><p class="btns"><a href="#" class="w-btn" tabindex="1" onclick="win._close(111);">éè¿</a><a href="#" class="w-btn" tabindex="1" onclick="win._close(222);">ä¸éè¿</a><a href="#" class="w-btn qx" onclick="win._close(false);">åæ¶</a></p></div></div></div>';92 messageBox(html, message);93 };94 // çå¾
æ¡95 this.generalWait = function (message, closed) {96 97 var html = '<div class="win"><div class="mask-layer"></div><div class="window-panel"><div class="title-panel" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"></div><div class="title"><h3></h3></div><div class="body-panel"><p class="content"></p><p class="btns"></p></div></div></div>';98 messageBox(html, message);99 100 closed();101 102 };...
KB0.py
Source:KB0.py
1#!/usr/bin/env python32from time import sleep3keyStrokeDelay = .0064# Keycode Setup Shortcuts5_NULL = chr(0)6_BEGIN = _NULL*27_CLOSE = _NULL*58_CLEAR = _NULL*89_SHIFT = chr(2)+_NULL10_CTRL = chr(1)+_NULL11_ALT = chr(4)+_NULL12_META = chr(8)+_NULL13_CTRL_R = chr(16)+_NULL14_SHIFT_R = chr(32)+_NULL15_ALT_R = chr(64)+_NULL16_META_R = chr(128)+_NULL17# Alphabet18_a = _BEGIN+chr(4)+_CLOSE19_A = _SHIFT+chr(4)+_CLOSE20_b = _BEGIN+chr(5)+_CLOSE21_B = _SHIFT+chr(5)+_CLOSE22_c = _BEGIN+chr(6)+_CLOSE23_C = _SHIFT+chr(6)+_CLOSE24_d = _BEGIN+chr(7)+_CLOSE25_D = _SHIFT+chr(7)+_CLOSE26_e = _BEGIN+chr(8)+_CLOSE27_E = _SHIFT+chr(8)+_CLOSE28_f = _BEGIN+chr(9)+_CLOSE29_F = _SHIFT+chr(9)+_CLOSE30_g = _BEGIN+chr(10)+_CLOSE31_G = _SHIFT+chr(10)+_CLOSE32_h = _BEGIN+chr(11)+_CLOSE33_H = _SHIFT+chr(11)+_CLOSE34_i = _BEGIN+chr(12)+_CLOSE35_I = _SHIFT+chr(12)+_CLOSE36_j = _BEGIN+chr(13)+_CLOSE37_J = _SHIFT+chr(13)+_CLOSE38_k = _BEGIN+chr(14)+_CLOSE39_K = _SHIFT+chr(14)+_CLOSE40_l = _BEGIN+chr(15)+_CLOSE41_L = _SHIFT+chr(15)+_CLOSE42_m = _BEGIN+chr(16)+_CLOSE43_M = _SHIFT+chr(16)+_CLOSE44_n = _BEGIN+chr(17)+_CLOSE45_N = _SHIFT+chr(17)+_CLOSE46_o = _BEGIN+chr(18)+_CLOSE47_O = _SHIFT+chr(18)+_CLOSE48_p = _BEGIN+chr(19)+_CLOSE49_P = _SHIFT+chr(19)+_CLOSE50_q = _BEGIN+chr(20)+_CLOSE51_Q = _SHIFT+chr(20)+_CLOSE52_r = _BEGIN+chr(21)+_CLOSE53_R = _SHIFT+chr(21)+_CLOSE54_s = _BEGIN+chr(22)+_CLOSE55_S = _SHIFT+chr(22)+_CLOSE56_t = _BEGIN+chr(23)+_CLOSE57_T = _SHIFT+chr(23)+_CLOSE58_u = _BEGIN+chr(24)+_CLOSE59_U = _SHIFT+chr(24)+_CLOSE60_v = _BEGIN+chr(25)+_CLOSE61_V = _SHIFT+chr(25)+_CLOSE62_w = _BEGIN+chr(26)+_CLOSE63_W = _SHIFT+chr(26)+_CLOSE64_x = _BEGIN+chr(27)+_CLOSE65_X = _SHIFT+chr(27)+_CLOSE66_y = _BEGIN+chr(28)+_CLOSE67_Y = _SHIFT+chr(28)+_CLOSE68_z = _BEGIN+chr(29)+_CLOSE69_Z = _SHIFT+chr(29)+_CLOSE70# Numbers71_1 = _BEGIN+chr(30)+_CLOSE72_2 = _BEGIN+chr(31)+_CLOSE73_3 = _BEGIN+chr(32)+_CLOSE74_4 = _BEGIN+chr(33)+_CLOSE75_5 = _BEGIN+chr(34)+_CLOSE76_6 = _BEGIN+chr(35)+_CLOSE77_7 = _BEGIN+chr(36)+_CLOSE78_8 = _BEGIN+chr(37)+_CLOSE79_9 = _BEGIN+chr(38)+_CLOSE80_0 = _BEGIN+chr(39)+_CLOSE81_TENKEY1 = _BEGIN+chr(89)+_CLOSE82_TENKEY2 = _BEGIN+chr(90)+_CLOSE83_TENKEY3 = _BEGIN+chr(91)+_CLOSE84_TENKEY4 = _BEGIN+chr(92)+_CLOSE85_TENKEY5 = _BEGIN+chr(93)+_CLOSE86_TENKEY6 = _BEGIN+chr(94)+_CLOSE87_TENKEY7 = _BEGIN+chr(95)+_CLOSE88_TENKEY8 = _BEGIN+chr(96)+_CLOSE89_TENKEY9 = _BEGIN+chr(97)+_CLOSE90_TENKEY0 = _BEGIN+chr(98)+_CLOSE91# Non-Printing Keys92_ENTER = _BEGIN+chr(40)+_CLOSE93_ESCAPE = _BEGIN+chr(41)+_CLOSE94_BACKSPACE = _BEGIN+chr(42)+_CLOSE95_TAB = _BEGIN+chr(43)+_CLOSE96_SPACE = _BEGIN+chr(44)+_CLOSE97_CAPSLOCK = _BEGIN+chr(57)+_CLOSE98_PRINTSCREEN = _BEGIN+chr(70)+_CLOSE99_SCROLLLOCK = _BEGIN+chr(71)+_CLOSE100_PAUSE = _BEGIN+chr(72)+_CLOSE101_INSERT = _BEGIN+chr(73)+_CLOSE102_HOME = _BEGIN+chr(74)+_CLOSE103_PAGEUP = _BEGIN+chr(75)+_CLOSE104_DELETE = _BEGIN+chr(76)+_CLOSE105_END = _BEGIN+chr(77)+_CLOSE106_PAGEDOWN = _BEGIN+chr(78)+_CLOSE107_RIGHT = _BEGIN+chr(79)+_CLOSE108_LEFT = _BEGIN+chr(80)+_CLOSE109_DOWN = _BEGIN+chr(81)+_CLOSE110_UP = _BEGIN+chr(82)+_CLOSE111_NUMBERLOCK = _BEGIN+chr(83)+_CLOSE112_TENKEYENTER = _BEGIN+chr(88)+_CLOSE113# Symbols114_HYPHEN = _BEGIN+chr(45)+_CLOSE115_UNDERSCORE = _SHIFT+chr(45)+_CLOSE116_EQUALS = _BEGIN+chr(46)+_CLOSE117_PLUS = _SHIFT+chr(46)+_CLOSE118_LEFTBRACKET = _BEGIN+chr(47)+_CLOSE119_LEFTBRACE = _SHIFT+chr(47)+_CLOSE120_RIGHTBRACKET = _BEGIN+chr(48)+_CLOSE121_RIGHTBRACE = _SHIFT+chr(48)+_CLOSE122_BACKSLASH = _BEGIN+chr(49)+_CLOSE123_PIPE = _SHIFT+chr(49)+_CLOSE124_ELLIPSIS = _BEGIN+chr(50)+_CLOSE125_SEMICOLON = _BEGIN+chr(51)+_CLOSE126_COLON = _SHIFT+chr(51)+_CLOSE127_SINGLEQUOTE = _BEGIN+chr(52)+_CLOSE128_DOUBLEQUOTE = _SHIFT+chr(52)+_CLOSE129_BACKQUOTE = _BEGIN+chr(53)+_CLOSE130_TILDE = _SHIFT+chr(53)+_CLOSE131_COMMA = _BEGIN+chr(54)+_CLOSE132_LESSTHAN = _SHIFT+chr(54)+_CLOSE133_PERIOD = _BEGIN+chr(55)+_CLOSE134_GREATERTHAN = _SHIFT+chr(55)+_CLOSE135_SLASH = _BEGIN+chr(56)+_CLOSE136_QUESTIONMARK = _SHIFT+chr(56)+_CLOSE137_TENKEYDIVIDE = _BEGIN+chr(84)+_CLOSE138_TENKEYMULTIPLY = _BEGIN+chr(85)+_CLOSE139_TENKEYSUBTRACT = _BEGIN+chr(86)+_CLOSE140_TENKEYADD = _BEGIN+chr(87)+_CLOSE141_BANG = _SHIFT+chr(30)+_CLOSE142_AT = _SHIFT+chr(31)+_CLOSE143_HASH = _SHIFT+chr(32)+_CLOSE144_DOLLAR = _SHIFT+chr(33)+_CLOSE145_PERCENT = _SHIFT+chr(34)+_CLOSE146_CARET = _SHIFT+chr(35)+_CLOSE147_AMPERSAND = _SHIFT+chr(36)+_CLOSE148_ASTERISK = _SHIFT+chr(37)+_CLOSE149_LEFTPARENTHESIS = _SHIFT+chr(38)+_CLOSE150_RIGHTPARENTHESIS = _SHIFT+chr(39)+_CLOSE151# Function Keys152_F1 = _BEGIN+chr(58)+_CLOSE153_F2 = _BEGIN+chr(59)+_CLOSE154_F3 = _BEGIN+chr(60)+_CLOSE155_F4 = _BEGIN+chr(61)+_CLOSE156_F5 = _BEGIN+chr(62)+_CLOSE157_F6 = _BEGIN+chr(63)+_CLOSE158_F7 = _BEGIN+chr(64)+_CLOSE159_F8 = _BEGIN+chr(65)+_CLOSE160_F9 = _BEGIN+chr(66)+_CLOSE161_F10 = _BEGIN+chr(67)+_CLOSE162_F11 = _BEGIN+chr(68)+_CLOSE163_F12 = _BEGIN+chr(69)+_CLOSE164# Keyboard Shortcut Combos EXPERIMENTAL165_RUN = _META+chr(21)+_CLOSE166_SAVE = _CTRL+chr(22)+_CLOSE167_OUTPUT = _CTRL+chr(18)+_CLOSE168_CLOSEWINDOW = _ALT+chr(61)+_CLOSE169# Map characters to codes170charDict = {171" ": _SPACE,172"a": _a, 173"b": _b, 174"c": _c, 175"d": _d, 176"e": _e, 177"f": _f, 178"g": _g, 179"h": _h, 180"i": _i, 181"j": _j, 182"k": _k, 183"l": _l, 184"m": _m, 185"n": _n, 186"o": _o, 187"p": _p, 188"q": _q, 189"r": _r, 190"s": _s, 191"t": _t, 192"u": _u, 193"v": _v, 194"w": _w, 195"x": _x, 196"y": _y, 197"z": _z, 198"A": _A, 199"B": _B, 200"C": _C, 201"D": _D, 202"E": _E, 203"F": _F, 204"G": _G, 205"H": _H, 206"I": _I, 207"J": _J, 208"K": _K, 209"L": _L, 210"M": _M, 211"N": _N, 212"O": _O, 213"P": _P, 214"Q": _Q, 215"R": _R, 216"S": _S, 217"T": _T, 218"U": _U, 219"V": _V, 220"W": _W, 221"X": _X, 222"Y": _Y, 223"Z": _Z, 224"1": _1, 225"2": _2, 226"3": _3, 227"4": _4, 228"5": _5, 229"6": _6, 230"7": _7, 231"8": _8, 232"9": _9, 233"0": _0, 234"`": _BACKQUOTE, 235"~": _TILDE, 236"!": _BANG, 237"@": _AT, 238"#": _HASH, 239"$": _DOLLAR, 240"%": _PERCENT, 241"^": _CARET, 242"&": _AMPERSAND, 243"*": _ASTERISK, 244"(": _LEFTPARENTHESIS, 245")": _RIGHTPARENTHESIS, 246"-": _HYPHEN, 247"_": _UNDERSCORE, 248"=": _EQUALS, 249"+": _PLUS, 250"{": _LEFTBRACE, 251"}": _RIGHTBRACE, 252"[": _LEFTBRACKET, 253"]": _RIGHTBRACKET, 254"|": _PIPE, 255":": _COLON, 256";": _SEMICOLON, 257"\"": _DOUBLEQUOTE, 258"'": _SINGLEQUOTE, 259",": _COMMA, 260".": _PERIOD, 261"/": _SLASH, 262"<": _LESSTHAN, 263">": _GREATERTHAN, 264"?": _QUESTIONMARK, 265"\\": _BACKSLASH, 266"\"": _DOUBLEQUOTE, 267"\b": _BACKSPACE, 268"\t": _TAB, 269"\n": _ENTER 270}271def tx(report):272 with open('/dev/hidg0', 'rb+') as fd:273 fd.write(report.encode())274 fd.write(_CLEAR.encode())275 sleep(keyStrokeDelay)276def TX(string):277 for c in string:278 tx(getCode(c))279def getCode(character):...
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!!