Best Python code snippet using autotest_python
plot_tabulate_results.py
Source: plot_tabulate_results.py
...8 parser.add_argument("-o,--output-file", dest="output_file",9 default="", help="name to save plot with")10 args = parser.parse_args()11 return (args.data_file, args.output_file)12def get_profilers(column_names):13 potnl_cols = ['dim', 'E', 'alpha']14 profiler_cols = [c for c in column_names if c not in potnl_cols]15 if len(profiler_cols) % 3 != 0:16 raise IOError("invalid data column format")17 return [p[:p.find("_action")] for p in profiler_cols[::3]]18def get_profiler_data(profiler, dim, E, data):19 dim_data = data["dim"]20 E_data = data["E"]21 action_data = data[profiler + "_action"]22 timing_data = data[profiler + "_timems"]23 error_data = data[profiler + "_error"]24 profiler_data = {"action": action_data[(dim_data == dim) & (E_data == E)],25 "timing": timing_data[(dim_data == dim) & (E_data == E)],26 "error": error_data[(dim_data == dim) & (E_data == E)]27 }28 return profiler_data29def read_data(data_file):30 data = np.genfromtxt(data_file, names=True)31 cols = [c for c in data.dtype.fields]32 if "dim" not in cols:33 raise IOError("missing dimension column")34 dim = np.unique(data["dim"])[0]35 if "E" not in cols:36 raise IOError("missing E parameter column")37 E = np.unique(data["E"])[0]38 if "alpha" not in cols:39 raise IOError("missing alpha parameter column")40 alpha_data = data["alpha"]41 profilers = get_profilers(cols)42 profilers_data = {}43 for p in profilers:44 profilers_data[p] = get_profiler_data(p, dim, E, data)45 return (dim, E, alpha_data, profilers_data)46def plot_action(axis, alpha_values, profilers_data):47 for p in profilers_data:48 error_data = profilers_data[p]["error"]49 valid_alpha_values = alpha_values[error_data == 0]50 valid_action_data = profilers_data[p]["action"][error_data == 0]51 axis.semilogy(valid_alpha_values, valid_action_data, label=p)52 axis.set_ylabel("Action")53 axis.legend(numpoints=1)54 axis.grid()55def plot_timings(axis, alpha_values, profilers_data):...
init.py
Source: init.py
...25 module = importlib.import_module(f'profilers.{dest.name}')26 profile = getattr(module, "profile")27 with profile(dest, fn_name, ts):28 fn()29def get_profilers():30 import profilers31 import os32 for module in pkgutil.iter_modules([os.path.dirname(profilers.__file__)]):33 if module.name != "init":34 yield module.name35def main():36 import sys, os37 os.environ["XONSH_NO_AMALGAMATE"] = "1"38 args = sys.argv[1:]39 if not args: # just the file name40 import subprocess as sp41 for typ in get_profilers():42 ts = get_timestamp()43 if branch := get_vcs_mark():44 ts = branch45 dest = Path(__file__).parent.parent / "results" / typ46 dest.mkdir(parents=True, exist_ok=True)47 for fn in ["script_echo", "shell_rl", "shell_ptk"]:48 # run as subprocess so that will not interfere each other functions49 args = [sys.executable, __file__, fn, str(dest), ts]50 print(f"Running {args}")51 sp.run(args, env=os.environ)52 else:53 bench(args[0], Path(args[1]), args[2])54if __name__ == "__main__":55 main()
worker.py
Source: worker.py
1###############################################################################2#3# Crossbar.io Master4# Copyright (c) Crossbar.io Technologies GmbH. Licensed under EUPLv1.2.5#6###############################################################################7from crossbar.master.api.remote import RemoteApi8__all__ = ('RemoteWorkerApi', )9class RemoteWorkerApi(RemoteApi):10 PREFIX = u'crossbarfabriccenter.remote.worker.'11 PROCS = {12 # these are worker level procedures13 u'worker': [14 u'shutdown',15 u'get_status',16 u'get_pythonpath',17 u'add_pythonpath',18 u'get_cpu_affinity',19 u'set_cpu_affinity',20 u'get_profilers',21 u'start_profiler',22 u'get_profile',23 u'get_process_info',24 u'get_process_stats',25 u'set_process_stats_monitoring',26 ],27 }28 EVENTS = {29 # these are worker level topics30 u'worker': [31 u'on_worker_log',32 u'on_profile_started',33 u'on_profile_finished',34 ]...
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!!