Best Python code snippet using yandex-tank
calc_vars.py
Source: calc_vars.py
...14# The function calc_rm_r computes the reduced distance of closest approach rm_r15# This is done by solving "1-4*((1/rm_r)^12-(1/rm_r)^6)/g_r^2-b_r^2/rm_r^2=0"16# The goal is to find the maximum limit in "int_ki[i]" in function "ki_r"17# Because we're integrating from this value.18def calc_rm_r(g_r, b_r):19 coeff = [1, 0, -b_r**2, 0, 0, 0, 4/g_r**2, 0, 0, 0, 0, 0, -4/g_r**2]20 rm_r = np.roots(coeff)21 for i in range(0,len(rm_r)):22 if np.isreal(rm_r[i])==False:23 rm_r[i] = 024 elif rm_r[i]<0:25 rm_r[i] = 0 26 rm_r = max(np.real(rm_r))27 return rm_r + 0.000128# Here 0.0001 has been added to the solution to avoid the integration of an29# infinite value which would give a "nan" error30# 0.0001 represents a small value compared to r_step which the integration step31# The function phi_r simply calculates the reduced Stockmayer potential32def phi_r(r_ri,delta):33 phi_r = 4*((1/r_ri)**12-(1/r_ri)**6-delta*(1/r_ri)**3)34 return phi_r35# The function ki_r calculates the reduced angle of deflection36# by integrating on r_r a function of phi_r, b_r(i),g_r(i)37# from rm_r to infinity38def ki_r(g_ri,b_ri,r_step,r_max,delta):39 r_min = calc_rm_r(g_ri,b_ri)40 r_r = np.arange(r_min,r_max+r_step,r_step)41 int_ki = [0]42 for i in range(0,len(r_r)):43 int_ki[i] = 1/((r_r[i]**2)*(1-(b_ri**2/r_r[i]**2)-(phi_r(r_r[i],delta)/g_ri**2))**0.5)44 if i < len(r_r)-1:45 int_ki.append(0)46 ki_r = math.pi-2*b_ri*np.trapz(int_ki,r_r)47 return ki_r48# The function Ql_r calculates the reduced cross-section49# by integrating on b_r a function of ki_r50# from 0 to infinity51def Ql_r(l,g_ri,b_min,b_step,b_max,r_step,r_max,delta):52 b_r = np.arange(b_min,b_max+b_step,b_step)53 int_Q = [0]...
futil.py
Source: futil.py
...32 >>> path.endswith(os.path.join('nlpia', 'futil.py'))33 True34 """35 return ls(path, force=force)36def rm_r(path, force=False):37 """ bash `rm -r`: Recursively remove dirpath. If `force==True`, don't raise exception if path doesn't exist.38 >>> rm_r('/tmp/nlpia_dir_that_doesnt_exist_3.141591234/', force=True)39 >>> rm_r('/tmp/nlpia_dir_that_doesnt_exist_3.141591234/')40 Traceback (most recent call last):41 ...42 FileNotFoundError: [Errno 2] No such file or directory: '/tmp/nlpia_dir_that_doesnt_exist_3.141591234'43 """44 path = expand_path(path)45 logger.debug('path={}'.format(path))46 if os.path.isfile(path):47 return os.remove(path)48 elif os.path.isdir(path):49 try:50 return os.rmdir(path)51 except OSError: # OSError: [Errno 66] Directory not empty: 52 pass53 except:54 if not force:55 raise56 elif not force:57 return os.rmdir(path)58 names = ls(path, force=force)59 # if ls() returns a list, path must be the full path to a directory60 if isinstance(names, list):61 if names:62 for filename in names:63 return rm_r(os.path.join(path, filename), force=force)64 else:65 os.rmdir(path)66 # if ls() returns a str, path must be the full path to a file67 elif isinstance(names, str):68 return os.remove(names, force=force)69 if force:70 return None71 return os.rmdir(path)72def rm_rf(path):73 """ bash `rm -rf`: Recursively remove dirpath. Don't raise exception if path doesn't exist.74 >>> rm_rf('/tmp/nlpia_dir_that_doesnt_exist_3.141591234/')75 """...
clean_ms365_mac.py
Source: clean_ms365_mac.py
...39 if os.path.isdir(path):40 os.rmdir(path)41 elif os.path.isfile(path):42 os.remove(path)43def rm_r(dir, filenames):44 for f in filenames:45 remove(os.path.join(dir, f))46HOME_LIB: str = os.path.join(os.getenv("HOME"), "Library")47rm_r("/Library/LaunchDaemons", LAUNCH_DAEMONS)48rm_r("/Library/LaunchAgents", LAUNCH_AGENTS)49rm_r("/Library/PrivilegedHelperTools", PRIVILEGED_HELPER_TOOLS)50rm_r(os.path.join(HOME_LIB, "Containers"), CONTAINER)51rm_r(os.path.join(HOME_LIB, "Group Containers"), GROUP_CONTAINERS)52rm_r(os.path.join(HOME_LIB, "COOKIES"), COOKIES)...
Check out the latest blogs from LambdaTest on this topic:
The key to successful test automation is to focus on tasks that maximize the return on investment (ROI), ensuring that you are automating the right tests and automating them in the right way. This is where test automation strategies come into play.
Greetings folks! With the new year finally upon us, we’re excited to announce a collection of brand-new product updates. At LambdaTest, we strive to provide you with a comprehensive test orchestration and execution platform to ensure the ultimate web and mobile experience.
Entering the world of testers, one question started to formulate in my mind: “what is the reason that bugs happen?”.
“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.
The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.
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!!