Best Python code snippet using autotest_python
execconfig.py
Source: execconfig.py
...5from waflib import Utils6import waflib7import os.path as osp8import os9def uniqify(lst):10 rlst = []11 for v in lst:12 # print v, rlst13 if v in rlst:14 # print "caught"15 continue16 rlst.append(v)17 return rlst18def ptrquote(st):19 res = ""20 for v in st:21 if v == '"':22 res += '\\"'23 else:24 res += v25 return res26@waflib.TaskGen.feature("build_pkgconfig")27def build_pkgconfig(self):28 from waflib.Tools.ccroot import USELIB_VARS29 if self.flavor == 'c':30 USELIB_VARS['build_pkgconfig'] = set(['INCLUDES', 'DEFINES', 'CPPFLAGS', 'CFLAGS'] + [31 'LIB', 'STLIB', 'LIBPATH', 'STLIBPATH', 'LINKFLAGS', 'RPATH', 'LINKDEPS'])32 cf = ['CPPFLAGS', 'CFLAGS']33 addlib = ["clik"]34 else:35 USELIB_VARS['build_pkgconfig'] = set(['FCFLAGS', 'DEFINES', 'INCLUDES'] + [36 'LIB', 'STLIB', 'LIBPATH', 'STLIBPATH', 'LINKFLAGS', 'RPATH', 'LINKDEPS'])37 cf = ['FCFLAGS']38 addlib = ["clik", "clik_f90"]39 # USELIB_VARS['cprogram']40 self.process_use()41 self.propagate_uselib_vars()42 vrs = dict([(v, list((self.env[v])))43 for v in USELIB_VARS['build_pkgconfig']])44 includepath = ptrquote(45 " ".join([self.env.CPPPATH_ST % v for v in uniqify(vrs["INCLUDES"])]))46 libpath = ptrquote(47 " ".join([self.env.LIBPATH_ST % v for v in uniqify(vrs["LIBPATH"])]))48 rlibpath = ptrquote(49 " ".join([self.env.RPATH_ST % v for v in uniqify(vrs["RPATH"])]))50 stlibpath = ptrquote(51 " ".join([self.env.LIBPATH_ST % v for v in uniqify(vrs["STLIBPATH"])]))52 libs = ptrquote(" ".join([self.env.LIB_ST %53 v for v in uniqify(vrs["LIB"] + addlib)]))54 stlibs = ptrquote(" ".join([self.env.STLIB_ST %55 v for v in uniqify(vrs["STLIB"])]))56 defines = ptrquote(57 " ".join([self.env.DEFINES_ST % v for v in uniqify(vrs["DEFINES"])]))58 cfs = []59 # print cf60 for tt in cf + ["LINKFLAGS"]:61 # print tt,vrs[tt]62 cfs += vrs[tt]63 # print cfs64 cflags = ptrquote(" ".join(uniqify(cfs)))65 # print "YEAH:"66 # print includepath67 # print libpath68 # print rlibpath69 # print stlibpath70 # print libs71 # print stlibs72 # print cflags73 # print defines74 alibs = ""75 if libs:76 alibs += (self.env.SHLIB_MARKER or "") + \77 " ".join([rlibpath, libpath, libs])78 if stlibs:...
test_iterlib.py
Source: test_iterlib.py
2from __future__ import unicode_literals, absolute_import, print_function, division3from unittest import TestCase4from libs.iterlib import uniqify, chunks, isplit5class IterlibTest(TestCase):6 def test_uniqify(self):7 self.assertListEqual(list(uniqify([1, 2, 3])), [1, 2, 3])8 self.assertListEqual(list(uniqify([1, 2, 3, 3])), [1, 2, 3])9 self.assertListEqual(10 list(uniqify([{"id": 1}, {"id": 2}, {"id": 2}], key=lambda x: x["id"])),11 [{"id": 1}, {"id": 2}]12 )13 def test_chunks(self):14 self.assertListEqual(15 list(chunks(range(10), size=1)),16 [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]17 )18 self.assertListEqual(19 list(chunks(range(10), size=3)),20 [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]]21 )22 self.assertListEqual(23 list(chunks(range(10), size=10)),24 [list(range(10))]...
words_synonym.py
Source: words_synonym.py
1#!/usr/bin/python2# -*- coding: utf-8 -*-3"""4Created on Thu Jul 21 12:33 20165@author: daphnehb6Code de traitement du langages7Ici on associe un mot avec une liste de synonymes8"""9from nltk.corpus import wordnet as wn10def special_cases(mot):11 if mot =='r&d' :12 return ['research','development']13 if mot=='research' or mot=='development' :14 return ['r&d']15 return []16def found_synonyms (mot, lang='eng') :17 """18 Retourne tous les synonymes d'un mot, lieu-même inclus19 ATTENTION : ne fonctionne que avec l'anglais20 :param mot:21 :param lang:22 :return:23 """24 mot=mot.lower()25 synonyms = [mot] + special_cases(mot)26 for synset in wn.synsets(mot):27 for lemma in synset.lemmas(lang=lang):28 name = lemma.name()29 if not name == mot :30 synonyms.append(name)31 return synonyms32def text_synonyms(list_mots_uniqify,lang='eng') :33 """34 Pour tous les mots d'une liste/dictionnaire/list de tuples35 (dont le premier elt est le mot) de mots unifiée36 Renvoie le dictionnaire associant à chaque sa liste de synonymes dans la langue demandée37 ATTENTION : ne fonctionne qu'avec la langue anglaise38 :param list_mots_uniqify:39 :param lang:40 :return:41 """42 mot_syns = dict()43 if type(list_mots_uniqify) is dict:44 list_mots_uniqify = list_mots_uniqify.items()45 for mot in list_mots_uniqify :46 if type(mot) is tuple :47 mot = mot[0]48 syns = found_synonyms(mot,lang=lang)49 mot_syns[mot] = syns50 return mot_syns51##################################...
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!!