Load the client adaptor module of django_peeringdb
    Assumes config is valid.
555654
def load_backend(**orm_config):
    
    settings = {}
    settings['SECRET_KEY'] = orm_config.get('secret_key', '')

    db_config = orm_config['database']
    if db_config:
        settings['DATABASES'] = {
            'default': database_settings(db_config)
        }

    from django_peeringdb.client_adaptor.setup import configure
    # Override defaults
    configure(**settings)
    # Must import implementation module after configure
    from django_peeringdb.client_adaptor import backend

    migrate = orm_config.get("migrate")
    if migrate and not backend.Backend().is_database_migrated():
        backend.Backend().migrate_database()

    return backend
222428
def load_from_name(module_name):
    
    global _CONFIG_CACHE
    if module_name not in _CONFIG_CACHE:
        settings = OrderedDict()
        if isinstance(module_name, six.string_types):
            settings = _load_from_module(_import_module(module_name))
        _CONFIG_CACHE[module_name] = settings
    return _CONFIG_CACHE[module_name]
635143
def load(self, client, webpy_app, course_factory, task_factory, database, user_manager, submission_manager, config):
        
        self._app = webpy_app
        self._task_factory = task_factory
        self._database = database
        self._user_manager = user_manager
        self._submission_manager = submission_manager
        self._loaded = True
        for entry in config:
            module = importlib.import_module(entry["plugin_module"])
            module.init(self, course_factory, client, entry)
330335
def load(self, configuration):
        
        try:
            self.config = yaml.load(open(configuration, "rb"))
        except IOError:
            try:
                self.config = yaml.load(configuration)
            except ParserError, e:
                raise ParserError('Error parsing config: %s' % e)

        # put customer data into self.customer
        if isinstance(self.config, dict):
            self.customer = self.config.get('customer', {})
            self.instances_dict = self.config.get('instances', {})
            self.web2py_dir = self.config.get('web2py', None)
            self.api_type = self.config.get('api_type', 'jsonrpc')
            self.valid = True
        else:
            self.customer = {}
            self.instances_dict = {}
            self.web2py_dir = None
            self.valid = False
784307
def configure_plugin(app):  # noqa: C901
    

    @app.route(
        "/v1/api/client_has_addon/<hashed_client_id>/<addon_id>/", methods=["GET"]
    )
    def client_has_addon(hashed_client_id, addon_id):
        # Use the module global PROXY_MANAGER
        global PROXY_MANAGER
        recommendation_manager = check_proxy_manager(PROXY_MANAGER)
        pf = recommendation_manager._ctx["profile_fetcher"]

        client_meta = pf.get(hashed_client_id)
        if client_meta is None:
            # no valid client metadata was found for the given
            # clientId
            result = {"results": False, 'error': 'No client found'}
            response = app.response_class(
                response=json.dumps(result), status=200, mimetype="application/json"
            )
            return response

        result = {"results": addon_id in client_meta.get("installed_addons", [])}
        response = app.response_class(
            response=json.dumps(result), status=200, mimetype="application/json"
        )
        return response

    @app.route("/v1/api/recommendations/<hashed_client_id>/", methods=["GET", "POST"])
    def recommendations(hashed_client_id):
        """Return a list of recommendations provided a telemetry client_id."""
        # Use the module global PROXY_MANAGER
        global PROXY_MANAGER

        extra_data = {}
        extra_data["options"] = {}
        extra_data["options"]["promoted"] = []

        try:
            if request.method == "POST":
                json_data = request.data
                # At least Python3.5 returns request.data as bytes
                # type instead of a string type.
                # Both Python2.7 and Python3.7 return a string type
                if type(json_data) == bytes:
                    json_data = json_data.decode("utf8")

                if json_data != "":
                    post_data = json.loads(json_data)
                    raw_promoted_guids = post_data.get("options", {}).get(
                        "promoted", []
                    )
                    promoted_guids = clean_promoted_guids(raw_promoted_guids)
                    extra_data["options"]["promoted"] = promoted_guids

        except Exception as e:
            jdata = {}
            jdata["results"] = []
            jdata["error"] = "Invalid JSON in POST: {}".format(e)
            return app.response_class(
                response=json.dumps(jdata, status=400, mimetype="application/json")
            )

        # Coerce the uuid.UUID type into a string
        client_id = str(hashed_client_id)

        locale = request.args.get("locale", None)
        if locale is not None:
            extra_data["locale"] = locale

        platform = request.args.get("platform", None)
        if platform is not None:
            extra_data["platform"] = platform

        recommendation_manager = check_proxy_manager(PROXY_MANAGER)
        recommendations = recommendation_manager.recommend(
            client_id=client_id, limit=TAAR_MAX_RESULTS, extra_data=extra_data
        )

        promoted_guids = extra_data.get("options", {}).get("promoted", [])
        recommendations = merge_promoted_guids(promoted_guids, recommendations)

        # Strip out weights from TAAR results to maintain compatibility
        # with TAAR 1.0
        jdata = {"results": [x[0] for x in recommendations]}

        response = app.response_class(
            response=json.dumps(jdata), status=200, mimetype="application/json"
        )
        return response

    def check_proxy_manager(PROXY_MANAGER):
        if PROXY_MANAGER.getResource() is None:
            ctx = default_context()
            profile_fetcher = ProfileFetcher(ctx)

            ctx["profile_fetcher"] = profile_fetcher

            # Lock the context down after we've got basic bits installed
            root_ctx = ctx.child()
            r_factory = recommenders.RecommenderFactory(root_ctx)
            root_ctx["recommender_factory"] = r_factory
            instance = recommenders.RecommendationManager(root_ctx.child())
            PROXY_MANAGER.setResource(instance)
        return PROXY_MANAGER.getResource()

    class MyPlugin:
        def set(self, config_options):
            """
            This setter is primarily so that we can instrument the
            cached RecommendationManager implementation under test.

            All plugins should implement this set method to enable
            overwriting configuration options with a TAAR library.
            """
            global PROXY_MANAGER
            if "PROXY_RESOURCE" in config_options:
                PROXY_MANAGER._resource = config_options["PROXY_RESOURCE"]

    return MyPlugin()
175495
private function loadServiceProvider()
    {
        \Tiga\Framework\Facade\Facade::setFacadeContainer($this);

        // Available Provider
        $providers = $this['config']->get('provider');

        $providers = array_unique($providers);

        foreach ($providers as $provider) {
            $instance = new $provider($this);
            $instance->register();
        }

        // Aliases
        $aliases = $this['config']->get('alias');

        $aliases = array_unique($aliases);

        $aliasMapper = \Tonjoo\Almari\AliasMapper::getInstance();

        $aliasMapper->classAlias($aliases);
    }
1277449
def load(self, callback=None, errback=None, reload=False):
        
        if not reload and self.data:
            raise AddressException('Address already loaded')

        def success(result, *args):
            self.data = result
            self.id = result['id']
            self.prefix = result['prefix']
            self.type = result['type']
            self.network = Network(self.config, id=result['network_id'])
            # self.scope_group = Scopegroup(config=self.config, id=result['scope_group_id']) NYI
            if self.type != 'host':
                self.report = self._rest.report(self.id)
                children = self._rest.retrieve_children(self.id)
                self.children = [Address(self.config, id=child['id']) for child in
                                 children if len(children) > 0]
            try:
                parent = self._rest.retrieve_parent(self.id)
                self.parent = Address(self.config, id=parent['id'])
            except ResourceException:
                pass
            if callback:
                return callback(self)
            else:
                return self

        if self.id is None:
            if self.prefix is None or self.type is None or self.network is None:
                raise AddressException('Must at least specify an id or prefix, type and network')
            else:
                network_id = self.network.id
                try:
                    self.id = [address for address in self._rest.list() if address['prefix'] == self.prefix and address[
                        'type'] == self.type and address['network_id'] == network_id][0]['id']
                except IndexError:
                    raise AddressException("Could not find address by prefix. It may not exist, or is a child address. "
                                           "Use the topmost parent prefix or specify ID")

        return self._rest.retrieve(self.id, callback=success,
                                   errback=errback)
166730
def load_module(name):
    

    spec = importlib.util.find_spec(name)
    mod = importlib.util.module_from_spec(spec)
    mod.__spec__ = spec
    mod.__loader__ = spec.loader
    spec.loader.exec_module(mod)
    return mod
1181536
function load() {
  if (!loaded) {
    var addons = [], skipped = [];

    // load addon modules
    api.require.forEach(['socketstream-*','socketstream.*'],function(mod,id) {
      if (typeof mod === 'function') {
        try {
          mod(api);
          addons.push(id);
        } catch(ex) {
          debug('Failed to load '+id+'. ',ex);
        }
      } else {
        skipped.push(id);
      }
    });
    debug('Addons: '+
      addons.length? addons.join(' + ') + ' Loaded. ':' None. '+
      skipped.length? skipped.join(' + ') + ' Skipped. ':'');

    // load assets in cache
    http.load();

    // Load Client Asset Manager
    client.load();

    // Load internal and project responders
    api.server.responders = exports.responders.load();

    api.server.eventTransport = publish.transport.load();

    // Extend the internal API with a publish object you can call from your own server-side code
    api.publish = publish.api(api.server.eventTransport);

    // Bind responders to websocket
    ws.load(api.server.responders, api.server.eventTransport);

    debug('API loaded.');
  }
  loaded = true;
}
1029037
def load(self, context):
    
    try:
      # pylint: disable=g-import-not-at-top,unused-import
      import tensorflow
    except ImportError:
      return
    # pylint: disable=g-import-not-at-top
    from tensorboard.plugins.beholder.beholder_plugin import BeholderPlugin
    return BeholderPlugin(context)
1322517
def load(self, updates):
        """"""
        # Go through in order and override the config (`.mbed_cloud_config.json` loader)
        for path in self.paths():
            if not path:
                continue
            abs_path = os.path.abspath(os.path.expanduser(path))
            if not os.path.isfile(abs_path):
                self._using_paths.append('missing: %s' % abs_path)
                continue
            self._using_paths.append(' exists: %s' % abs_path)
            with open(abs_path) as fh:
                self.update(json.load(fh))

        # New dotenv loader - requires explicit instructions to use current working directory
        load_dotenv(find_dotenv(usecwd=True))

        # Pluck config values out of the environment
        for env_var, key in {ENVVAR_API_HOST: 'host', ENVVAR_API_KEY: 'api_key'}.items():
            env_value = os.getenv(env_var)
            if env_value is not None:
                self[key] = env_value
        if updates:
            self.update(updates)
        self.validate()
753333
def load_module(self, module_name, path=None):
        ''''''
        self.ensure_started()
        if path is None:
            path = sys.path
        mod = self.client.call(_load_module, module_name, path)
        mod.__isolation_context__ = self
        return mod
1259136
def load_configuration(self):
        """"""
        filename = os.path.join(os.path.dirname(__file__), 'templates/spline-loc.yml.j2')
        with open(filename) as handle:
            return Adapter(safe_load(handle)).configuration
1197673
def load_from_config(self, config):
        """"""
        self.site = config.get("id", False)
        self.uri_base = config.get("uri_base", False)
        self.uris_to_crawl = self.crawlpage.get_uris(
            base_uri=self.uri_base,
            filter_list=config.get("crawl_uri_filters", None)
        )
        self.is_consume_page = self.crawlpage.has_selector(
            config.get("consume_selector", False)
        )
315249
def __load_configuration(self):
        
        handler_to_enable = filter(lambda h: h.keys is not None, handlers)
        for handler in handler_to_enable:
            if handler.name in self.kwargs:
                for k in handler.keys:
                    self.kwargs.update({k: True})

        self.config = self.configuration_class(self.app.config, **self.kwargs)
939973
def loadNetworkbyName(self, name, callback=None, errback=None):
        
        import ns1.ipam
        network = ns1.ipam.Network(self.config, name=name)
        return network.load(callback=callback, errback=errback)
1050013
def load_class(location: str) -> type:
    
    module_name, _, class_name = location.rpartition(".")

    if not module_name:
        raise ArcaMisconfigured(f"The module is not specified, can't load class from '{location}'")

    try:
        imported_module = importlib.import_module(module_name)
        return getattr(imported_module, class_name)
    except ModuleNotFoundError:
        raise ArcaMisconfigured(f"{module_name} does not exist.")
    except AttributeError:
        raise ArcaMisconfigured(f"{module_name} does not have a {class_name} class")