Best Python code snippet using molecule_python
game_1.py
Source:game_1.py
...63 j[slot] = ""64 await ctx.send(pprint.pformat(j))65 elif "-t" in args:66 belt = Belts(player)67 text = f"{ctx.author.nick} РазгÑÑзка: {belt.get_configs()['name']}\n"68 for slot in belt.get_configs()["data"]["belt"]:69 item_obj = belt["data"]["belt"][slot]70 if item_obj:71 item = items.Item(item_obj["_id"])72 text += f"ÑÐ»Ð¾Ñ {slot}: {item.get_configs()['name']}, "\73 f"{item['data']['ammo_count']}/{item.get_configs()['parameters']['mag_size']}, "\74 f"{get_info_for_tpl(item['data']['ammo_type'])['name'][7:]}\n"75 else:76 text += f"ÑÐ»Ð¾Ñ {slot}: пÑÑÑ\n"77 await ctx.send(text)78 else:79 belt = Belts(player)80 embed = discord.Embed(title=f"{ctx.author.name} РазгÑÑзка:",81 description=belt.get_configs()["name"], color=0xfad000)82 for slot in belt.get_configs()["data"]["belt"]:83 item_obj = belt["data"]["belt"][slot]84 if item_obj:85 item = items.Item(item_obj["_id"])86 embed.add_field(name=f"ÑÐ»Ð¾Ñ {slot}",87 value=f"{item.get_configs()['name']}, "88 f"{item['data']['ammo_count']}/{item.get_configs()['parameters']['mag_size']}, "89 f"{get_info_for_tpl(item['data']['ammo_type'])['name'][7:]}", inline=False)90 else:91 embed.add_field(name=f"ÑÐ»Ð¾Ñ {slot}", value="пÑÑÑ", inline=False)92 await ctx.send(embed=embed)93 @commands.command(aliases=["ue", "ÑнÑÑÑ"])94 @benchmark95 @rp_command96 async def takeoff(self, ctx: discord.ext.commands.context.Context, *args):97 player = Player(ctx.author.id)98 belt = Belts(player)99 if args[0] in belt.get_configs()["parameters"]["belt"]["associate_keys"].keys():100 key = belt.get_configs()["parameters"]["belt"]["associate_keys"][args[0]]101 if belt["data"]["belt"][key]:102 player.add_to_inventory(belt["data"]["belt"][key])103 belt.update(f'data.belt.{key}', {})104 if args[0].isdigit():105 if int(args[0]) in range(1, 7):106 item = player["equipment"][f"slot_{args[0]}"]107 if item:108 player.update(f"equipment.slot_{args[0]}", {})109 player.add_to_inventory(item)110 @commands.command(aliases=["ÑкипиÑоваÑÑ", "eq"])111 @benchmark112 @rp_command113 async def equip(self, ctx: discord.ext.commands.context.Context, *args):114 player = Player(ctx.author.id)115 item = items.Item(player["inventory"][int(args[0]) - 1]["_id"])116 item_obj = player["inventory"][int(args[0]) - 1]117 if item.get_type() in ["magazine"]:118 if len(args) == 1:119 pass120 else:121 slot = args[1]122 belt = Belts(player)123 if slot in belt.get_configs()["parameters"]["belt"]["associate_keys"].keys():124 slot = belt.get_configs()["parameters"]["belt"]["associate_keys"][slot]125 if slot[0] in item.get_configs()["parameters"]["slots"]:126 old_mag = belt["data"]["belt"][slot]127 if old_mag:128 player.add_to_inventory(old_mag)129 belt.update(f"data.belt.{slot}", item_obj)130 player.remove_from_inventory(item_obj["_id"])131 else:132 pass133 elif item.get_type() in ["belt", "weapon","armor"]:134 if len(args) == 1:135 slot = item.get_configs()["parameters"]["slots"][0]136 elif not args[1].isdigit():137 pass138 return139 else:140 slot = f"slot_{args[1]}"141 if not slot in item.get_configs()["parameters"]["slots"]:142 slot = item.get_configs()["parameters"]["slots"][0]143 if player["equipment"][slot]:144 player.add_to_inventory(player["equipment"][slot])145 player.remove_from_inventory(item_obj["_id"])146 player.update(f"equipment.{slot}", item_obj)147 @commands.command(aliases=["g_ÑкипиÑоваÑÑ", "ge"])148 @benchmark149 @rp_command150 async def g_equip(self, ctx: discord.ext.commands.context.Context, *args):151 pass152 @commands.command(aliases=["оÑÑжие"])153 @benchmark154 @rp_command155 async def weapon(self, ctx: discord.ext.commands.context.Context, *args):156 player = Player(ctx.author.id)...
eval.py
Source:eval.py
...15Evaluating the latency and accuracy of GPUNet16--------Configurations of GPUNet--------17## Without distillation18# GPUNet-219modelJSON, cpkPath = get_configs(batch=1, latency="1.75ms", gpuType="GV100")20# GPUNet-121modelJSON, cpkPath = get_configs(batch=1, latency="0.85ms", gpuType="GV100")22# GPUNet-023modelJSON, cpkPath = get_configs(batch=1, latency="0.65ms", gpuType="GV100")24## With distillation25# GPUNet-D226modelJSON, cpkPath = get_configs(batch=1, latency="2.25ms-D", gpuType="GV100")27# GPUNet-D128modelJSON, cpkPath = get_configs(batch=1, latency="1.25ms-D", gpuType="GV100")29# GPUNet-P030modelJSON, cpkPath = get_configs(batch=1, latency="0.5ms-D", gpuType="GV100")31# GPUNet-P132modelJSON, cpkPath = get_configs(batch=1, latency="0.8ms-D", gpuType="GV100")33----------------------------------------34What can you do?351. Test GPUNet accuracy.362. Benchmarking the latency:37 Export GPUNet to ONNX, then 'trtexec --onnx=gpunet.onnx --fp16'.38 We reported the median GPU compute time. Here is an example,39 GPU Compute Time: ..., median = 0.752686 ms, ...40"""41from configs.model_hub import get_configs, get_model_list42from models.gpunet_builder import GPUNet_Builder43modelJSON, cpkPath = get_configs(batch=1, latency="0.65ms", gpuType="GV100")44print(get_model_list(1))45builder = GPUNet_Builder()46model = builder.get_model(modelJSON)47builder.export_onnx(model)48print(model, model.imgRes)49builder.test_model(50 model,51 testBatch=200,52 checkpoint=cpkPath,53 imgRes=(3, model.imgRes, model.imgRes),54 dtype="fp16",55 crop_pct=1,56 val_path="/root/data/imagenet/val",57)
constants.py
Source:constants.py
...3class Gender(Enum):4 MALE = 'male'5 FEMALE = 'female'6email_service_data = {7 'host': get_configs().yandex_hostname,8 'port': get_configs().yandex_port,9 'username': get_configs().yandex_mail,10 'password': get_configs().yandex_password...
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!!