Best Python code snippet using behave
plugin_setup.py
Source:plugin_setup.py
...22)23plugin.register_semantic_types(Network)24plugin.register_semantic_types(PairwiseFeatureData)25plugin.register_semantic_types(ModuleMembership)26plugin.register_formats(GraphModelingLanguageFormat)27plugin.register_formats(GraphModelingLanguageDirectoryFormat)28plugin.register_formats(PairwiseFeatureDataFormat)29plugin.register_formats(PairwiseFeatureDataDirectoryFormat)30plugin.register_formats(ModuleMembershipTSVFormat)31plugin.register_formats(ModuleMembershipTSVDirectoryFormat)32plugin.register_semantic_type_to_format(Network, artifact_format=GraphModelingLanguageDirectoryFormat)33plugin.register_semantic_type_to_format(PairwiseFeatureData, artifact_format=PairwiseFeatureDataDirectoryFormat)34plugin.register_semantic_type_to_format(ModuleMembership, artifact_format=ModuleMembershipTSVDirectoryFormat)35plugin.methods.register_function(36 function=sparcc_filter,37 inputs={'table': FeatureTable[Frequency]},38 parameters={},39 outputs=[('table_filtered', FeatureTable[Frequency])],40 input_descriptions={'table': (41 'Table to be filtered for use in correlational analyses.')},42 output_descriptions={'table_filtered': 'The filtered table.'},43 name='Filter a table based on recommended parameters from Friedman et al. 2012',44 description=(45 'Filter a feature table based on recommendations from Friedman et al. 2012.'...
plugin.py
Source:plugin.py
...34 self.init()35 # This function sets up the figure plugin36 def init(self):37 # Register all figure formats38 self.register_formats()39 # Create a layout40 layout = GL.QVBoxLayout(self)41 layout.setContentsMargins(0, 0, 0, 0)42 # Create a tab widget43 tab_widget = GW.QTabWidget(browse_tabs=True)44 tab_widget.setTabBar(GW.EditableTabBar())45 tab_widget.setMovable(True)46 tab_widget.setTabsClosable(True)47 # Connect tab widget signals48 tab_widget.tabTextChanged.connect(self.set_tab_name)49 tab_widget.tabCloseRequested.connect(self.close_tab)50 # Add tab widget to layout51 self.tab_widget = tab_widget52 layout.addWidget(self.tab_widget)53 # Add all actions to the proper menus and toolbars54 self.add_actions()55 # Add a tab to the plugin56 self.add_tab()57 # Override closeEvent to do automatic clean-up58 def closeEvent(self, *args, **kwargs):59 # Block all signals emitted by the tab widget while removing tabs60 self.tab_widget.blockSignals(True)61 # Close all tabs62 for index in reversed(range(self.tab_widget.count())):63 self.close_tab(index)64 # Call super event65 super().closeEvent(*args, **kwargs)66 # This function adds all supported figure formats to GuiPy67 def register_formats(self):68 # Create empty dict of figure formats69 formats = {}70 # Loop over all entries in _default_filetypes and add them71 for ext, file_type in _default_filetypes.items():72 # Add to dict, creating a list if not added before73 formats.setdefault(file_type, []).append('.'+ext)74 # Loop over all formats and register each75 for file_type, exts in formats.items():76 # Register this format77 register_file_format(file_type, exts)78 # This function adds all associated actions to the menus and toolbars79 def add_actions(self):80 # Initialize empty action lists for this plugin81 self.MENU_ACTIONS = {...
_builtins.py
Source:_builtins.py
...31# FUNCTIONS:32# -----------------------------------------------------------------------------33def setup_formatters():34 """Register all built-in formatters (lazy-loaded)."""...
__init__.py
Source:__init__.py
2from expose_text.exceptions import UnsupportedFormat3from expose_text.formats.base import Format4class Registry:5 """This class registers the supported file formats.6 If you implement a new format, make sure to add it to `register_formats()`.7 """8 _formats = {}9 def find_format(self, key) -> Format:10 if key not in self._formats:11 raise UnsupportedFormat(f"Format {key} is not supported!")12 return self._formats[key]13 def register_formats(self):14 self._register(".txt", "expose_text.formats._txt.TxtFormat")15 self._register(".html", "expose_text.formats._html.HtmlFormat")16 # self._register(".pdf", "expose_text.formats._pdf.PdfFormat")17 self._register(".pdf", "expose_text.formats.pdf.auto_pdf.AutoPdfFormat")18 self._register(".docx", "expose_text.formats._docx.DocxFormat")19 def _register(self, key, class_path):20 module_path, class_name = class_path.rsplit(".", 1)21 format_cls = getattr(import_module(module_path), class_name)22 self._formats[key] = format_cls...
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!!