Best Python code snippet using pyresttest_python
storage.py
Source:storage.py  
...66        self.partitioning_reset = Signal()67        # Initialize modules.68        self._modules = []69        self._storage_checker_module = StorageCheckerModule()70        self._add_module(self._storage_checker_module)71        self._device_tree_module = DeviceTreeModule()72        self._add_module(self._device_tree_module)73        self._disk_init_module = DiskInitializationModule()74        self._add_module(self._disk_init_module)75        self._disk_selection_module = DiskSelectionModule()76        self._add_module(self._disk_selection_module)77        self._snapshot_module = SnapshotModule()78        self._add_module(self._snapshot_module)79        self._bootloader_module = BootloaderModule()80        self._add_module(self._bootloader_module)81        self._fcoe_module = FCOEModule()82        self._add_module(self._fcoe_module)83        self._iscsi_module = ISCSIModule()84        self._add_module(self._iscsi_module)85        self._nvdimm_module = NVDIMMModule()86        self._add_module(self._nvdimm_module)87        self._dasd_module = DASDModule()88        self._add_module(self._dasd_module)89        self._zfcp_module = ZFCPModule()90        self._add_module(self._zfcp_module)91        # Initialize the partitioning modules.92        # TODO: Remove the static partitioning modules.93        self._add_module(self.create_partitioning(PartitioningMethod.AUTOMATIC))94        self._add_module(self.create_partitioning(PartitioningMethod.MANUAL))95        self._add_module(self.create_partitioning(PartitioningMethod.CUSTOM))96        self._add_module(self.create_partitioning(PartitioningMethod.INTERACTIVE))97        self._add_module(self.create_partitioning(PartitioningMethod.BLIVET))98        # Forget the static partitioning modules.99        # TODO: Remove with the static partitioning modules.100        self._created_partitioning = []101        # Connect modules to signals.102        self.storage_changed.connect(103            self._device_tree_module.on_storage_changed104        )105        self.storage_changed.connect(106            self._disk_init_module.on_storage_changed107        )108        self.storage_changed.connect(109            self._disk_selection_module.on_storage_changed110        )111        self.storage_changed.connect(112            self._snapshot_module.on_storage_changed113        )114        self.storage_changed.connect(115            self._bootloader_module.on_storage_changed116        )117        self.storage_changed.connect(118            self._dasd_module.on_storage_changed119        )120        self._disk_init_module.format_unrecognized_enabled_changed.connect(121            self._dasd_module.on_format_unrecognized_enabled_changed122        )123        self._disk_init_module.format_ldl_enabled_changed.connect(124            self._dasd_module.on_format_ldl_enabled_changed125        )126        self._disk_selection_module.protected_devices_changed.connect(127            self.on_protected_devices_changed128        )129    def _add_module(self, storage_module):130        """Add a base kickstart module."""131        self._modules.append(storage_module)132    def publish(self):133        """Publish the module."""134        TaskContainer.set_namespace(STORAGE.namespace)135        for kickstart_module in self._modules:136            kickstart_module.publish()137        DBus.publish_object(STORAGE.object_path, StorageInterface(self))138        DBus.register_service(STORAGE.service_name)139    @property140    def kickstart_specification(self):141        """Return the kickstart specification."""142        return StorageKickstartSpecification143    def process_kickstart(self, data):...concat_visual_bpr.py
Source:concat_visual_bpr.py  
...36        return default_input_map37        38    def _build_item_extractions(self, train=True):39        if train:40            self._add_module('p_item_lf',41                            LatentFactor(init='normal', l2_reg=self._l2_reg, ids=self._get_input('p_item_id'), 42                                        shape=[self._max_item, self._dim_embed-self._dim_ve], scope='item', reuse=False))43            self._add_module('p_item_vf',44                            MultiLayerFC(in_tensor=self._get_input('p_item_vfeature'), 45                                        dims=[self._dim_ve], scope='item_MLP', reuse=False))46            self._add_module('p_item_bias',47                            LatentFactor(l2_reg=self._l2_reg, init='zero', ids=self._get_input('p_item_id'),48                                        shape=[self._max_item, 1], scope='item_bias', reuse=False))49            self._add_module('n_item_lf',50                            LatentFactor(init='normal', l2_reg=self._l2_reg, ids=self._get_input('n_item_id'), 51                                        shape=[self._max_item, self._dim_embed-self._dim_ve], scope='item', reuse=True))52            self._add_module('n_item_vf',53                            MultiLayerFC(in_tensor=self._get_input('n_item_vfeature'), 54                                        dims=[self._dim_ve], scope='item_MLP', reuse=True))55            self._add_module('n_item_bias',56                            LatentFactor(l2_reg=self._l2_reg, init='zero', ids=self._get_input('n_item_id'),57                                        shape=[self._max_item, 1], scope='item_bias', reuse=True))58        else:59            self._add_module('item_lf',60                            LatentFactor(init='normal', l2_reg=self._l2_reg, ids=self._get_input('item_id', train=train),61                                        shape=[self._max_item, self._dim_embed-self._dim_ve], scope='item', reuse=True),62                            train=False)63            self._add_module('item_vf',64                            MultiLayerFC(in_tensor=self._get_input('item_vfeature', train=train), 65                                        dims=[self._dim_ve], scope='item_MLP', reuse=True),66                            train=False)67            self._add_module('item_bias',68                            LatentFactor(l2_reg=self._l2_reg, init='zero', ids=self._get_input('item_id', train=train),69                                        shape=[self._max_item, 1], scope='item_bias', reuse=True), 70                             train=False)71    def _build_default_fusions(self, train=True):72        73        if train:74            self._add_module('p_item_vec',75                            Concat(scope='item_concat', reuse=False,76                                    module_list=[self._get_module('p_item_lf'), self._get_module('p_item_vf')]))77            self._add_module('n_item_vec',78                            Concat(scope='item_concat', reuse=True,79                                    module_list=[self._get_module('n_item_lf'), self._get_module('n_item_vf')]))80        else:81            self._add_module('item_vec',82                            Concat(scope='item_concat', reuse=True, 83                                module_list=[self._get_module('item_lf', train=train), self._get_module('item_vf', train=train)]),84                            train=False)85    def _grad_post_processing(self, grad_var_list):86        87        normalized_grad_var_list = []88        for grad, var in grad_var_list:89            if 'item_MLP' in var.name:90                normalized_grad_var_list.append((grad * (1.0 / self._batch_size), var))91            else:92                normalized_grad_var_list.append((grad, var))...__init__.py
Source:__init__.py  
...27def factory(status):28    config = status.config29    for module in config:30        MODULES[module]().register(status)31def _add_module(m):32    MODULES[m.get_name()] = m33_add_module(Time)34_add_module(Battery)35_add_module(MPD)36_add_module(PulseAudio)37_add_module(Wifi)...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!!
