How to use plugins method in storybook-root

Best JavaScript code snippet using storybook-root

PluginComponent.py

Source: PluginComponent.py Github

copy

Full Screen

1import os2from bisect import insort3from Tools.Directories import fileExists, resolveFilename, SCOPE_PLUGINS4from Tools.Import import my_import5from Tools.Profile import profile6from Plugins.Plugin import PluginDescriptor7import keymapparser8class PluginComponent:9 firstRun = True10 restartRequired = False11 def __init__(self):12 self.plugins = {}13 self.pluginList = [ ]14 self.installedPluginList = [ ]15 self.setPluginPrefix("Plugins.")16 self.resetWarnings()17 def setPluginPrefix(self, prefix):18 self.prefix = prefix19 def addPlugin(self, plugin):20 if self.firstRun or not plugin.needsRestart:21 self.pluginList.append(plugin)22 for x in plugin.where:23 insort(self.plugins.setdefault(x, []), plugin)24 if x == PluginDescriptor.WHERE_AUTOSTART:25 plugin(reason=0)26 else:27 self.restartRequired = True28 def removePlugin(self, plugin):29 self.pluginList.remove(plugin)30 for x in plugin.where:31 self.plugins[x].remove(plugin)32 if x == PluginDescriptor.WHERE_AUTOSTART:33 plugin(reason=1)34 def readPluginList(self, directory):35 """enumerates plugins"""36 new_plugins = []37 for c in os.listdir(directory):38 directory_category = os.path.join(directory, c)39 if not os.path.isdir(directory_category):40 continue41 for pluginname in os.listdir(directory_category):42 path = os.path.join(directory_category, pluginname)43 if os.path.isdir(path):44 profile('plugin '+pluginname)45 try:46 plugin = my_import('.'.join(["Plugins", c, pluginname, "plugin"]))47 plugins = plugin.Plugins(path=path)48 except Exception, exc:49 print "Plugin ", c + "/​" + pluginname, "failed to load:", exc50 # supress errors due to missing plugin.py* files (badly removed plugin)51 for fn in ('plugin.py', 'plugin.pyo'):52 if os.path.exists(os.path.join(path, fn)):53 self.warnings.append( (c + "/​" + pluginname, str(exc)) )54 from traceback import print_exc55 print_exc()56 break57 else:58 print "Plugin probably removed, but not cleanly in", path59 try:60 os.rmdir(path)61 except:62 pass63 continue64 # allow single entry not to be a list65 if not isinstance(plugins, list):66 plugins = [ plugins ]67 for p in plugins:68 p.path = path69 p.updateIcon(path)70 new_plugins.append(p)71 keymap = os.path.join(path, "keymap.xml")72 if fileExists(keymap):73 try:74 keymapparser.readKeymap(keymap)75 except Exception, exc:76 print "keymap for plugin %s/​%s failed to load: " % (c, pluginname), exc77 self.warnings.append( (c + "/​" + pluginname, str(exc)) )78 # build a diff between the old list of plugins and the new one79 # internally, the "fnc" argument will be compared with __eq__80 plugins_added = [p for p in new_plugins if p not in self.pluginList]81 plugins_removed = [p for p in self.pluginList if not p.internal and p not in new_plugins]82 #ignore already installed but reloaded plugins83 for p in plugins_removed:84 for pa in plugins_added:85 if pa.path == p.path and pa.where == p.where:86 pa.needsRestart = False87 for p in plugins_removed:88 self.removePlugin(p)89 for p in plugins_added:90 if self.firstRun or p.needsRestart is False:91 self.addPlugin(p)92 else:93 for installed_plugin in self.installedPluginList:94 if installed_plugin.path == p.path:95 if installed_plugin.where == p.where:96 p.needsRestart = False97 self.addPlugin(p)98 if self.firstRun:99 self.firstRun = False100 self.installedPluginList = self.pluginList101 def getPlugins(self, where):102 """Get list of plugins in a specific category"""103 if not isinstance(where, list):104 # if not a list, we're done quickly, because the105 # lists are already sorted106 return self.plugins.get(where, [])107 res = []108 # Efficiently merge two sorted lists together, though this109 # appears to never be used in code anywhere...110 for x in where:111 for p in self.plugins.get(x, []):112 insort(res, p)113 return res114 def getPluginsForMenu(self, menuid):115 res = [ ]116 for p in self.getPlugins(PluginDescriptor.WHERE_MENU):117 res += p(menuid)118 return res119 def clearPluginList(self):120 self.pluginList = []121 self.plugins = {}122 def reloadPlugins(self, dummy=False):123 self.clearPluginList()124 self.readPluginList(resolveFilename(SCOPE_PLUGINS))125 def shutdown(self):126 for p in self.pluginList[:]:127 self.removePlugin(p)128 def resetWarnings(self):129 self.warnings = [ ]130 def getNextWakeupTime(self):131 wakeup = -1132 for p in self.pluginList:133 current = p.getWakeupTime()134 if current > -1 and (wakeup > current or wakeup == -1):135 wakeup = current136 return int(wakeup)...

Full Screen

Full Screen

plugin_pool.py

Source: plugin_pool.py Github

copy

Full Screen

...10class PluginPool(object):11 def __init__(self):12 self.plugins = {}13 self.discovered = False14 def discover_plugins(self):15 if self.discovered:16 return17 self.discovered = True18 load('cms_plugins')19 def register_plugin(self, plugin):20 """21 Registers the given plugin(s).22 If a plugin is already registered, this will raise PluginAlreadyRegistered.23 """24 if hasattr(plugin,'__iter__'):25 warnings.warn("Registering more than one plugin at once will be deprecated in 2.3", DeprecationWarning)26 for single_plugin in plugin:27 self.register_plugin(single_plugin)28 return29 if not issubclass(plugin, CMSPluginBase):30 raise ImproperlyConfigured(31 "CMS Plugins must be subclasses of CMSPluginBase, %r is not."32 % plugin33 )34 plugin_name = plugin.__name__35 if plugin_name in self.plugins:36 raise PluginAlreadyRegistered(37 "Cannot register %r, a plugin with this name (%r) is already "38 "registered." % (plugin, plugin_name)39 )40 plugin.value = plugin_name41 self.plugins[plugin_name] = plugin42 if 'reversion' in settings.INSTALLED_APPS:43 try:44 from reversion.registration import RegistrationError45 except ImportError:46 from reversion.revisions import RegistrationError47 try:48 reversion_register(plugin.model)49 except RegistrationError:50 pass51 def unregister_plugin(self, plugin):52 """53 Unregisters the given plugin(s).54 If a plugin isn't already registered, this will raise PluginNotRegistered.55 """56 if hasattr(plugin,'__iter__'):57 warnings.warn("Unregistering more than one plugin at once will be deprecated in 2.3", DeprecationWarning)58 for single_plugin in plugin:59 self.unregister_plugin(single_plugin)60 return 61 plugin_name = plugin.__name__62 if plugin_name not in self.plugins:63 raise PluginNotRegistered(64 'The plugin %r is not registered' % plugin65 )66 del self.plugins[plugin_name]67 def get_all_plugins(self, placeholder=None, page=None, setting_key="plugins", include_page_only=True):68 self.discover_plugins()69 plugins = self.plugins.values()[:]70 plugins.sort(key=lambda obj: unicode(obj.name))71 final_plugins = []72 if page:73 template = page.get_template()74 else:75 template = None76 allowed_plugins = get_placeholder_conf(77 setting_key,78 placeholder,79 template,80 )81 for plugin in plugins:82 include_plugin = False83 if placeholder:84 if allowed_plugins:85 if plugin.__name__ in allowed_plugins:86 include_plugin = True87 elif setting_key == "plugins":88 include_plugin = True89 if plugin.page_only and not include_page_only:90 include_plugin = False91 if include_plugin:92 final_plugins.append(plugin)93 94 if final_plugins:95 plugins = final_plugins96 # plugins sorted by modules97 plugins = sorted(plugins, key=lambda obj: unicode(obj.module))98 return plugins99 def get_text_enabled_plugins(self, placeholder, page):100 plugins = self.get_all_plugins(placeholder, page)101 plugins +=self.get_all_plugins(placeholder, page, 'text_only_plugins')102 final = []103 for plugin in plugins:104 if plugin.text_enabled:105 if plugin not in final:106 final.append(plugin)107 return final108 def get_plugin(self, name):109 """110 Retrieve a plugin from the cache.111 """112 self.discover_plugins()113 return self.plugins[name]...

Full Screen

Full Screen

module.js

Source: module.js Github

copy

Full Screen

1angular.module('ngCordova.plugins', [2 'ngCordova.plugins.actionSheet',3 'ngCordova.plugins.adMob',4 'ngCordova.plugins.appAvailability',5 'ngCordova.plugins.appRate',6 'ngCordova.plugins.appVersion',7 'ngCordova.plugins.backgroundGeolocation',8 'ngCordova.plugins.badge',9 'ngCordova.plugins.barcodeScanner',10 'ngCordova.plugins.batteryStatus',11 'ngCordova.plugins.beacon',12 'ngCordova.plugins.ble',13 'ngCordova.plugins.bluetoothSerial',14 'ngCordova.plugins.brightness',15 'ngCordova.plugins.calendar',16 'ngCordova.plugins.camera',17 'ngCordova.plugins.capture',18 'ngCordova.plugins.clipboard',19 'ngCordova.plugins.contacts',20 'ngCordova.plugins.datePicker',21 'ngCordova.plugins.device',22 'ngCordova.plugins.deviceMotion',23 'ngCordova.plugins.deviceOrientation',24 'ngCordova.plugins.dialogs',25 'ngCordova.plugins.emailComposer',26 'ngCordova.plugins.facebook',27 'ngCordova.plugins.facebookAds',28 'ngCordova.plugins.file',29 'ngCordova.plugins.fileTransfer',30 'ngCordova.plugins.fileOpener2',31 'ngCordova.plugins.flashlight',32 'ngCordova.plugins.flurryAds',33 'ngCordova.plugins.ga',34 'ngCordova.plugins.geolocation',35 'ngCordova.plugins.globalization',36 'ngCordova.plugins.googleAds',37 'ngCordova.plugins.googleAnalytics',38 'ngCordova.plugins.googleMap',39 'ngCordova.plugins.googlePlayGame',40 'ngCordova.plugins.googlePlus',41 'ngCordova.plugins.healthKit',42 'ngCordova.plugins.httpd',43 'ngCordova.plugins.iAd',44 'ngCordova.plugins.imagePicker',45 'ngCordova.plugins.inAppBrowser',46 'ngCordova.plugins.instagram',47 'ngCordova.plugins.keyboard',48 'ngCordova.plugins.keychain',49 'ngCordova.plugins.launchNavigator',50 'ngCordova.plugins.localNotification',51 'ngCordova.plugins.media',52 'ngCordova.plugins.mMediaAds',53 'ngCordova.plugins.mobfoxAds',54 'ngCordova.plugins.mopubAds',55 'ngCordova.plugins.nativeAudio',56 'ngCordova.plugins.network',57 'ngCordovaOauth',58 'ngCordova.plugins.pinDialog',59 'ngCordova.plugins.preferences',60 'ngCordova.plugins.printer',61 'ngCordova.plugins.progressIndicator',62 'ngCordova.plugins.push',63 'ngCordova.plugins.push_v5',64 'ngCordova.plugins.sms',65 'ngCordova.plugins.socialSharing',66 'ngCordova.plugins.spinnerDialog',67 'ngCordova.plugins.splashscreen',68 'ngCordova.plugins.sqlite',69 'ngCordova.plugins.statusbar',70 'ngCordova.plugins.toast',71 'ngCordova.plugins.touchid',72 'ngCordova.plugins.vibration',73 'ngCordova.plugins.videoCapturePlus',74 'ngCordova.plugins.zip',75 'ngCordova.plugins.insomnia'...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { withKnobs } from '@storybook/​addon-knobs';2import { withA11y } from '@storybook/​addon-a11y';3import { withTests } from '@storybook/​addon-jest';4import results from '../​.jest-test-results.json';5export const decorators = [withKnobs, withA11y, withTests({ results })];6module.exports = {7 stories: ['../​src/​**/​*.stories.@(js|jsx|ts|tsx)'],8 core: {9 },10 webpackFinal: async (config) => {11 config.module.rules.push({12 test: /​\.(ts|tsx)$/​,13 {14 loader: require.resolve('babel-loader'),15 options: {16 presets: [['react-app', { flow: false, typescript: true }]],17 },18 },19 {20 loader: require.resolve('react-docgen-typescript-loader'),21 },22 });23 config.resolve.extensions.push('.ts', '.tsx');24 return config;25 },26};27import { addDecorator, addParameters } from '@storybook/​react';28import { withKnobs } from '@storybook/​addon-knobs';29import { withA11y } from '@storybook/​addon-a11y';30import { withTests } from '@storybook/​addon-jest';31import results from '../​.jest-test-results.json';32addDecorator(withKnobs);33addDecorator(withA11y);34addDecorator(withTests({ results }));35addParameters({36 options: {37 },38});39import { addDecorator, addParameters } from '@storybook/​react';40import { withKnobs } from '@storybook/​addon-knobs';41import { withA11y } from '@storybook/​addon-a11y';42import { withTests } from '@storybook/​addon-jest';43import results from '../​.jest-test-results.json';44addDecorator(withKnobs);45addDecorator(withA11y);46addDecorator(withTests({ results }));47addParameters({48 options: {

Full Screen

Using AI Code Generation

copy

Full Screen

1const { configure } = require('storybook-root');2const { plugins } = require('storybook-root');3const { addDecorator } = require('storybook-root');4configure(() => {5}, module);6plugins([7]);8addDecorator(

Full Screen

Using AI Code Generation

copy

Full Screen

1const plugins = require('storybook-root').plugins;2plugins({3});4import { configure } from '@storybook/​react';5import 'storybook-root/​register';6const plugins = require('storybook-root').webpack;7module.exports = (baseConfig, env, defaultConfig) => {8 defaultConfig.plugins = plugins({9 });10 return defaultConfig;11};

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

A Complete Guide To CSS Container Queries

In 2007, Steve Jobs launched the first iPhone, which revolutionized the world. But because of that, many businesses dealt with the problem of changing the layout of websites from desktop to mobile by delivering completely different mobile-compatible websites under the subdomain of ‘m’ (e.g., https://m.facebook.com). And we were all trying to figure out how to work in this new world of contending with mobile and desktop screen sizes.

How To Use driver.FindElement And driver.FindElements In Selenium C#

One of the essential parts when performing automated UI testing, whether using Selenium or another framework, is identifying the correct web elements the tests will interact with. However, if the web elements are not located correctly, you might get NoSuchElementException in Selenium. This would cause a false negative result because we won’t get to the actual functionality check. Instead, our test will fail simply because it failed to interact with the correct element.

How To Refresh Page Using Selenium C# [Complete Tutorial]

When working on web automation with Selenium, I encountered scenarios where I needed to refresh pages from time to time. When does this happen? One scenario is that I needed to refresh the page to check that the data I expected to see was still available even after refreshing. Another possibility is to clear form data without going through each input individually.

Testing in Production: A Detailed Guide

When most firms employed a waterfall development model, it was widely joked about in the industry that Google kept its products in beta forever. Google has been a pioneer in making the case for in-production testing. Traditionally, before a build could go live, a tester was responsible for testing all scenarios, both defined and extempore, in a testing environment. However, this concept is evolving on multiple fronts today. For example, the tester is no longer testing alone. Developers, designers, build engineers, other stakeholders, and end users, both inside and outside the product team, are testing the product and providing feedback.

Different Ways To Style CSS Box Shadow Effects

Have you ever visited a website that only has plain text and images? Most probably, no. It’s because such websites do not exist now. But there was a time when websites only had plain text and images with almost no styling. For the longest time, websites did not focus on user experience. For instance, this is how eBay’s homepage looked in 1999.

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run storybook-root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful