All example modules
540122
def get_examples(examples_dir="examples/"):  # pragma: no cover
    """"""
    all_files = os.listdir(examples_dir)
    python_files = [f for f in all_files if is_python_file(f)]
    basenames = [remove_suffix(f) for f in python_files]
    modules = [import_module(module) for module in pathify(basenames)]
    return [
        module for module in modules
        if getattr(module, 'app', None) is not None
    ]
64081
function buildExampleScripts(dev) {

  var dest = EXAMPLE_DIST_PATH;

  var opts = dev ? watchify.args : {};
  opts.debug = dev ? true : false;
  opts.hasExports = true;

  return function() {

    var common = browserify(opts),
      bundle = browserify(opts).require('./' + SRC_PATH + '/' + PACKAGE_FILE, { expose: PACKAGE_NAME }),
      example = browserify(opts).exclude(PACKAGE_NAME).add('./' + EXAMPLE_SRC_PATH + '/' + EXAMPLE_APP);

    DEPENDENCIES.forEach(function(pkg) {
      common.require(pkg);
      bundle.exclude(pkg);
      example.exclude(pkg);
    });

    if (dev) {
      watchBundle(common, 'common.js', dest);
      watchBundle(bundle, 'bundle.js', dest);
      watchBundle(example, 'app.js', dest);
    }

    return merge(
      doBundle(common, 'common.js', dest),
      doBundle(bundle, 'bundle.js', dest),
      doBundle(example, 'app.js', dest)
    );

  }

}
278857
def plugins(all, plugins_dir):
    ""
    app = Datasette([], plugins_dir=plugins_dir)
    click.echo(json.dumps(app.plugins(all), indent=4))
728940
function getModules(app) {
	var results = [];

	if (extensions && extensions.hasOwnProperty('modules')
		&& extensions.modules.hasOwnProperty(app)
	) {
		var sourceArray = extensions.modules[app];

		for (index = 0; index < sourceArray.length; ++index) {
		    results.push(app + '.' + sourceArray[index]);
		}
	}

	return results;
}
1176265
def cli(ctx, name,all):
    """"""
    ctx.gbc.say('all_example_functions',stuff=all_examples_functions, verbosity=1000)

    for example in all_examples_functions:
        if all or (name and example['name'] == name):
            if all:
                ctx.gbc.say('example',stuff=example, verbosity=100)
                name = example['name']
            #click.echo_via_pager(example['fun']())
            click.echo("#"*80)
            click.echo("### start of bubble example: "+name)
            click.echo("#"*80)
            click.echo(example['fun']())
            click.echo("#"*80)
            click.echo("### end of bubble example: "+name)
            click.echo("#"*80)
            click.echo()

        else:
            click.echo("available example: " + example['name'])
1361302
function compile() {
    swig.log.info('', 'Compiling module list...');

    const modulesPath = path.join(swig.temp, '/**/node_modules/@gilt-tech');
    const modPaths = glob.sync(modulesPath);
    let dirs;

    swig.log.verbose(`[compile] searching: ${modulesPath}`);
    swig.log.verbose(`[compile] found module directories: ${modPaths.length}`);

    modPaths.forEach((modPath) => {
      swig.log.verbose(`[compile] compiling: ${modPath}`);

      dirs = fs.readdirSync(modPath);

      _.each(dirs, (dir) => {
        const dirPath = path.join(modPath, dir);
        if (fs.existsSync(dirPath) && fs.lstatSync(dirPath).isDirectory()) {
          azModules.push({ name: dir, path: dirPath });
        }
      });
    });

    // group by basename, and take the 'topmost' module in the hierarchy
    azModules = _.groupBy(azModules, module => path.basename(module.path));

    // pull out the 'winning' module path, for each module
    azModules = _.map(azModules, (modulesList) => {
      // the modules arg will be [{ name:, path: }, ...]

      if (modulesList.length === 1) {
        return modulesList[0];
      }

      // glob will almost always return the right order,
      // but let's assert this to be safe. we can spare the cycles.
      return _.sortBy(modulesList, module => module.path.length)[0];
    });

    // and now we pretty sort a-z for various output
    // we dont reset azModules to the sorted array because we need it dirty for deps.less
    _.sortBy(azModules, mod => mod.name).forEach((mod) => {
      modules[mod.name] = mod.path;
    });

    swig.log.verbose('[compile] sorted modules: ');
    swig.log.verbose(modules);
  }
953800
static function modules() {
		$modules = [];
		if ( is_array( getset( '_GET', 'export_formats' ) ) && check_admin_referer( 'pb-export' ) ) {

			// --------------------------------------------------------------------------------------------------------
			// Define modules

			$x = $_GET['export_formats'];

			if ( isset( $x['pdf'] ) ) {
				$modules[] = '\Pressbooks\Modules\Export\Prince\Pdf';
			}
			if ( isset( $x['print_pdf'] ) ) {
				$modules[] = '\Pressbooks\Modules\Export\Prince\PrintPdf';
			}
			if ( isset( $x['epub'] ) ) {
				$modules[] = '\Pressbooks\Modules\Export\Epub\Epub201'; // Must be set before MOBI
			}
			if ( isset( $x['epub3'] ) ) {
				$modules[] = '\Pressbooks\Modules\Export\Epub\Epub3';
			}
			if ( isset( $x['mobi'] ) ) {
				if ( ! isset( $x['epub'] ) ) { // Make sure Epub source file is generated
					$modules[] = '\Pressbooks\Modules\Export\Epub\Epub201'; // Must be set before MOBI
				}
				$modules[] = '\Pressbooks\Modules\Export\Mobi\Kindlegen'; // Must be set after EPUB
			}
			if ( isset( $x['icml'] ) ) {
				$modules[] = '\Pressbooks\Modules\Export\InDesign\Icml';
			}
			if ( isset( $x['xhtml'] ) ) {
				$modules[] = '\Pressbooks\Modules\Export\Xhtml\Xhtml11';
			}
			if ( isset( $x['wxr'] ) ) {
				$modules[] = '\Pressbooks\Modules\Export\WordPress\Wxr';
			}
			if ( isset( $x['vanillawxr'] ) ) {
				$modules[] = '\Pressbooks\Modules\Export\WordPress\VanillaWxr';
			}
			if ( isset( $x['odt'] ) ) {
				$modules[] = '\Pressbooks\Modules\Export\Odt\Odt';
			}
			if ( isset( $x['htmlbook'] ) ) {
				$modules[] = '\Pressbooks\Modules\Export\HTMLBook\HTMLBook';
			}

			// --------------------------------------------------------------------------------------------------------
			// Other People's Plugins

			/**
			 * Catch enabled custom formats and add their classes to the $modules array.
			 *
			 * For example, here's how one might catch a hypothetical Word exporter:
			 *
			 * add_filter( 'pb_active_export_modules', function ( $modules ) {
			 *    if ( isset( $_POST['export_formats']['docx'] ) ) {
			 *        $modules[] = '\Pressbooks\Modules\Export\Docx\Docx';
			 *    }
			 *    return $modules;
			 * } );
			 *
			 * @since 3.9.8
			 *
			 * @param array $modules
			 */
			$modules = apply_filters( 'pb_active_export_modules', $modules );
		}

		return $modules;
	}
597111
def modules():
    '''
    
    '''
    cmd = '{0} -M'.format(_detect_os())
    ret = {}
    ret['static'] = []
    ret['shared'] = []
    out = __salt__['cmd.run'](cmd).splitlines()
    for line in out:
        comps = line.split()
        if not comps:
            continue
        if '(static)' in line:
            ret['static'].append(comps[0])
        if '(shared)' in line:
            ret['shared'].append(comps[0])
    return ret
231764
protected function getAllModules()
    {
        return $this->extensionManager->discoverModules()
                    ->showInstalled()
                    ->showUninstalled()
                    ->showNoCore()
                    ->showCore()
                    ->getList(true);
    }
813006
def _load_all(self):
        '''
        
        '''
        with self._lock:
            for name in self.file_mapping:
                if name in self.loaded_files or name in self.missing_modules:
                    continue
                self._load_module(name)

            self.loaded = True
824611
def make_example_scripts_docs(spth, npth, rpth):
    

    # Ensure that output directory exists
    mkdir(rpth)

    # Iterate over index files
    for fp in glob(os.path.join(spth, '*.rst')) + \
              glob(os.path.join(spth, '*', '*.rst')):
        # Index basename
        b = os.path.basename(fp)
        # Index dirname
        dn = os.path.dirname(fp)
        # Name of subdirectory of examples directory containing current index
        sd = os.path.split(dn)
        # Set d to the name of the subdirectory of the root directory
        if dn == spth:  # fp is the root directory index file
            d = ''
        else:           # fp is a subdirectory index file
            d = sd[-1]
        # Path to corresponding subdirectory in docs directory
        fd = os.path.join(rpth, d)
        # Ensure notebook subdirectory exists
        mkdir(fd)
        # Filename of index file to be constructed
        fn = os.path.join(fd, b)
        # Process current index file if corresponding notebook file
        # doesn't exist, or is older than index file
        if update_required(fp, fn):
            print('Converting %s                ' % os.path.join(d, b),
                  end='\r')
            # Convert script index to docs index
            rst_to_docs_rst(fp, fn)

    # Iterate over example scripts
    for fp in sorted(glob(os.path.join(spth, '*', '*.py'))):
        # Name of subdirectory of examples directory containing current script
        d = os.path.split(os.path.dirname(fp))[1]
        # Script basename
        b = os.path.splitext(os.path.basename(fp))[0]
        # Path to corresponding notebook
        fn = os.path.join(npth, d, b + '.ipynb')
        # Path to corresponding sphinx doc file
        fr = os.path.join(rpth, d, b + '.rst')
        # Only proceed if script and notebook exist
        if os.path.exists(fp) and os.path.exists(fn):
            # Convert notebook to rst if notebook is newer than rst
            # file or if rst file doesn't exist
            if update_required(fn, fr):
                fnb = os.path.join(d, b + '.ipynb')
                print('Processing %s                ' % fnb, end='\r')
                script_and_notebook_to_rst(fp, fn, fr)
        else:
            print('WARNING: script %s or notebook %s not found' %
                  (fp, fn))
956359
def package_assets(example_path):
    
    examples(example_path, force=True, root=__file__)
    for root, dirs, files in os.walk(example_path):
        walker(root, dirs+files)
    setup_args['packages'] += packages
    for p, exts in extensions.items():
        if exts:
            setup_args['package_data'][p] = exts
1122217
public function getAllModules()
	{
		$arrModules = array();

		$strQuery = 'SELECT m.id, m.name, t.name AS theme FROM tl_module m LEFT JOIN tl_theme t ON m.pid=t.id';

		if(\Input::get('table') == 'tl_module' && \Input::get('act') == 'edit')
		{
			$strQuery .= ' WHERE m.id != ?';
		}

		$strQuery .= ' ORDER BY t.name, m.name';

		$objModules = $this->Database->prepare($strQuery)->execute(\Input::get('id'));

		while ($objModules->next())
		{
			$arrModules[$objModules->theme][$objModules->id] = $objModules->name . ' (ID ' . $objModules->id . ')';
		}

		return $arrModules;
	}
840963
def get_app_modules(self, apps):
        
        modules = getattr(self, "_modules", [])

        if not modules:
            from django.utils.module_loading import module_has_submodule

            # Try importing a modules from the module package
            package_string = '.'.join(['leonardo', 'module'])

            for app in apps:
                exc = '...'
                try:
                    # check if is not full app
                    _app = import_module(app)
                except Exception as e:
                    _app = False
                    exc = e

                if module_has_submodule(
                        import_module(package_string), app) or _app:
                    if _app:
                        mod = _app
                    else:
                        mod = import_module('.{0}'.format(app), package_string)
                    if mod:
                        modules.append(mod)
                        continue

                warnings.warn('%s was skipped because %s ' % (app, exc))

            self._modules = modules
        return self._modules
1114070
def custom_module_classes():
    

    # Dict to hold parsed data. Each key should contain a custom data type
    # eg. output from a particular script. Note that this script may pick
    # up many different types of data from many different sources.
    # Second level keys should be 'config' and 'data'. Data key should then
    # contain sample names, and finally data.
    cust_mods = defaultdict(lambda: defaultdict(lambda: OrderedDict()))

    # Dictionary to hold search patterns - start with those defined in the config
    search_patterns = ['custom_content']

    # First - find files using patterns described in the config
    config_data = getattr(config, 'custom_data', {})
    for k,f in config_data.items():

        # Check that we have a dictionary
        if type(f) != dict:
            log.debug("config.custom_data row was not a dictionary: {}".format(k))
            continue
        c_id = f.get('id', k)

        # Data supplied in with config (eg. from a multiqc_config.yaml file in working directory)
        if 'data' in f:
            cust_mods[c_id]['data'].update( f['data'] )
            cust_mods[c_id]['config'].update( { k:v for k, v in f.items() if k is not 'data' } )
            cust_mods[c_id]['config']['id'] = cust_mods[c_id]['config'].get('id', c_id)
            continue

        # Custom Content ID has search patterns in the config
        if c_id in report.files:
            cust_mods[c_id]['config'] = f
            cust_mods[c_id]['config']['id'] = cust_mods[c_id]['config'].get('id', c_id)
            search_patterns.append(c_id)
            continue

        # We should have had something by now
        log.warn("Found section '{}' in config for under custom_data, but no data or search patterns.".format(c_id))

    # Now go through each of the file search patterns
    bm = BaseMultiqcModule()
    for k in search_patterns:
        num_sp_found_files = 0
        for f in bm.find_log_files(k):
            num_sp_found_files += 1
            # Handle any exception without messing up for remaining custom content files
            try:
                f_extension = os.path.splitext(f['fn'])[1]

                # YAML and JSON files are the easiest
                parsed_data = None
                if f_extension == '.yaml' or f_extension == '.yml':
                    try:
                        parsed_data = yaml_ordered_load(f['f'])
                    except Exception as e:
                        log.warning("Error parsing YAML file '{}' (probably invalid YAML)".format(f['fn']))
                        log.warning("YAML error: {}".format(e))
                        break
                elif f_extension == '.json':
                    try:
                        # Use OrderedDict for objects so that column order is honoured
                        parsed_data = json.loads(f['f'], object_pairs_hook=OrderedDict)
                    except Exception as e:
                        log.warning("Error parsing JSON file '{}' (probably invalid JSON)".format(f['fn']))
                        log.warning("JSON error: {}".format(e))
                        break
                elif f_extension == '.png' or f_extension == '.jpeg' or f_extension == '.jpg':
                    image_string = base64.b64encode(f['f'].read()).decode('utf-8')
                    image_format = 'png' if f_extension == '.png' else 'jpg'
                    img_html = '<div class="mqc-custom-content-image"><img src="data:image/{};base64,{}" /></div>'.format(image_format, image_string)
                    parsed_data = {
                        'id': f['s_name'],
                        'plot_type': 'image',
                        'section_name': f['s_name'].replace('_', ' ').replace('-', ' ').replace('.', ' '),
                        'description': 'Embedded image <code>{}</code>'.format(f['fn']),
                        'data': img_html
                    }
                if parsed_data is not None:
                    c_id = parsed_data.get('id', k)
                    if len(parsed_data.get('data', {})) > 0:
                        if type(parsed_data['data']) == str:
                            cust_mods[c_id]['data'] = parsed_data['data']
                        else:
                            cust_mods[c_id]['data'].update( parsed_data['data'] )
                        cust_mods[c_id]['config'].update ( { j:k for j,k in parsed_data.items() if j != 'data' } )
                    else:
                        log.warning("No data found in {}".format(f['fn']))

                # txt, csv, tsv etc
                else:
                    # Look for configuration details in the header
                    m_config = _find_file_header( f )
                    s_name = None
                    if m_config is not None:
                        c_id = m_config.get('id', k)
                        # Update the base config with anything parsed from the file
                        b_config = cust_mods.get(c_id, {}).get('config', {})
                        b_config.update( m_config )
                        # Now set the module config to the merged dict
                        m_config = dict(b_config)
                        s_name = m_config.get('sample_name')
                    else:
                        c_id = k
                        m_config = cust_mods.get(c_id, {}).get('config', {})

                    # Guess sample name if not given
                    if s_name is None:
                        s_name = bm.clean_s_name(f['s_name'], f['root'])

                    # Guess c_id if no information known
                    if k == 'custom_content':
                        c_id = s_name

                    # Add information about the file to the config dict
                    if 'files' not in m_config:
                        m_config['files'] = dict()
                    m_config['files'].update( { s_name : { 'fn': f['fn'], 'root': f['root'] } } )

                    # Guess file format if not given
                    if m_config.get('file_format') is None:
                        m_config['file_format'] = _guess_file_format( f )
                    # Parse data
                    try:
                        parsed_data, conf = _parse_txt( f, m_config )
                        if parsed_data is None or len(parsed_data) == 0:
                            log.warning("Not able to parse custom data in {}".format(f['fn']))
                        else:
                            # Did we get a new section id from the file?
                            if conf.get('id') is not None:
                                c_id = conf.get('id')
                            # heatmap - special data type
                            if type(parsed_data) == list:
                                cust_mods[c_id]['data'] = parsed_data
                            elif conf.get('plot_type') == 'html':
                                cust_mods[c_id]['data'] = parsed_data
                            else:
                                cust_mods[c_id]['data'].update(parsed_data)
                            cust_mods[c_id]['config'].update(conf)
                    except (IndexError, AttributeError, TypeError):
                        log.error("Unexpected parsing error for {}".format(f['fn']), exc_info=True)
                        raise # testing
            except Exception as e:
                log.error("Uncaught exception raised for file '{}'".format(f['fn']))
                log.exception(e)

        # Give log message if no files found for search pattern
        if num_sp_found_files == 0 and k != 'custom_content':
            log.debug("No samples found: custom content ({})".format(k))

    # Filter to strip out ignored sample names
    for k in cust_mods:
        cust_mods[k]['data'] = bm.ignore_samples(cust_mods[k]['data'])

    # Remove any configs that have no data
    remove_cids = [ k for k in cust_mods if len(cust_mods[k]['data']) == 0 ]
    for k in remove_cids:
        del cust_mods[k]

    if len(cust_mods) == 0:
        raise UserWarning

    # Go through each data type
    parsed_modules = list()
    for module_id, mod in cust_mods.items():

        # General Stats
        if mod['config'].get('plot_type') == 'generalstats':
            gsheaders = mod['config'].get('pconfig')
            if gsheaders is None:
                headers = set()
                for d in mod['data'].values():
                    headers.update(d.keys())
                headers = list(headers)
                headers.sort()
                gsheaders = OrderedDict()
                for h in headers:
                    gsheaders[h] = dict()

            # Headers is a list of dicts
            if type(gsheaders) == list:
                gsheaders_dict = OrderedDict()
                for gsheader in gsheaders:
                    for col_id, col_data in gsheader.items():
                        gsheaders_dict[col_id] = col_data
                gsheaders = gsheaders_dict

            # Add namespace and description if not specified
            for m_id in gsheaders:
                if 'namespace' not in gsheaders[m_id]:
                    gsheaders[m_id]['namespace'] = mod['config'].get('namespace', module_id)

            bm.general_stats_addcols(mod['data'], gsheaders)

        # Initialise this new module class and append to list
        else:
            parsed_modules.append( MultiqcModule(module_id, mod) )
            if mod['config'].get('plot_type') == 'html':
                log.info("{}: Found 1 sample (html)".format(module_id))
            if mod['config'].get('plot_type') == 'image':
                log.info("{}: Found 1 sample (image)".format(module_id))
            else:
                log.info("{}: Found {} samples ({})".format(module_id, len(mod['data']), mod['config'].get('plot_type')))

    # Sort sections if we have a config option for order
    mod_order = getattr(config, 'custom_content', {}).get('order', [])
    sorted_modules = [parsed_mod for parsed_mod in parsed_modules if parsed_mod.anchor not in mod_order ]
    sorted_modules.extend([parsed_mod for mod_id in mod_order for parsed_mod in parsed_modules if parsed_mod.anchor == mod_id ])

    # If we only have General Stats columns then there are no module outputs
    if len(sorted_modules) == 0:
        raise UserWarning

    return sorted_modules
1285674
public List<ModuleType<ApplicationType<T>>> getAllModule()
   {
      List<ModuleType<ApplicationType<T>>> list = new ArrayList<ModuleType<ApplicationType<T>>>();
      List<Node> nodeList = childNode.get("module");
      for(Node node: nodeList)
      {
         ModuleType<ApplicationType<T>>  type = new ModuleTypeImpl<ApplicationType<T>>(this, "module", childNode, node);
         list.add(type);
      }
      return list;
   }
411298
protected function runAllCoreModules()
    {
        $allModules = \BFW\Application::getInstance()
            ->getConfig()
            ->getValue('modules', 'modules.php')
        ;
        
        foreach ($allModules as $moduleInfos) {
            $moduleName    = $moduleInfos['name'];
            $moduleEnabled = $moduleInfos['enabled'];

            if (empty($moduleName) || $moduleEnabled === false) {
                continue;
            }

            $this->runModule($moduleName);
        }
    }