Best Python code snippet using autotest_python
getFriendsWeibo.py
Source: getFriendsWeibo.py
1# -*- coding: UTF-8 -*- 2'''3Created on 2013-12-124@author: Hao5'''6# import jieba7# import pymongo8from getAccessToken import getAcc9from userSpammerDetect import detector10from filterComment import filterWeibo11# åæç´¢12# seg_list = jieba.cut("ææ¥å°å京æ¸
å大å¦",cut_all=True) 13# print "Full Mode:", "/ ".join(seg_list) #å
¨æ¨¡å¼ 14client = getAcc().accessToken_get()15#建ç«mongoDBè¿æ¥16# conn = pymongo.Connection('localhost',27017)17# db = conn.test18# dbCollection = db.weibo19# å¾å°å
³æ³¨çå¾®å20status = client.statuses.friends_timeline.get()21get_statuses = status.__getattr__('statuses')22# type(get_statuses)23#è¾åºæ¯ä¸æ¡å¾®å以åå¾®åçè¯è®º24for count in range(len(get_statuses)):25# for count in range(5):26 print "~~~~~~~~~ä¸æ¡æ°å¾®å~~~~~~~~~~~~~"27 weibo = get_statuses[count]['text']28 print "weibo: " + str(weibo)29 30 messageid = get_statuses[count]['mid']31 commentCount = 032 while True:33 comments = client.comments.show.get(id=messageid, count=200, page=commentCount/200+1)34# seg_list = jieba.cut(comments, cut_all=False)35# print "| ".join(seg_list) 36 37 get_comments_status = comments.__getattr__('comments')38 numberOfSpammer = 039 numberOfReal = 040 for i in range(len(get_comments_status)):41 comment = get_comments_status[i]['text']42 print "origin comment: "+comment43 print "comment: "+filterWeibo().filtering(comment)44 userInfo = get_comments_status[i]['user']45 result = detector().detect(userInfo)46 if result:47 print "ä¸å¥åº·ç¨æ·"48 numberOfSpammer+=149 else:50 print "çå®ç¨æ·"51 numberOfReal+=152 53 commentCount+=20054 comments.__getattr__('total_number')55 totalComment = comments['total_number']56 print str(commentCount)+"--è¯è®ºæ°"+" æ»å
±æï¼"+str(totalComment)57 if commentCount>=totalComment:58 break;59# åå
¥mongoDB60# dbCollection.insert({"weibo":get_statuses[count],"count":count,"comments":comments, "numberOfSpammer":numberOfSpammer, "numberOfReal":numberOfReal})...
test_commit.py
Source: test_commit.py
...8 'get_statuses': lambda self: self.statuses,9 'statuses': []})10 commit = CommitMock()11 commit.pending()12 assert commit.get_statuses()[0].context == 'review/gitmate/manual'13 commit.ack()14 assert commit.get_statuses()[1].status == Status.SUCCESS15 commit.unack()16 assert commit.get_statuses()[2].status == Status.FAILED17 commit.pending()...
constants.py
Source: constants.py
...7SCREEN = pg.display.set_mode((WIDTH, HEIGHT))8IMG_FOLDER = 'img'# os.path.join('img','player')9BG = (144, 201, 120)10RED = (144, 0, 0)11PLAYER_STATUSES = get_statuses(os.path.join(IMG_FOLDER, 'player'))12ENEMIES_STATUSES = get_statuses(os.path.join(IMG_FOLDER, 'enemy'))13BULLET_IMG = os.path.join(IMG_FOLDER, 'bullets_and_grenades','bullet.png')14GRENADE_IMG = os.path.join(IMG_FOLDER, 'bullets_and_grenades','grenade.png')15EXPLOSION_STATUSES = get_statuses(os.path.join(IMG_FOLDER, 'explosion'))16IDLE_ANIMATION_COOLDOWN = 9017JUMP_ACTION_COOLDOWN = 4018GRAVITY = 0.98119GROUD_LINE = HEIGHT // 2...
Check out the latest blogs from LambdaTest on this topic:
Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.
So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.
Did you know that according to Statista, the number of smartphone users will reach 18.22 billion by 2025? Let’s face it, digital transformation is skyrocketing and will continue to do so. This swamps the mobile app development market with various options and gives rise to the need for the best mobile app testing tools
As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????
The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.
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!!