How to use rm_r method in yandex-tank

Best Python code snippet using yandex-tank

calc_vars.py

Source:calc_vars.py Github

copy

Full Screen

...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]...

Full Screen

Full Screen

futil.py

Source:futil.py Github

copy

Full Screen

...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 """...

Full Screen

Full Screen

clean_ms365_mac.py

Source:clean_ms365_mac.py Github

copy

Full Screen

...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)...

Full Screen

Full Screen

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 yandex-tank 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