Best Python code snippet using localstack_python
manager.py
Source: manager.py
...41 def setup(self, refMarker, camera=VideoStream.JETSONCAMERA, mode=MODE_TRACKING, debug=False, dictionnary=aruco.DICT_4X4_100):42 """43 Send Init command to the Worker Process on the specific logger proxy creation44 """45 if self._check_pid():46 self._send(Command(self.SETUP, InitMsg(refMarker, camera, mode, debug, dictionnary)))47 ret = self._recv(timeout=5)48 if ret:49 self.logger(INFO, 'Setup sucessful !')50 return True51 self.logger(INFO, 'Setup fail !')52 return False53 def startTracking(self):54 if self._check_pid():55 self._send(Command(self.START_TRACKING, None))56 ret = self._recv(timeout=1)57 if ret:58 self.logger(INFO, 'Starting success !')59 return True60 self.logger(INFO, 'Starting fail !')61 return False62 def stopTracking(self):63 if self._check_pid():64 self._send(Command(self.STOP_TRACKING, None))65 ret = self._recv(timeout=1)66 if ret:67 self.logger(INFO, 'Stopping success !')68 return True69 self.logger(INFO, 'Stopping fail !')70 return False71 def recalibrate(self):72 if self._check_pid():73 self._send(Command(self.RECALIBRATE, None))74 ret = self._recv(timeout=1)75 if ret:76 self.logger(INFO, 'Recalibration success !')77 return True78 self.logger(INFO, 'Recalibration fail !')79 return False80 def getPos(self):81 if self._check_pid():82 self._send(Command(self.GET_POS, None))83 return self._recv(timeout=1)84 else:85 return [(-1000, -1000),(-1000, -1000)]86 def getFrame(self):87 if self._check_pid():88 self._send(Command(self.GET_FRAME, None))89 return self._recv(timeout=1)90 else:91 return None92 def getWheatherVaneOrientation(self):93 if self._check_pid():94 self._send(Command(self.GET_WHEATHERVANE_ORIENTATION, None))95 return self._recv(timeout=1)96 else:97 return ORIENTATION_NONE98 def show(self):99 try:100 self.display.show(self.getFrame())101 except KeyboardInterrupt:102 self.display.stop()103 except:104 pass105 def start(self):106 """107 Start Worker Process108 """109 try:110 self.logger(INFO, 'Tracking Worker Starting Success !')111 self.worker.start()112 except:113 self.logger(INFO, 'Tracking Worker Starting Fail !')114 def stop(self):115 """116 Stop Worker Process117 """118 try:119 self.worker.terminate()120 except:121 pass122 def _check_pid(self):123 """124 Check For the existence of a unix pid.125 """126 try:127 if self.worker.pid is not None:128 os.kill(self.worker.pid, 0)129 else:130 return False131 except OSError:132 return False133 else:134 return True135 def _recv(self, timeout=None):136 """...
logger.py
Source: logger.py
...17import os18import logging19import logging.handlers20from typing import *21def _check_pid(func):22 def check(self,*args, **kwds):23 if self.logger is None:24 self.set_logger()25 pid = os.getpid()26 if self._pid != pid:27 self._pid = pid28 self.reset_logger()29 func(self,*args, **kwds)30 return check31class SocketLogger:32 _pid:int = None33 __logger:logging.Logger = None34 def __init__(35 self, name:str, level:int=logging.NOTSET, host="localhost",...
Check out the latest blogs from LambdaTest on this topic:
Traditional software testers must step up if they want to remain relevant in the Agile environment. Agile will most probably continue to be the leading form of the software development process in the coming years.
Hola Testers! Hope you all had a great Thanksgiving weekend! To make this time more memorable, we at LambdaTest have something to offer you as a token of appreciation.
One of the most important skills for leaders to have is the ability to prioritize. To understand how we can organize all of the tasks that must be completed in order to complete a project, we must first understand the business we are in, particularly the project goals. There might be several project drivers that stimulate project execution and motivate a company to allocate the appropriate funding.
Automating testing is a crucial step in the development pipeline of a software product. In an agile development environment, where there is continuous development, deployment, and maintenance of software products, automation testing ensures that the end software products delivered are error-free.
In 2007, Steve Jobs launched the first iPhone, which revolutionized the world. But because of that, many businesses dealt with the problem of changing the layout of websites from desktop to mobile by delivering completely different mobile-compatible websites under the subdomain of ‘m’ (e.g., https://m.facebook.com). And we were all trying to figure out how to work in this new world of contending with mobile and desktop screen sizes.
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!!