Best Python code snippet using autotest_python
job.py
Source:job.py  
...344        self.parser.add_option('--require-ssp',345                               help='Require server-side packaging',346                               default=False, action='store_true')347    @staticmethod348    def _get_kernel_data(kernel_list, cmdline):349        # the RPC supports cmdline per kernel version in a dictionary350        kernels = []351        for version in re.split(r'[, ]+', kernel_list):352            if not version:353                continue354            kernel_info = {'version': version}355            if cmdline:356                kernel_info['cmdline'] = cmdline357            kernels.append(kernel_info)358        return kernels359    def parse(self):360        deps_info = topic_common.item_parse_info(attribute_name='dependencies',361                                                 inline_option='dependencies')362        options, leftover = super(job_create, self).parse(363                parse_info=[deps_info])364        if (len(self.hosts) == 0 and not self.one_time_hosts365            and not options.labels and not options.atomic_group):366            self.invalid_syntax('Must specify at least one machine '367                                'or an atomic group '368                                '(-m, -M, -b, -G or --one-time-hosts).')369        if not options.control_file and not options.test:370            self.invalid_syntax('Must specify either --test or --control-file'371                                ' to create a job.')372        if options.control_file and options.test:373            self.invalid_syntax('Can only specify one of --control-file or '374                                '--test, not both.')375        if options.kernel:376            self.ctrl_file_data['kernel'] = self._get_kernel_data(377                    options.kernel, options.kernel_cmdline)378        if options.control_file:379            try:380                control_file_f = open(options.control_file)381                try:382                    control_file_data = control_file_f.read()383                finally:384                    control_file_f.close()385            except IOError:386                self.generic_error('Unable to read from specified '387                                   'control-file: %s' % options.control_file)388            if options.kernel:389                # execute() will pass this to the AFE server to wrap this390                # control file up to include the kernel installation steps....lidar.py
Source:lidar.py  
...16        self.pc_distance = pc_distance17        # Initialize Kernel Size (with Same Width and Height)18        self.kernel_size = kernel_size19        # Get LiDAR Kernel Data20        self.data = self._get_kernel_data(21            frame=sensor_data.get_data()22        )23        pass24    def get_kernel_average_depth(self):25        return np.average(self.data)26    def _get_kernel_data(self, frame):27        """28        :param frame: 2-D ndarray (only 2-D ndarray is supported for now...!)29        """30        assert len(frame.shape) == 231        # u-coordinate compensation32        u_min = np.round(self.c_u - 0.5*self.kernel_size).astype(int)33        u_min = 0 if u_min < 0 else u_min34        u_max = np.round(self.c_u + 0.5*self.kernel_size).astype(int)35        u_max = frame.shape[1] - 1 if u_max >= frame.shape[1] else u_max36        # v-coordinate compensation37        v_min = np.round(self.c_v - 0.5*self.kernel_size).astype(int)38        v_min = 0 if v_min < 0 else v_min39        v_max = np.round(self.c_v + 0.5*self.kernel_size).astype(int)40        v_max = frame.shape[0] - 1 if v_max >= frame.shape[0] else v_max...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!!
