Best Python code snippet using autotest_python
sysinfo.py
Source:sysinfo.py
...411 Name itself is an egrep pattern, so it can use | etc for variations.412 """413 return utils.system("pgrep -f '^([^ /]*/)*(%s)([ ]|$)'" % name_pattern,414 ignore_status=True) == 0415def get_hwclock_seconds(utc=True):416 """417 Return the hardware clock in seconds as a floating point value.418 Use Coordinated Universal Time if utc is True, local time otherwise.419 Raise a ValueError if unable to read the hardware clock.420 """421 cmd = '/sbin/hwclock --debug'422 if utc:423 cmd += ' --utc'424 hwclock_output = utils.system_output(cmd, ignore_status=True)425 match = re.search(r'= ([0-9]+) seconds since .+ (-?[0-9.]+) seconds$',426 hwclock_output, re.DOTALL)427 if match:428 seconds = int(match.group(1)) + float(match.group(2))429 logging.debug('hwclock seconds = %f' % seconds)...
base_utils.py
Source:base_utils.py
...578 Name itself is an egrep pattern, so it can use | etc for variations.579 """580 return utils.system("pgrep -f '^([^ /]*/)*(%s)([ ]|$)'" % name_pattern,581 ignore_status=True) == 0582def get_hwclock_seconds(utc=True):583 """584 Return the hardware clock in seconds as a floating point value.585 Use Coordinated Universal Time if utc is True, local time otherwise.586 Raise a ValueError if unable to read the hardware clock.587 """588 cmd = '/sbin/hwclock --debug'589 if utc:590 cmd += ' --utc'591 hwclock_output = utils.system_output(cmd, ignore_status=True)592 match = re.search(r'= ([0-9]+) seconds since .+ (-?[0-9.]+) seconds$',593 hwclock_output, re.DOTALL)594 if match:595 seconds = int(match.group(1)) + float(match.group(2))596 logging.debug('hwclock seconds = %f' % seconds)...
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!!