Best Python code snippet using toolium_python
drivers.py
Source:drivers.py
2"""3 Factory class used to manage the hardware drivers used by CONTROLLER building blocks.4 Copyright (C) 2021 Bradford G. Van Treuren5 Factory class used to manage the hardware drivers used by CONTROLLER building blocks.6 Call remove_drivers() when changing to a new model description to clear out old model7 references to old UUT hardware interfaces.8 This program is free software: you can redistribute it and/or modify9 it under the terms of the GNU General Public License as published by10 the Free Software Foundation, either version 3 of the License, or11 (at your option) any later version.12 This program is distributed in the hope that it will be useful,13 but WITHOUT ANY WARRANTY; without even the implied warranty of14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15 GNU General Public License for more details.16 You should have received a copy of the GNU General Public License17 along with this program. If not, see <https://www.gnu.org/licenses/>.18"""19__authors__ = ["Bradford G. Van Treuren"]20__contact__ = "bradvt59@gmail.com"21__copyright__ = "Copyright 2021, VT Enterprises Consulting Services"22__credits__ = ["Bradford G. Van Treuren"]23__date__ = "2021/03/05"24__deprecated__ = False25__email__ = "bradvt59@gmail.com"26__license__ = "GPLv3"27__maintainer__ = "Bradford G. Van Treuren"28__status__ = "Alpha/Experimental"29__version__ = "0.0.1"30from time import sleep31from drivers.ate.atesim import ATE, JTAGController, JTAGController2, GPIOController, I2CController, \32 SPIController33class Drivers(object):34 ate_inst = None35 jtag_inst = None36 jtag2_inst = None37 gpio_inst = None38 i2c_inst = None39 spi_inst = None40 board_sim = None41 @staticmethod42 def get_board_sim():43 return Drivers.board_sim44 @staticmethod45 def set_board_sim(board_sim):46 Drivers.board_sim = board_sim47 @staticmethod48 def get_ate():49 if Drivers.ate_inst is None:50 if Drivers.board_sim is None:51 raise AssertionError("Drivers board_sim must be defined before getting drivers.")52 ip = "127.0.0.1"53 port = 502354 Drivers.ate_inst = ATE(ip=ip, port=port)55 sleep(0.05)56 Drivers.ate_inst.connect(Drivers.board_sim)57 sleep(0.05)58 while not Drivers.ate_inst.sim_status():59 sleep(0.05)60 return Drivers.ate_inst61 @staticmethod62 def get_jtag():63 if Drivers.jtag_inst is None:64 ate = Drivers.get_ate()65 Drivers.jtag_inst = JTAGController(ate)66 sleep(1)67 return Drivers.jtag_inst68 @staticmethod69 def get_jtag2():70 if Drivers.jtag2_inst is None:71 ate = Drivers.get_ate()72 Drivers.jtag2_inst = JTAGController2(ate)73 sleep(1)74 return Drivers.jtag2_inst75 @staticmethod76 def get_gpio():77 if Drivers.gpio_inst is None:78 ate = Drivers.get_ate()79 Drivers.gpio_inst = GPIOController(ate)80 sleep(1)81 return Drivers.gpio_inst82 @staticmethod83 def get_i2c():84 if Drivers.i2c_inst is None:85 ate = Drivers.get_ate()86 Drivers.i2c_inst = I2CController(ate)87 sleep(1)88 return Drivers.i2c_inst89 @staticmethod90 def get_spi():91 if Drivers.spi_inst is None:92 ate = Drivers.get_ate()93 Drivers.spi_inst = SPIController(ate)94 sleep(1)95 return Drivers.spi_inst96 @staticmethod97 def remove_drivers():98 Drivers.ate_inst = None99 Drivers.jtag1_inst = None100 Drivers.jtag2_inst = None101 Drivers.gpio_inst = None102 Drivers.i2c_inst = None103 Drivers.spi_inst = None...
api.py
Source:api.py
...27 'make_rpath': make_rpath,28 'draw_props': draw_props,29 'draw_mat_props': draw_mat_props30 }31def remove_drivers():...
RemoveDrivers.py
Source:RemoveDrivers.py
...11 return context.active_object is not None12 def execute(self, context):13 run()14 return {'FINISHED'}15def remove_drivers():16 for obj in bpy.context.selected_objects:17 if obj.animation_data is not None:18 for driver in obj.animation_data.drivers:19 print('%s.%s is driven to %s' % (obj.name, driver.data_path, driver.driver.expression))20 drivers_data = obj.animation_data.drivers21 for dr in drivers_data:22 obj.driver_remove(dr.data_path, -1)23 obj.hide_viewport = False24def run():25 """26 This run statement is what's executed when your button is pressed in blender.27 :return:28 """...
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!!