Initializes a custom named package module.

    This works by replacing all instances of 'project' with a custom module
    name.
352700
def init_pkg(pkg, repo_dest):
    
    vars = {'pkg': pkg}
    with dir_path(repo_dest):
        patch("""\
        diff --git a/manage.py b/manage.py
        index 40ebb0a..cdfe363 100755
        --- a/manage.py
        +++ b/manage.py
        @@ -3,7 +3,7 @@ import os
         import sys

         # Edit this if necessary or override the variable in your environment.
        -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
        +os.environ.setdefault('DJANGO_SETTINGS_MODULE', '%(pkg)s.settings')

         try:
             # For local development in a virtualenv:
        diff --git a/project/settings/base.py b/project/settings/base.py
        index 312f280..c75e673 100644
        --- a/project/settings/base.py
        +++ b/project/settings/base.py
        @@ -7,7 +7,7 @@ from funfactory.settings_base import *
         # If you did not install Playdoh with the funfactory installer script
         # you may need to edit this value. See the docs about installing from a
         # clone.
        -PROJECT_MODULE = 'project'
        +PROJECT_MODULE = '%(pkg)s'

         # Bundles is a dictionary of two dictionaries, css and js, which list css files
         # and js files that can be bundled together by the minify app.
        diff --git a/setup.py b/setup.py
        index 58dbd93..9a38628 100644
        --- a/setup.py
        +++ b/setup.py
        @@ -3,7 +3,7 @@ import os
         from setuptools import setup, find_packages


        -setup(name='project',
        +setup(name='%(pkg)s',
               version='1.0',
               description='Django application.',
               long_description='',
        """ % vars)

        git(['mv', 'project', pkg])
        git(['commit', '-a', '-m', 'Renamed project module to %s' % pkg])
1228983
public final void init(String... packageNames) {

        Collection<Class<?>> classes = discoverClasses(packageNames);
        if (classes.isEmpty()) {
            log.warn("No annotated controllers found in package(s) '{}'", Arrays.toString(packageNames));
            return;
        }

        log.debug("Found {} controller classes in {} package(s)", classes.size(), packageNames.length);

        init(classes);
    }
215459
function (name) {
    // initialize module instance with default module configuration
    _.merge(this, defaultModuleConfig)
    // set app name
    this.name = name
    // set absolute path of base directory for module
    this.base = getBase()
    // store reference to global app
    this.immutableApp = immutableApp
}
84804
function initModule (args) {
    // require string name
    this.assert(typeof args.name === 'string' && args.name.length, 101)
    // component must not already be defined
    this.assert(!defined(this.global().components[args.name]), 102, `${args.name} component already defined`)
    // store name
    this.name = args.name
    // create module name from string with `Component` appended
    this.moduleName = `${this.name}Component`
    // create new module - throws error if defined
    this.module = ImmutableCore.module(this.moduleName, {})
    // add info to module meta
    this.module.meta.class = 'ImmutableCoreComponent'
    this.module.meta.instance = this
    // add component to global register
    this.global().components[this.name] = this
}
705387
def newModule(name):
    
    if isinstance(name, str):
        name = Atom(name)

    return PL_new_module(name.handle)
164772
def named_module(name):
    """"""
    module = __import__(name)
    packages = name.split(".")[1:]
    m = module
    for p in packages:
        m = getattr(m, p)
    return m
332249
public static void init() {
        reports.clear();
        Reflections reflections = new Reflections(REPORTS_PACKAGE);
        final Set<Class<? extends Report>> reportClasses = reflections.getSubTypesOf(Report.class);

        for(Class<? extends Report> c : reportClasses) {
            LOG.info("Report class: " + c.getName());
            try {
                reports.add(c.newInstance());
            } catch (IllegalAccessException | InstantiationException e) {
                LOG.error("Error while loading report implementation classes", e);
            }
        }

        if(LOG.isInfoEnabled()) {
            LOG.info(String.format("Detected %s reports", reports.size()));
        }
    }
718726
def initialize_experiment_package(path):
    """"""
    # Create __init__.py if it doesn't exist (needed for Python 2)
    init_py = os.path.join(path, "__init__.py")
    if not os.path.exists(init_py):
        open(init_py, "a").close()

    # Retain already set experiment module
    if sys.modules.get("dallinger_experiment") is not None:
        return
    dirname = os.path.dirname(path)
    basename = os.path.basename(path)
    sys.path.insert(0, dirname)
    package = __import__(basename)
    if path not in package.__path__:
        raise Exception("Package was not imported from the requested path!")
    sys.modules["dallinger_experiment"] = package
    package.__package__ = "dallinger_experiment"
    sys.path.pop(0)
354701
public static function init() {
		if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Loader ) ) {
			self::$instance = new Loader();
			$modules        = array_merge( self::$available_modules, apply_filters( 'themeisle_sdk_modules', [] ) );
			foreach ( $modules as $key => $module ) {
				if ( ! class_exists( 'ThemeisleSDK\\Modules\\' . ucwords( $module, '_' ) ) ) {
					unset( $modules[ $key ] );
				}
			}
			self::$available_modules = $modules;
		}
	}
480050
def _declare_namespace(self, package_name):
    '''
    
    '''

    self.state['declare_namespace'](package_name)
    mod = sys.modules[package_name]
    mod.__path__ = pkgutil.extend_path(mod.__path__, package_name)
1334268
protected void initModule() {

        Object o;

        if (CmsStringUtil.isEmpty(getParamAction()) || CmsDialog.DIALOG_INITIAL.equals(getParamAction())) {
            // this is the initial dialog call
            if (CmsStringUtil.isNotEmpty(m_paramModule)) {
                // edit an existing module, get it from manager
                o = OpenCms.getModuleManager().getModule(m_paramModule);
            } else {
                // create a new module
                o = null;
            }
        } else {
            // this is not the initial call, get module from session
            o = getDialogObject();
        }

        if (!(o instanceof CmsModule)) {
            // create a new module
            m_module = new CmsModule();

        } else {
            // reuse module stored in session
            m_module = (CmsModule)((CmsModule)o).clone();
        }
    }
569449
def from_directory_import(
        self,
        module,
        real_names,
        local_names,
        import_alias_mapping,
        skip_init=False
    ):
        
        module_path = module[1]

        init_file_location = os.path.join(module_path, '__init__.py')
        init_exists = os.path.isfile(init_file_location)

        if init_exists and not skip_init:
            package_name = os.path.split(module_path)[1]
            return self.add_module(
                module=(module[0], init_file_location),
                module_or_package_name=package_name,
                local_names=local_names,
                import_alias_mapping=import_alias_mapping,
                is_init=True,
                from_from=True
            )
        for real_name in real_names:
            full_name = os.path.join(module_path, real_name)
            if os.path.isdir(full_name):
                new_init_file_location = os.path.join(full_name, '__init__.py')
                if os.path.isfile(new_init_file_location):
                    self.add_module(
                        module=(real_name, new_init_file_location),
                        module_or_package_name=real_name,
                        local_names=local_names,
                        import_alias_mapping=import_alias_mapping,
                        is_init=True,
                        from_from=True,
                        from_fdid=True
                    )
                else:
                    raise Exception('from anything import directory needs an __init__.py file in directory')
            else:
                file_module = (real_name, full_name + '.py')
                self.add_module(
                    module=file_module,
                    module_or_package_name=real_name,
                    local_names=local_names,
                    import_alias_mapping=import_alias_mapping,
                    from_from=True
                )
        return IgnoredNode()
1255268
protected function initProject() {
        $this->showHeader();
        Utils::getInstance()->createDirectory(['apps', 'bootstrap', 'config', 'public', 'tmp/tpl_compile', 'plugins']);
        foreach (self::FILES_BASE as $pathname => $contents) {
            Utils::getInstance()->createFile($pathname, $contents);
        }
        chmod("tmp", 775);
        chmod("tmp/tpl_compile", 775);
    }
497763
public void init(Context context) {
        if (!mNotFoundClassesMap.isEmpty()) {
            buildInstalledPackagesCache(context);
        }

        mPackageMonitor.register(context);
    }
333823
def _init():
    """"""
    import importlib
    import os
    import re

    filenames = os.listdir(os.path.dirname(__file__))

    module_names = set()
    for filename in filenames:
        match = re.match(r'^(?P<name>[A-Z_a-z]\w*)\.py[co]?$', filename)
        if match:
            module_names.add(match.group('name'))

    for module_name in module_names:
        try:
            module = importlib.import_module('.' + module_name, __name__)
        except ImportError:
            continue

        for name, member in module.__dict__.items():
            if not isinstance(member, type):
                # skip non-new-style classes
                continue
            if not issubclass(member, Engine):
                # skip non-subclasses of Engine
                continue
            if member is Engine:
                # skip "abstract" class Engine
                continue

            try:
                handle = member.handle
            except AttributeError:
                continue

            engines[handle] = member
486909
def _initAddons(cls, recurse=True):
        
        for addon_module in cls.addonModules(recurse):
            projex.importmodules(addon_module)
1148249
function initModule(forge) {

forge.mgf = forge.mgf || {};
forge.mgf.mgf1 = forge.mgf1;

}