Make lazy-init proxy function.
3175
def _mkprox(funcname):
    

    def prox(*args, **kwargs):
        _init()
        return getattr(_module, funcname)(*args, **kwargs)

    return prox
607337
def __init_object(self):
        """"""
        # Check to see if the user created a specific initalization function for this object.
        if self.init_function is not None:
            new_obj = self.init_function()
            self.__enqueue(new_obj)
        else:
            raise TypeError("The Pool must have a non None function to fill the pool.")
775140
def _lazily_initialize(self):
    """"""
    # TODO(nickfelt): remove on-demand imports once dep situation is fixed.
    import tensorflow.compat.v1 as tf
    with self._initialization_lock:
      if self._session:
        return
      graph = tf.Graph()
      with graph.as_default():
        self.initialize_graph()
      # Don't reserve GPU because libpng can't run on GPU.
      config = tf.ConfigProto(device_count={'GPU': 0})
      self._session = tf.Session(graph=graph, config=config)
1220759
def setup_proxy_model(self):
        """"""
        self.proxymodel = ProxyModel(self)
        self.proxymodel.setSourceModel(self.fsmodel)
1187586
def _create_class_proxy(cls, theclass):
        """"""

        def make_method(name):
            def method(self, *args, **kw):
                return getattr(object.__getattribute__(self, "_obj"), name)(*args, **kw)
            return method

        namespace = {}
        for name in cls._special_names:
            if hasattr(theclass, name):
                namespace[name] = make_method(name)
        return type("%s(%s)" % (cls.__name__, theclass.__name__), (cls,), namespace)
591345
function func_proxy_with_expire_index(name, func) {
  var orig = Base.prototype[name];

  Base.prototype[name] = function () {
    this.expireIndex();
    if (func) {
      func.apply(this, arguments);
    }
    orig.apply(this, arguments);
  };
}
1294401
function makeProxy(object) {
    if (((typeof(object) === 'object') && (!Array.isArray(object))) ||
        (typeof(object) === 'function')) {

      /* Only non-array objects and functions get proxied */
      var proxyId = messages.addProxy(object);
      var definition = defineProxy(object);
      return { proxy: { id: proxyId, definition: definition }};

    } else {

      /* Arrays and normal objects go through as values */
      return { resolve: object };
    }
  }
356682
protected static void lazyInit() {
        // noinspection DoubleCheckedLocking
        if (instance == null) {
            try {
                STARTUP_LOCK.lockInterruptibly();
                try {
                    if (instance == null) {
                        instance = new ProviderUtil();
                    }
                } finally {
                    STARTUP_LOCK.unlock();
                }
            } catch (final InterruptedException e) {
                LOGGER.fatal("Interrupted before Log4j Providers could be loaded.", e);
                Thread.currentThread().interrupt();
            }
        }
    }
578640
def lazy(func):
    
    try:
        frame = sys._getframe(1)
    except Exception:
        _locals = None
    else:
        _locals = frame.f_locals
    func_name = func.func_name if six.PY2 else func.__name__
    return LazyStub(func_name, func, _locals)
834765
function proxy (original, routes) {
  return new Proxy(original, {
    get(target, key, receiver) {
      const method = target[key]
      if (method) return method
      else return function (path, ...args) {
        const cb = args[0]
        if (typeof cb === 'function') {
          original.add(key, path, cb)
        } else {
          const fn = routes[key]
          return fn && fn.exec(path, ...args)
        }
      }
    }
  })
}
1086475
function mapIntoProxyObject(err, files) {
        if (err) {
            return callback(err)
        }
        files.filter(isFileFunction).forEach(addToProxyObject)
        callback(null, proxyObject)
    }
339599
def _create_proxy(proxy_setting):
        """"""
        proxy = QNetworkProxy()
        proxy_scheme = proxy_setting['scheme']
        proxy_host = proxy_setting['host']
        proxy_port = proxy_setting['port']
        proxy_username = proxy_setting['username']
        proxy_password = proxy_setting['password']
        proxy_scheme_host = '{0}://{1}'.format(proxy_scheme, proxy_host)
        proxy.setType(QNetworkProxy.HttpProxy)

        if proxy_scheme_host:
            # proxy.setHostName(proxy_scheme_host)  # does not work with scheme
            proxy.setHostName(proxy_host)

        if proxy_port:
            proxy.setPort(proxy_port)

        if proxy_username:
            proxy.setUser(proxy_username)

        if proxy_password:
            proxy.setPassword(proxy_password)

        return proxy
1161301
def _proxy(method):
    
    @functools.wraps(method)
    def memoizer(self, context):
        return method(context)

    return memoizer
656963
def init_submodules(self, cache):
    """"""
    self.cache = CacheService(cache, weakref.proxy(self)) 
    self.mesh = PrecomputedMeshService(weakref.proxy(self))
    self.skeleton = PrecomputedSkeletonService(weakref.proxy(self))
406745
function proxy() {
    // cannot re-use cmd, modifiying breaks subsequent
    // method invocations must use a local variable
    var name = cmd
      , args = [].slice.call(arguments)
      , cb;

    if(typeof args[args.length - 1] === 'function') {
      cb = args.pop();
    }
    this.execute(cmd, args, cb);
    return this;
  }
230280
def init(opts):
    '''
    
    '''
    proxy_dict = opts.get('proxy', {})
    opts['multiprocessing'] = proxy_dict.get('multiprocessing', False)
    netmiko_connection_args = proxy_dict.copy()
    netmiko_connection_args.pop('proxytype', None)
    netmiko_device['always_alive'] = netmiko_connection_args.pop('always_alive',
                                                                 opts.get('proxy_always_alive', True))
    try:
        connection = ConnectHandler(**netmiko_connection_args)
        netmiko_device['connection'] = connection
        netmiko_device['initialized'] = True
        netmiko_device['args'] = netmiko_connection_args
        netmiko_device['up'] = True
        if not netmiko_device['always_alive']:
            netmiko_device['connection'].disconnect()
    except NetMikoTimeoutException as t_err:
        log.error('Unable to setup the netmiko connection', exc_info=True)
    except NetMikoAuthenticationException as au_err:
        log.error('Unable to setup the netmiko connection', exc_info=True)
    return True
502239
def __init(self):
        
        params = {
            "f" : "json",
        }
        json_dict = self._get(self._url, params,
                                 securityHandler=self._securityHandler,
                                 proxy_url=self._proxy_url,
                                 proxy_port=self._proxy_port)
        self._json_dict = json_dict
        self._json = json.dumps(self._json_dict)
        attributes = [attr for attr in dir(self)
                      if not attr.startswith('__') and \
                      not attr.startswith('_')]

        for k,v in json_dict.items():
            if k in attributes:
                if k == "routeLayers" and json_dict[k]:
                    self._routeLayers = []
                    for rl in v:
                        self._routeLayers.append(
                            RouteNetworkLayer(url=self._url + "/%s" % rl,
                                              securityHandler=self._securityHandler,
                                              proxy_url=self._proxy_url,
                                              proxy_port=self._proxy_port,
                                              initialize=False))

                elif k == "serviceAreaLayers" and json_dict[k]:
                    self._serviceAreaLayers = []
                    for sal in v:
                        self._serviceAreaLayers.append(
                            ServiceAreaNetworkLayer(url=self._url + "/%s" % sal,
                                                    securityHandler=self._securityHandler,
                                                    proxy_url=self._proxy_url,
                                                    proxy_port=self._proxy_port,
                                                    initialize=False))

                elif k == "closestFacilityLayers" and json_dict[k]:
                    self._closestFacilityLayers = []
                    for cf in v:
                        self._closestFacilityLayers.append(
                            ClosestFacilityNetworkLayer(url=self._url + "/%s" % cf,
                                                    securityHandler=self._securityHandler,
                                                    proxy_url=self._proxy_url,
                                                    proxy_port=self._proxy_port,
                                                    initialize=False))
                else:
                    setattr(self, "_"+ k, v)
            else:
                print ("attribute %s is not implemented." % k)