Best Python code snippet using pytest-benchmark
FinalData.py
Source: FinalData.py
1#!/usr/bin/env python2# -*- coding:utf-8 -*-3# author: lph time:2019/6/134import numpy as np5from CPA.DCPA_TCPA import CPA6# 计ç®DCPAåTCPA7def calculation(_dict):8 _vessel = _dict["SHIP_INFO"]9 length = len(_vessel)10 results = []11 for num in range(length):12 for _next_num in range(num+1, length):13 if _vessel[_next_num].MMSI != _vessel[num].MMSI:14 if _vessel[_next_num].area_id in _vessel[num].need_id():15 try:16 _cpa = CPA(_vessel[num], _vessel[_next_num])17 dcpa, tcpa = _cpa.cpa()18 if np.fabs(dcpa) <= 1 and 0 <= tcpa <= 0.1:19 result = {20 "Tar_Ship": _vessel[num].MMSI,21 "Ref_Ship": _vessel[_next_num].MMSI,22 "mid_lon": _cpa.mid_point()[1],23 "mid_lat": _cpa.mid_point()[0],24 "distance": _cpa.distance(),25 "DCPA": dcpa,26 "TCPA": tcpa27 }28 results.append(result)29 except Exception as e:30 print("Reason: ", e)...
sequence_number_generator.py
Source: sequence_number_generator.py
1#sequence_number_generator.py2class SeqNumGenerator:3 '''4 ìì°¨ì ì¼ë¡ ì¦ê°íë ì«ì를 ìì±íë ìì±ê¸°5 max_numì ëì´ìë©´ start_numì¼ë¡ íê·íë¤.6 '''7 def __init__(self, max_num: int, start_num: int = 0):8 self._start_num = start_num9 self._max_num = max_num10 self._next_num = start_num11 def generate(self) -> int:12 num = self._next_num13 self._next_num += 114 if self._next_num > self._max_num:15 self._next_num = self._start_num16 17 return num18 19 ...
happy_number.py
Source: happy_number.py
...3 def isHappy(self, n):4 x = n5 y = n6 while 1:7 x = Solution._next_num(x)8 if x == 1:9 return True10 y = Solution._next_num(Solution._next_num(y))11 if y == 1:12 return True13 if x == y:14 return False15 @staticmethod16 def _next_num(n):17 sum_of_sqs = 018 while n != 0:19 sum_of_sqs += (n % 10) * (n % 10)20 n //= 10...
Check out the latest blogs from LambdaTest on this topic:
Coaching is a term that is now being mentioned a lot more in the leadership space. Having grown successful teams I thought that I was well acquainted with this subject.
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.
Agile software development stems from a philosophy that being agile means creating and responding to change swiftly. Agile means having the ability to adapt and respond to change without dissolving into chaos. Being Agile involves teamwork built on diverse capabilities, skills, and talents. Team members include both the business and software development sides working together to produce working software that meets or exceeds customer expectations continuously.
Ever since the Internet was invented, web developers have searched for the most efficient ways to display content on web browsers.
The holidays are just around the corner, and with Christmas and New Year celebrations coming up, everyone is busy preparing for the festivities! And during this busy time of year, LambdaTest also prepped something special for our beloved developers and testers – #LambdaTestYourBusiness
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!!