How to use _next_num method in pytest-benchmark

Best Python code snippet using pytest-benchmark

FinalData.py

Source:FinalData.py Github

copy

Full Screen

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

Full Screen

Full Screen

sequence_number_generator.py

Source:sequence_number_generator.py Github

copy

Full Screen

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

Full Screen

Full Screen

happy_number.py

Source:happy_number.py Github

copy

Full Screen

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

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 pytest-benchmark 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