How to use under method in uiautomator

Best Python code snippet using uiautomator

betterem.py

Source: betterem.py Github

copy

Full Screen

1"""2Better Emphasis.3pymdownx.betterem4Add intelligent handling of to em and strong notations5MIT license.6Copyright (c) 2014 - 2017 Isaac Muse <isaacmuse@gmail.com>7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated8documentation files (the "Software"), to deal in the Software without restriction, including without limitation9the rights to use, copy, modify, merge, publish, distribute, sublicense, and/​or sell copies of the Software,10and to permit persons to whom the Software is furnished to do so, subject to the following conditions:11The above copyright notice and this permission notice shall be included in all copies or substantial portions12of the Software.13THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED14TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL15THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF16CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER17DEALINGS IN THE SOFTWARE.18"""19from __future__ import absolute_import20from __future__ import unicode_literals21from markdown import Extension22from markdown.inlinepatterns import SimpleTagPattern, DoubleTagPattern23SMART_UNDER_CONTENT = r'((?:[^_]|_(?=\w|\s)|(?<=\s)_+?(?=\s))+?_*?)'24SMART_STAR_CONTENT = r'((?:[^\*]|\*(?=[^\W_]|\*|\s)|(?<=\s)\*+?(?=\s))+?\**?)'25SMART_UNDER_MIXED_CONTENT = r'((?:[^_]|_(?=\w)|(?<=\s)_+?(?=\s))+?_*)'26SMART_STAR_MIXED_CONTENT = r'((?:[^\*]|\*(?=[^\W_]|\*)|(?<=\s)\*+?(?=\s))+?\**)'27UNDER_CONTENT = r'(_|(?:(?<=\s)_|[^_])+?)'28UNDER_CONTENT2 = r'((?:[^_]|(?<!_)_(?=\w))+?)'29STAR_CONTENT = r'(\*|(?:(?<=\s)\*|[^\*])+?)'30STAR_CONTENT2 = r'((?:[^\*]|(?<!\*)\*(?=[^\W_]|\*))+?)'31# ***strong,em***32STAR_STRONG_EM = r'(\*{3})(?!\s)(\*{1,2}|[^\*]+?)(?<!\s)\2'33# ___strong,em___34UNDER_STRONG_EM = r'(_{3})(?!\s)(_{1,2}|[^_]+?)(?<!\s)\2'35# ***strong,em*strong**36STAR_STRONG_EM2 = r'(\*{3})(?![\s\*])%s(?<!\s)\*%s(?<!\s)\*{2}' % (STAR_CONTENT, STAR_CONTENT2)37# ___strong,em_strong__38UNDER_STRONG_EM2 = r'(_{3})(?![\s_])%s(?<!\s)_%s(?<!\s)_{2}' % (UNDER_CONTENT, UNDER_CONTENT2)39# ***em,strong**em*40STAR_EM_STRONG = r'(\*{3})(?![\s\*])%s(?<!\s)\*{2}%s(?<!\s)\*' % (STAR_CONTENT2, STAR_CONTENT)41# ___em,strong__em_42UNDER_EM_STRONG = r'(_{3})(?![\s_])%s(?<!\s)_{2}%s(?<!\s)_' % (UNDER_CONTENT2, UNDER_CONTENT)43# **strong**44STAR_STRONG = r'(\*{2})(?!\s)%s(?<!\s)\2' % STAR_CONTENT245# __strong__46UNDER_STRONG = r'(_{2})(?!\s)%s(?<!\s)\2' % UNDER_CONTENT247# *emphasis*48STAR_EM = r'(\*)(?!\s)%s(?<!\s)\2' % STAR_CONTENT49# _emphasis_50UNDER_EM = r'(_)(?!\s)%s(?<!\s)\2' % UNDER_CONTENT51# Smart rules for when "smart underscore" is enabled52# SMART: ___strong,em___53SMART_UNDER_STRONG_EM = r'(?<!\w)(_{3})(?![\s_])%s(?<!\s)\2(?!\w)' % SMART_UNDER_CONTENT54# ___strong,em_ strong__55SMART_UNDER_STRONG_EM2 = \56 r'(?<!\w)(_{3})(?![\s_])%s(?<!\s)_(?!\w)%s(?<!\s)_{2}(?!\w)' % (SMART_UNDER_MIXED_CONTENT, SMART_UNDER_CONTENT)57# ___em,strong__ em_58SMART_UNDER_EM_STRONG = \59 r'(?<!\w)(_{3})(?![\s_])%s(?<!\s)_{2}(?!\w)%s(?<!\s)_(?!\w)' % (SMART_UNDER_MIXED_CONTENT, SMART_UNDER_CONTENT)60# __strong__61SMART_UNDER_STRONG = r'(?<!\w)(_{2})(?![\s_])%s(?<!\s)\2(?!\w)' % SMART_UNDER_CONTENT62# SMART _em_63SMART_UNDER_EM = r'(?<!\w)(_)(?![\s_])%s(?<!\s)\2(?!\w)' % SMART_UNDER_CONTENT64# Smart rules for when "smart asterisk" is enabled65# SMART: ***strong,em***66SMART_STAR_STRONG_EM = r'(?:(?<=_)|(?<![\w\*]))(\*{3})(?![\s\*])%s(?<!\s)\2(?:(?=_)|(?![\w\*]))' % SMART_STAR_CONTENT67# ***strong,em* strong**68SMART_STAR_STRONG_EM2 = \69 r'(?:(?<=_)|(?<![\w\*]))(\*{3})(?![\s\*])%s(?<!\s)\*(?:(?=_)|(?![\w\*]))%s(?<!\s)\*{2}(?:(?=_)|(?![\w\*]))' % (70 SMART_STAR_MIXED_CONTENT, SMART_STAR_CONTENT71 )72# ***em,strong** em*73SMART_STAR_EM_STRONG = \74 r'(?:(?<=_)|(?<![\w\*]))(\*{3})(?![\s\*])%s(?<!\s)\*{2}(?:(?=_)|(?![\w\*]))%s(?<!\s)\*(?:(?=_)|(?![\w\*]))' % (75 SMART_STAR_MIXED_CONTENT, SMART_STAR_CONTENT76 )77# **strong**78SMART_STAR_STRONG = r'(?:(?<=_)|(?<![\w\*]))(\*{2})(?![\s\*])%s(?<!\s)\2(?:(?=_)|(?![\w\*]))' % SMART_STAR_CONTENT79# SMART *em*80SMART_STAR_EM = r'(?:(?<=_)|(?<![\w\*]))(\*)(?![\s\*])%s(?<!\s)\2(?:(?=_)|(?![\w\*]))' % SMART_STAR_CONTENT81class BetterEmExtension(Extension):82 """Add extension to Markdown class."""83 def __init__(self, *args, **kwargs):84 """Initialize."""85 self.config = {86 'smart_enable': ["underscore", "Treat connected words intelligently - Default: underscore"]87 }88 super(BetterEmExtension, self).__init__(*args, **kwargs)89 def extendMarkdown(self, md, md_globals):90 """Modify inline patterns."""91 # Not better yet, so let's make it better92 md.registerExtension(self)93 self.make_better(md)94 def make_better(self, md):95 """96 Configure all the pattern rules.97 This should be used instead of smart_strong package.98 pymdownx.extra should be used in place of markdown.extensions.extra.99 """100 config = self.getConfigs()101 enabled = config["smart_enable"]102 if enabled:103 enable_all = enabled == "all"104 enable_under = enabled == "underscore" or enable_all105 enable_star = enabled == "asterisk" or enable_all106 star_strong_em = SMART_STAR_STRONG_EM if enable_star else STAR_STRONG_EM107 under_strong_em = SMART_UNDER_STRONG_EM if enable_under else UNDER_STRONG_EM108 star_em_strong = SMART_STAR_EM_STRONG if enable_star else STAR_EM_STRONG109 under_em_strong = SMART_UNDER_EM_STRONG if enable_under else UNDER_EM_STRONG110 star_strong_em2 = SMART_STAR_STRONG_EM2 if enable_star else STAR_STRONG_EM2111 under_strong_em2 = SMART_UNDER_STRONG_EM2 if enable_under else UNDER_STRONG_EM2112 star_strong = SMART_STAR_STRONG if enable_star else STAR_STRONG113 under_strong = SMART_UNDER_STRONG if enable_under else UNDER_STRONG114 star_emphasis = SMART_STAR_EM if enable_star else STAR_EM115 under_emphasis = SMART_UNDER_EM if enable_under else UNDER_EM116 md.inlinePatterns["strong_em"] = DoubleTagPattern(star_strong_em, 'strong,em')117 md.inlinePatterns.add("strong_em2", DoubleTagPattern(under_strong_em, 'strong,em'), '>strong_em')118 md.inlinePatterns.link("em_strong", ">strong_em2")119 md.inlinePatterns["em_strong"] = DoubleTagPattern(star_em_strong, 'em,strong')120 md.inlinePatterns.add('em_strong2', DoubleTagPattern(under_em_strong, 'em,strong'), '>em_strong')121 md.inlinePatterns.add('strong_em3', DoubleTagPattern(star_strong_em2, 'strong,em'), '>em_strong2')122 md.inlinePatterns.add('strong_em4', DoubleTagPattern(under_strong_em2, 'strong,em'), '>strong_em3')123 md.inlinePatterns["strong"] = SimpleTagPattern(star_strong, 'strong')124 md.inlinePatterns.add("strong2", SimpleTagPattern(under_strong, 'strong'), '>strong')125 md.inlinePatterns["emphasis"] = SimpleTagPattern(star_emphasis, 'em')126 md.inlinePatterns["emphasis2"] = SimpleTagPattern(under_emphasis, 'em')127def makeExtension(*args, **kwargs):128 """Return extension."""...

Full Screen

Full Screen

helper.py

Source: helper.py Github

copy

Full Screen

1from mongoengine import connect2import datetime3from PolygonTickData.HistoricOHLCgetter import HistoricOHLC4from PolygonTickData.Helper import Helper5import pandas as pd6tickerlist = list(pd.read_csv("../​CSVFiles/​tickerlist.csv").columns.values)7def fetchETFsWithSameIssuer(connection=None, Issuer=None):8 CollectionName = connection.ETF_db.ETFHoldings9 dataD = CollectionName.aggregate([10 {"$match": {11 'Issuer': Issuer12 }},13 {"$group": {14 "_id": "$ETFTicker",15 "FundHoldingsDate": {"$last": '$FundHoldingsDate'},16 "TotalAssetsUnderMgmt": {"$last": "$TotalAssetsUnderMgmt"},17 "ETFName": {"$last": "$ETFName"},18 }},19 {"$project": {20 "ETFTicker": "$_id",21 "FundHoldingsDate": "$FundHoldingsDate",22 "TotalAssetsUnderMgmt": "$TotalAssetsUnderMgmt",23 "ETFName": "$ETFName"24 }}25 ])26 ETFWithSameIssuer = []27 for item in dataD:28 etfTicker = item['ETFTicker']29 if etfTicker not in tickerlist:30 t = {'etfTicker': etfTicker, 'ETFName': item['ETFName'],31 'TotalAssetsUnderMgmt': "${:,.3f} M".format(item['TotalAssetsUnderMgmt'] /​ 1000)}32 ETFWithSameIssuer.append(t)33 return ETFWithSameIssuer34def fetchETFsWithSameETFdbCategory(connection=None, ETFdbCategory=None):35 CollectionName = connection.ETF_db.ETFHoldings36 # Find ETFs with same ETFdbCategory37 dataD = CollectionName.aggregate([38 {"$match": {39 'ETFdbCategory': ETFdbCategory40 }},41 {"$group": {42 "_id": "$ETFTicker",43 "FundHoldingsDate": {"$last": '$FundHoldingsDate'},44 "TotalAssetsUnderMgmt": {"$last": "$TotalAssetsUnderMgmt"},45 "ETFName": {"$last": "$ETFName"},46 }},47 {"$project": {48 "ETFTicker": "$_id",49 "FundHoldingsDate": "$FundHoldingsDate",50 "TotalAssetsUnderMgmt": "$TotalAssetsUnderMgmt",51 "ETFName": "$ETFName"52 }}53 ])54 ETFWithSameETFDBCategory = []55 for item in dataD:56 etfTicker = item['ETFTicker']57 if etfTicker not in tickerlist:58 ETFWithSameETFDBCategory.append({'etfTicker': etfTicker, 'ETFName': item['ETFName'],59 'TotalAssetsUnderMgmt': "${:,.3f} M".format(60 item['TotalAssetsUnderMgmt'] /​ 1000)})61 return ETFWithSameETFDBCategory62def fetchETFsWithSimilarTotAsstUndMgmt(connection=None, totalassetUnderManagement=None):63 CollectionName = connection.ETF_db.ETFHoldings64 # TotalAssetUnderMgmt for given ETF + 10%65 taumpos = totalassetUnderManagement * 1.5066 # TotalAssetUnderMgmt for given ETF - 10%67 taumneg = totalassetUnderManagement * 0.5068 # Find ETFs with TotalAssetUnderMgmt +/​- 10% of given ETF's69 similar_taum_etfs = CollectionName.aggregate([70 {71 '$match': {72 'TotalAssetsUnderMgmt': {73 '$lte': taumpos,74 '$gte': taumneg75 }76 }77 }, {78 '$group': {79 '_id': '$ETFTicker',80 'FundHoldingsDate': {81 '$last': '$FundHoldingsDate'82 },83 'TotalAssetsUnderMgmt': {84 '$last': '$TotalAssetsUnderMgmt'85 },86 'ETFName': {87 '$last': '$ETFName'88 }89 }90 }, {91 '$project': {92 'ETFTicker': '$_id',93 'FundHoldingsDate': '$FundHoldingsDate',94 'TotalAssetsUnderMgmt': '$TotalAssetsUnderMgmt',95 'ETFName': '$ETFName'96 }97 }98 ])99 # List of Dicts100 ETFWithSameAssetUnderManagement = []101 for item in similar_taum_etfs:102 ETFWithSameAssetUnderManagement.append({'etfTicker': item['ETFTicker'], 'ETFName': item['ETFName'],103 'TotalAssetsUnderMgmt': "${:,.3f} M".format(104 item['TotalAssetsUnderMgmt'] /​ 1000)})105 return ETFWithSameAssetUnderManagement106def fetchOHLCHistoricalData(etfname=None, StartDate=None):107 ob = HistoricOHLC()108 data = ob.getopenlowhistoric(etfname=etfname, startdate=StartDate)109 del data['n']110 data.rename(columns={'v': 'volume',111 'o': 'open',112 'c': 'close',113 'h': 'high',114 'l': 'low',115 't': 'date'}, inplace=True)116 # Helper Class from PolygonTickData.Helper for converting uni timestamp to human timestamp117 helperObjTimeConversion = Helper()118 data['date'] = data['date'].apply(lambda x: helperObjTimeConversion.getHumanTime(ts=x, divideby=1000))...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Testing Modern Applications With Playwright ????

Web applications continue to evolve at an unbelievable pace, and the architecture surrounding web apps get more complicated all of the time. With the growth in complexity of the web application and the development process, web application testing also needs to keep pace with the ever-changing demands.

Joomla Testing Guide: How To Test Joomla Websites

Before we discuss the Joomla testing, let us understand the fundamentals of Joomla and how this content management system allows you to create and maintain web-based applications or websites without having to write and implement complex coding requirements.

Test Optimization for Continuous Integration

“Test frequently and early.” If you’ve been following my testing agenda, you’re probably sick of hearing me repeat that. However, it is making sense that if your tests detect an issue soon after it occurs, it will be easier to resolve. This is one of the guiding concepts that makes continuous integration such an effective method. I’ve encountered several teams who have a lot of automated tests but don’t use them as part of a continuous integration approach. There are frequently various reasons why the team believes these tests cannot be used with continuous integration. Perhaps the tests take too long to run, or they are not dependable enough to provide correct results on their own, necessitating human interpretation.

7 Skills of a Top Automation Tester in 2021

With new-age project development methodologies like Agile and DevOps slowly replacing the old-age waterfall model, the demand for testing is increasing in the industry. Testers are now working together with the developers and automation testing is vastly replacing manual testing in many ways. If you are new to the domain of automation testing, the organization that just hired you, will expect you to be fast, think out of the box, and able to detect bugs or deliver solutions which no one thought of. But with just basic knowledge of testing, how can you be that successful test automation engineer who is different from their predecessors? What are the skills to become a successful automation tester in 2019? Let’s find out.

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run uiautomator automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful