Register a honeycomb integration.

    :param package_folder: Path to folder with integration to load
    :returns: Validated integration object
    :rtype: :func:`honeycomb.utils.defs.Integration`
764240
def register_integration(package_folder):
    
    logger.debug("registering integration %s", package_folder)
    package_folder = os.path.realpath(package_folder)
    if not os.path.exists(package_folder):
        raise IntegrationNotFound(os.path.basename(package_folder))

    json_config_path = os.path.join(package_folder, CONFIG_FILE_NAME)
    if not os.path.exists(json_config_path):
        raise ConfigFileNotFound(json_config_path)

    with open(json_config_path, "r") as f:
        config_json = json.load(f)

    # Validate integration and alert config
    validate_config(config_json, defs.INTEGRATION_VALIDATE_CONFIG_FIELDS)
    validate_config_parameters(config_json,
                               defs.INTEGRATION_PARAMETERS_ALLOWED_KEYS,
                               defs.INTEGRATION_PARAMETERS_ALLOWED_TYPES)

    integration_type = _create_integration_object(config_json)

    return integration_type
223891
private void registerModule(String[] packageList)
  {
    if (TraceComponent.isAnyTracingEnabled() && _tc.isEntryEnabled()) SibTr.entry(_tc, "registerModule", new Object[] { this, packageList });

    for (int i = 0, rc = 0;(rc == 0) && (i < packageList.length); i++)
    {
      if (TraceComponent.isAnyTracingEnabled() && _tc.isDebugEnabled()) SibTr.debug(_tc, "Registering diagnostic module " + this +" for package: " + packageList[i]);

      rc = FFDC.registerDiagnosticModule(this, packageList[i]);

      if (rc != 0)
      {
        if (TraceComponent.isAnyTracingEnabled() && _tc.isDebugEnabled()) SibTr.debug(_tc, "Registration failed, return code=" + rc);
      }
    }

    if (TraceComponent.isAnyTracingEnabled() && _tc.isEntryEnabled()) SibTr.exit(_tc, "registerModule");
  }
673036
def isPackage(file_path):
    
    return (os.path.isdir(file_path) and
            os.path.isfile(os.path.join(file_path, '__init__.py')))
568555
private void mergePackage( InternalKnowledgePackage pkg,
                               InternalKnowledgePackage newPkg ) {
        // Merge imports
        final Map<String, ImportDeclaration> imports = pkg.getImports();
        imports.putAll(newPkg.getImports());

        // Merge static imports
        for (String staticImport : newPkg.getStaticImports()) {
            pkg.addStaticImport(staticImport);
        }

        String lastIdent = null;
        String lastType = null;
        try {
            // merge globals
            if (newPkg.getGlobals() != null && newPkg.getGlobals() != Collections.EMPTY_MAP) {
                Map<String, String> globals = pkg.getGlobals();
                // Add globals
                for (final Map.Entry<String, String> entry : newPkg.getGlobals().entrySet()) {
                    final String identifier = entry.getKey();
                    final String type = entry.getValue();
                    lastIdent = identifier;
                    lastType = type;
                    if (globals.containsKey( identifier ) && !globals.get( identifier ).equals( type )) {
                        throw new RuntimeException(pkg.getName() + " cannot be integrated");
                    } else {
                        pkg.addGlobal( identifier,
                                       this.rootClassLoader.loadClass( type ) );
                        // this isn't a package merge, it's adding to the rulebase, but I've put it here for convienience
                        addGlobal(identifier,
                                  this.rootClassLoader.loadClass(type));
                    }
                }
            }
        } catch (ClassNotFoundException e) {
            throw new RuntimeException( "Unable to resolve class '" + lastType +
                                        "' for global '" + lastIdent + "'" );
        }

        // merge entry point declarations
        if (newPkg.getEntryPointIds() != null) {
            for (String ep : newPkg.getEntryPointIds()) {
                pkg.addEntryPointId( ep );

            }
        }

        // merge the type declarations
        if (newPkg.getTypeDeclarations() != null) {
            // add type declarations
            for (TypeDeclaration type : newPkg.getTypeDeclarations().values()) {
                // @TODO should we allow overrides? only if the class is not in use.
                if (!pkg.getTypeDeclarations().containsKey( type.getTypeName() )) {
                    // add to package list of type declarations
                    pkg.addTypeDeclaration( type );
                }
            }
        }

        // merge window declarations
        if ( newPkg.getWindowDeclarations() != null ) {
            // add window declarations
            for ( WindowDeclaration window : newPkg.getWindowDeclarations().values() ) {
                if ( !pkg.getWindowDeclarations().containsKey( window.getName() ) ||
                     pkg.getWindowDeclarations().get( window.getName() ).equals( window ) ) {
                    pkg.addWindowDeclaration( window );
                } else {
                    throw new RuntimeException( "Unable to merge two conflicting window declarations for window named: "+window.getName() );
                }
            }
        }

        //Merge rules into the RuleBase package
        //as this is needed for individual rule removal later on
        List<RuleImpl> rulesToBeRemoved = new ArrayList<RuleImpl>();
        for (Rule newRule : newPkg.getRules()) {
            // remove the rule if it already exists
            RuleImpl oldRule = pkg.getRule(newRule.getName());
            if (oldRule != null) {
                rulesToBeRemoved.add(oldRule);
            }
        }
        if (!rulesToBeRemoved.isEmpty()) {
            removeRules( rulesToBeRemoved );
        }

        for (Rule newRule : newPkg.getRules()) {
            pkg.addRule((RuleImpl)newRule);
        }

        //Merge The Rule Flows
        if (newPkg.getRuleFlows() != null) {
            for (Process flow : newPkg.getRuleFlows().values()) {
                pkg.addProcess(flow);
            }
        }

        if ( ! newPkg.getResourceTypePackages().isEmpty() ) {
            KieWeavers weavers = ServiceRegistry.getInstance().get(KieWeavers.class);
            for ( ResourceTypePackage rtkKpg : newPkg.getResourceTypePackages().values() ) {
                weavers.merge( this, pkg, rtkKpg );
            }
        }
    }
441806
public void addPackage(String strPackage)
    {
        if ((strPackage.length() == 0) || (strPackage.equals(DBConstants.ROOT_PACKAGE)))
            return;
        if (this.addName(strPackage) == false)
            return;     // This name was already included in the header
        m_MethodOut.writeit("import " + strPackage + ".*;\n");
    }
155203
def register_blueprints(app, application_package_name=None, blueprint_directory=None):
    """"""
    if not application_package_name:
        application_package_name = 'app'

    if not blueprint_directory:
        blueprint_directory = os.path.join(os.getcwd(), application_package_name)

    blueprint_directories = get_child_directories(blueprint_directory)

    for directory in blueprint_directories:
        abs_package = '{}.{}'.format(application_package_name, directory)

        service = importlib.import_module(abs_package)
        app.register_blueprint(service.blueprint_api, url_prefix='')
1183871
def register_schema(self, directory, path):
        
        self.schemas[path] = os.path.abspath(directory)
71837
def add_package(pkg_type, pkg_name, working=None):
    
    kvp = {pkg_type: pkg_name}
    working = os.getcwd() if not working else os.path.abspath(working)
    if '-dist/scripts' in working:
        config = working + "/config.JSON"
    elif '-dist' in working:
        config = working + "/scripts/config.JSON"
    else:
        config = working + "/*-dist/scripts/config.JSON"
        entropy = glob.glob(config)
        if entropy:
            config = entropy[0]  # we'll just assume it's the first one...
    print("config", config, 'working', working)
    config = load_config(config)
    config.update(kvp)
    export_to_json(config)
1122854
function registerBower(pck) {
	var pd = pck.commit.versionPkg({
		replacer : pck.options.pkgJsonReplacer,
		space : pck.options.pkgJsonSpace,
		readOnly : true
	});
	if (!pd || !pd.pkgBower) {
		rbot.log.info('Skipping bower registration check (no bower package found)');
		return pck.rollCall.then(npmPub);
	}
	var path = pd.pkgBower.path;
	var name = pd.pkgBower.name;
	var ver = pd.pkgBower.ver;
	var url = pd.pkgBower.repository && pd.pkgBower.repository.url ? pd.pkgBower.repository.url : '';
	if (!name || !url) {
		rbot.log.info('Skipping bower registration check '
				+ (name || ver || url ? 'for "' + (name ? ':name:' + name : ':NO name:')
						+ (ver ? ':version:' + ver : ':NO version:') + (url ? ':url:' + url : ':NO repository.url:')
						+ '" ' : '') + (!path ? '("' + path + '" cannot be read)' : 'in: ' + path));
		return pck.rollCall.then(npmPub);
	}
	var bower = null;
	try {
		bower = require('bower');
	} catch (e) {
		rbot.log.info('Skipping bower registration (bower module not found)', e);
		return pck.rollCall.then(npmPub);
	}
	pck.rollCall.pause(function bowerLookup() {
		bower.commands.lookup(name).on('error', function(e) {
			pck.rollCall.error('bower lookup failed', e).resume();
		}).on('end', bowerLookupEnd);
	});
	function bowerLookupEnd(data) {
		if (data) {
			if (data.url !== url) {
				pck.rollCall.error(
						'bower lookup found "' + name + '", but the repository.url found "' + data.url
								+ '" does not match the expected "' + path + '" repository.url "' + url + '"').resume();
			} else {
				rbot.log.verbose('found existing bower package for "' + name + '" at "' + data.url
						+ '"... no need to perform bower register');
			}
		} else {
			rbot.log.info('registering bower package "' + name + '"');
			pck.rollCall.pause(function bowerReg() {
				bower.commands.lookup(name, url).on('error', function(e) {
					pck.rollCall.error('bower registration failed', e).resume();
				}).on('end', bowerRegEnd);
			});
		}
	}
	function bowerRegEnd(data) {
		if (data) {
			rbot.log.info('bower registration complete');
			rbot.log.dir(data);
			pck.rollCall.then(npmPub).resume();
		} else {
			pck.rollCall.error('bower registration failed (no data received)').resume();
		}
	}
	function npmPub() {
		publishNpm(pck);
	}
}
905191
def _register_with_pkg_resources(cls):
        
        try:
            import pkg_resources
            # access an attribute in case a deferred importer is present
            pkg_resources.__name__
        except ImportError:
            return

        # Since pytest tests are always located in the file system, the
        #  DefaultProvider is appropriate.
        pkg_resources.register_loader_type(cls, pkg_resources.DefaultProvider)
726765
def add_package(self, check_name, package):
        
        self._package_set.add(package)
        package_data = self._packages[package.name]
        self._checks_deps[check_name].append(package)

        # Versions
        if package.version:
            versions = package_data['versions']
            versions[package.version].append(check_name)

        # Marker section
        if package.marker:
            markers = package_data['markers']
            markers[package.marker].append(check_name)
714061
def load(cls, folder):
        
        popset = PopulationSet.load_hdf(os.path.join(folder,'popset.h5'))
        sigfile = os.path.join(folder,'trsig.pkl')
        with open(sigfile, 'rb') as f:
            trsig = pickle.load(f)
        return cls(trsig, popset, folder=folder)
126018
private void registerFolder(final Path folder) throws IOException {
        // register directory and sub-directories
        Files.walkFileTree(folder, new SimpleFileVisitor<Path>() {
            @Override
            public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
                    throws IOException
            {
                WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
                logger.debug("registering folder {}", dir);
                folders.put(key, dir);
                return FileVisitResult.CONTINUE;
            }
        });
    }
439354
public final void addFolder(@NotNull final Folder folder) {
        Contract.requireArgNotNull("folder", folder);
        if (folders == null) {
            folders = new ArrayList<>();
        }
        folders.add(folder);
    }
7679
def generic_insert_with_folder(folder_name, file_name, template_name, args):
    
    # First we make sure views are a package instead a file
    if not os.path.isdir(
        os.path.join(
            args['django_application_folder'],
            folder_name
        )
    ):
        os.mkdir(os.path.join(args['django_application_folder'], folder_name))
        codecs.open(
            os.path.join(
                args['django_application_folder'],
                folder_name,
                '__init__.py'
            ),
            'w+'
        )

    view_file = create_or_open(
        os.path.join(
            folder_name,
            '{}.py'.format(file_name)
        ), 
        '', 
        args
    )
    # Load content from template
    render_template_with_args_in_file(
        view_file, 
        os.path.join(
            BASE_TEMPLATES_DIR, 
            template_name
        ),
        model_name=args['model_name'],
        model_prefix=args['model_prefix'],
        model_name_lower=args['model_name'].lower(),
        application_name=args['django_application_folder'].split("/")[-1]
    )
    view_file.close()
520160
public void setRegisterBlueprintsByPackage(String _package) throws RegisterBlueprintException {

        Set<Class<?>> annotated = null;
        try {
            annotated = new ClassesInPackageScanner().findAnnotatedClasses(_package, Blueprint.class);
        } catch (IOException e) {
            throw new RegisterBlueprintException(e);
        }

        logger.info("Scanned {} and found {}", _package, annotated);

        this.setRegisterBlueprints(annotated);
    }
189210
def init_datapackage(resource_paths):
    
    dp = datapackage.Package({
        'name': 'change-me',
        'schema': 'tabular-data-package',
    })

    for path in resource_paths:
        dp.infer(path)

    return dp