Returns a :class:`~werkzeug.local.LocalProxy` to the extension or service
        with ``name`` as registered with the current app.
329150
def get_local_proxy(self, name):
        
        def get_extension_or_service_by_name():
            if name in current_app.unchained.extensions:
                return current_app.unchained.extensions[name]
            elif name in current_app.unchained.services:
                return current_app.unchained.services[name]
            raise KeyError(f'No extension or service was found with the name {name}.')

        return LocalProxy(get_extension_or_service_by_name)
633091
def from_current(cls):
        
        if properties.application_id is None:
            raise context.ValueError("Not running inside a container")

        return cls(properties.appmaster_address,
                   properties.application_id,
                   security=Security.from_default())
1159036
def get_service_name_resources(cls, service_name):
        
        from django.apps import apps

        resources = cls._registry[service_name]['resources'].keys()
        return [apps.get_model(resource) for resource in resources]
1190771
def _register(self, name):
        
        templatehook = TemplateHook()
        self._registry[name] = templatehook
        return templatehook
1125280
def get_available_extension(name,
                            user=None,
                            host=None,
                            port=None,
                            maintenance_db=None,
                            password=None,
                            runas=None):
    '''
    

    '''
    return available_extensions(user=user,
                                host=host,
                                port=port,
                                maintenance_db=maintenance_db,
                                password=password,
                                runas=runas).get(name, None)
659613
def dot_mavproxy(name):
    ''''''
    dir = os.path.join(os.environ['HOME'], '.mavproxy')
    mkdir_p(dir)
    return os.path.join(dir, name)
401487
def get_app_instance(request):
    
    app = None
    if getattr(request, 'current_page', None) and request.current_page.application_urls:
        app = apphook_pool.get_apphook(request.current_page.application_urls)
    if app and app.app_config:
        try:
            config = None
            with override(get_language_from_request(request, check_path=True)):
                namespace = resolve(request.path_info).namespace
                config = app.get_config(namespace)
            return namespace, config
        except Resolver404:
            pass
    return '', None
701842
public <T> T getLocalExtension(Class<T> extensionType) {
        Object obj = extensions.get(extensionType);
        if (null != obj) {
            return extensionType.cast(obj);
        }
        return null;
    }
488260
def get_extension(self, protocol):
        
        if protocol not in self.registry:
            raise NoProtocolError("No protocol for %s" % protocol)
        index = self.registry[protocol]
        return self.extensions[index]
821928
def proxy(self) -> bool:
        
        if self.app is None:
            return False
        return bool(cast(Any, self.app).proxy)
515860
protected Class<?> getProxyClass() throws ClassNotFoundException {
        ClassLoader classLoader = getProxyClassLoader();
        return Class.forName(proxyClassName, false, classLoader);
    }
629448
def thread_local(name, default_value = nil)
      is_a?(Module) or raise TypeError, "receiver has to be a Module"

      name = name.to_s
      my_id = "__thread_local_#{__id__}__"

      ObjectSpace.define_finalizer(self, @@cleanup)

      define_method(name) do
        Thread.current[my_id] ||= {}
        Thread.current[my_id][name]
      end

      define_method("#{name}=") do |value|
        Thread.current[my_id] ||= {}
        Thread.current[my_id][name] = value
      end

      if default_value
        Thread.current[my_id] = {}
        Thread.current[my_id][name] = default_value
      end
      self
    end
66579
def access(self, name: str, rename: Optional[str] = None) -> 'ProxyAttr':
        
        self.getter(name, rename)
        self.setter(name, rename)
        return self
1359898
def _get_app(self, appname):
        
        try:
            app = APPS.get_app_config(appname)
        except Exception as e:
            self.err(e)
            return
        return app
609865
def app(session_id, app, bind, port):
    
    api_session = None
    runner = None

    async def app_setup():
        nonlocal api_session, runner
        loop = current_loop()
        api_session = AsyncSession()
        # TODO: generalize protocol using service ports metadata
        protocol = 'http'
        runner = ProxyRunner(api_session, session_id, app,
                             protocol, bind, port,
                             loop=loop)
        await runner.ready()
        print_info(
            "A local proxy to the application \"{0}\" ".format(app) +
            "provided by the session \"{0}\" ".format(session_id) +
            "is available at: {0}://{1}:{2}"
            .format(protocol, bind, port)
        )

    async def app_shutdown():
        nonlocal api_session, runner
        print_info("Shutting down....")
        await runner.close()
        await api_session.close()
        print_info("The local proxy to \"{}\" has terminated."
                   .format(app))

    asyncio_run_forever(app_setup(), app_shutdown(),
                        stop_signals={signal.SIGINT, signal.SIGTERM})
1270716
public Object getServiceFromProxy(TargetMetaDef targetMetaDef) {

    RemoteInvocationHandler handler = null;
    Object dynamicProxy = null;

    try {
      Debug.logVerbose("[JdonFramework] ---> create a new ProxyInstance", module);
      handler = new RemoteInvocationHandler(targetMetaDef);

      ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
      Class serviceClass = classLoader.loadClass(targetMetaDef.getClassName());

      dynamicProxy =
          Proxy.newProxyInstance(
          classLoader,
          new Class[] {serviceClass},
          handler);

    } catch (Exception ex) {
      ex.printStackTrace();
    }
    return dynamicProxy;

  }
258639
def stream_by_method_name(name):
    
    if name == u'local':
        name = u'parent'
    module = mitogen.core.import_module(u'mitogen.' + name)
    return module.Stream