List of :class:`Application` for this :class:`MultiApp`.

        The list is lazily loaded from the :meth:`build` method.
174744
def apps(self):
        
        if self._apps is None:
            # Add modified settings values to the list of cfg params
            self.cfg.params.update(((s.name, s.value) for s in
                                    self.cfg.settings.values() if s.modified))
            self.cfg.settings = {}
            self._apps = OrderedDict()
            self._apps.update(self._build())
            if not self._apps:
                return []
            # Load the configuration (command line and config file)
            self.load_config()
            kwargs = self._get_app_params()
            apps = self._apps
            self._apps = []
            for App, name, callable, cfg in self._iter_app(apps):
                settings = self.cfg.settings
                new_settings = {}
                for key in cfg:
                    setting = settings[key].copy()
                    if setting.orig_name and setting.orig_name != setting.name:
                        setting.name = setting.orig_name
                    new_settings[setting.name] = setting
                cfg.settings = new_settings
                kwargs.update({'name': name, 'cfg': cfg, 'callable': callable})
                if name == self.name:
                    params = kwargs.copy()
                    params['version'] = self.version
                else:
                    params = kwargs
                self._apps.append(App(**params))
        return self._apps
133445
def _app(self):
        
        if self.app is not None:
            return self.app

        ctx = _request_ctx_stack.top
        if ctx is not None:
            return ctx.app

        try:
            from flask import _app_ctx_stack
            app_ctx = _app_ctx_stack.top
            if app_ctx is not None:
                return app_ctx.app
        except ImportError:
            pass

        raise RuntimeError('assets instance not bound to an application, '+
                            'and no application in current context')
49627
def init_app(self, app):
        
        self.init_extension(app)

        if not hasattr(app, 'extensions'):
            app.extensions = {}
        classname = self.__class__.__name__
        extname = classname.replace('Flask', '').lower()
        app.extensions[extname] = self
901882
def _lazy_load_get_model():
    
    if django is None:
        def _get_model(app, model):
            raise import_failure
    else:
        from django import apps as django_apps
        _get_model = django_apps.apps.get_model
    _LAZY_LOADS['get_model'] = _get_model
444534
def build_all(cls, list_of_kwargs):
        
        return cls.add_all([
            cls.new(**kwargs) for kwargs in list_of_kwargs], commit=False)
1256254
def get_applications():
        
        LOGGER.debug("ApplicationService.get_applications")
        args = {'http_operation': 'GET', 'operation_path': ''}
        response = ApplicationService.requester.call(args)
        ret = None
        if response.rc == 0:
            ret = []
            for application in response.response_content['applications']:
                ret.append(Application.json_2_application(application))
        elif response.rc != 404:
            err_msg = 'ApplicationService.get_applications - Problem while getting applications. ' \
                      'Reason: ' + str(response.response_content) + '-' + str(response.error_message) + \
                      " (" + str(response.rc) + ")"
            LOGGER.warning(err_msg)
        return ret
26702
def list_built_in_as_lazy(custom_headers:nil)
      response = list_built_in_async(custom_headers:custom_headers).value!
      unless response.nil?
        page = response.body
        page.next_method = Proc.new do |next_page_link|
          list_built_in_next_async(next_page_link, custom_headers:custom_headers)
        end
        page
      end
    end
598676
public ClassLoader getRealAppClassLoader(Application application) {
        try {
            List<CDIArchive> moduleArchives = new ArrayList<CDIArchive>(application.getModuleArchives());
            if (moduleArchives.isEmpty()) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, Util.identity(this), "Application {0} has no modules so no thread context class loader will be set, this is expected for an OSGI app.",
                             application);
                }
                return null;
            }
            if (moduleArchives.size() == 1 && ArchiveType.WEB_MODULE == moduleArchives.get(0).getType()) {
                return moduleArchives.get(0).getClassLoader();
            }

            return application.getClassLoader();
        } catch (CDIException e) {
            return null;
        }
    }
37853
def _build_app_models(request, admin_apps, models_tuples, ensure_all_models=False):
    

    app_models = []
    for app_and_model, config in models_tuples:
        if app_and_model:
            app_label, model_name = app_and_model.split('.')

            for app in admin_apps:
                if app['app_label'] == app_label:
                    for model in app['models']:
                        if model['object_name'] == model_name:
                            try:
                                model['name'] = \
                                    config['name']
                            except KeyError:
                                pass

                            # Get each of the polymorphic types to allow addition.
                            model_class = apps.get_model(app_and_model)
                            model_admin = admin.site._registry[model_class]

                            if hasattr(model_admin, 'get_child_type_choices'):
                                model['polymorphic_classes'] = \
                                    model_admin.get_child_type_choices(
                                        request, 'add'
                                    )

                            # TODO: Fluent/polymorphic has a way of sorting child order which should be used instead
                            if 'default_poly_child' in config.keys():
                                ct = ContentType.objects.get_by_natural_key(
                                    *config['default_poly_child'].lower().split('.')
                                )
                                model.default_poly_child = ct.id

                            app_models.append(model)

                    break

    return app_models
1061799
def _list(self, uri, obj_class=None, body=None, return_raw=False,
            other_keys=None):
        
        if body:
            resp, resp_body = self.api.method_post(uri, body=body)
        else:
            resp, resp_body = self.api.method_get(uri)
        if return_raw:
            return (resp, resp_body)
        if obj_class is None:
            obj_class = self.resource_class

        data = self._data_from_response(resp_body)
        ret = [obj_class(self, res, loaded=False) for res in data if res]
        if other_keys:
            keys = utils.coerce_to_list(other_keys)
            other = [self._data_from_response(resp_body, key) for key in keys]
            return (ret, other)
        else:
            return ret
194717
def _build_stack(self) -> List[Callable]:
        

        stack = []

        for m in self.manager.middlewares:
            try:
                stack.append(getattr(m(self), self.name))
            except AttributeError:
                pass

        return stack
127407
def hasApplication(self, app):
        
        if self._applications is None:
            self._initApplicationList()
        return app in self._applications
422803
def applications(self):
        """"""
        url = self._url + "/applications"
        params = {"f" : "json"}
        res = self._get(url=url,
                           param_dict=params,
                           proxy_url=self._proxy_url,
                           proxy_port=self._proxy_port)
        items = []
        if "applications" in res.keys():
            for apps in res['applications']:
                items.append(
                    self.Application(url="%s/%s" % (self._url, apps['username']),
                                     securityHandler=self._securityHandler,
                                     proxy_url=self._proxy_url,
                                     proxy_port=self._proxy_port)
                )
        return items
809266
@Override
	public Collection<Instance> getInstanceList() throws Exception {
		List<Instance> instances = new ArrayList<>();
		List<String> appNames = getApplications();
		if (appNames == null || appNames.size() == 0) {
			log.info("No apps configured, returning an empty instance list");
			return instances;
		}
		log.info("Fetching instance list for apps: " + appNames);
		for (String appName : appNames) {
			try {
				instances.addAll(getInstancesForApp(appName));
			}
			catch (Exception ex) {
				log.error("Failed to fetch instances for app: " + appName
						+ ", retrying once more", ex);
				try {
					instances.addAll(getInstancesForApp(appName));
				}
				catch (Exception retryException) {
					log.error("Failed again to fetch instances for app: " + appName
							+ ", giving up", ex);
				}
			}
		}
		return instances;
	}
904960
def load_application_files
      if %w(development test).include?(env.to_s)
        config['autoload_paths'].each(&method(:autoreload_constants))
        autoreload_yml
      end
      config['autoload_paths'].each(&method(:require_dependencies))
    end
724401
def get_apps(self):
        
        templates = []
        for app in settings.INSTALLED_APPS:
            try:
                app = import_module(app + '.emails')
                templates += self.get_plugs_mail_classes(app)
            except ImportError:
                pass
        return templates
711599
def _build_superclass_lists(self):
        
        cls_dict = self.all_classes
        for cls in list(cls_dict.values()):
            cls.all_superclasses = []
            superclass = cls.superclass
            try:
                while superclass:
                    superclass_obj = cls_dict[superclass]
                    cls.all_superclasses.append(superclass_obj)
                    superclass = superclass_obj.superclass
            except KeyError:
                print("Missing superclass: " + superclass)