to be used with lazyor
765581
protected void repairAfterLazy() {
    for (int k = 0; k < highLowContainer.size(); ++k) {
      Container c = highLowContainer.getContainerAtIndex(k);
      highLowContainer.setContainerAtIndex(k, c.repairAfterLazy());
    }
  }
269639
def lazy_val(func, with_del_hook=False):
    '''
    '''

    def hook_for(that):
        try:
            orig_del = that.__del__
        except AttributeError:
            orig_del = None

        def del_hook(*args, **kwargs):
            del that._cache[id(that)]
            del that._del_hook_cache[id(that)]
            if orig_del is not None:
                orig_del(that, *args, **kwargs)

        try:
            if orig_del is not None:
                that.__del__ = del_hook
        except AttributeError:
            # that.__del__ is a class property and cannot be changed by instance
            orig_del = None
        return del_hook

    def add_to_del_hook_cache(that):
        if with_del_hook:
            try:
                that._del_hook_cache[id(that)] = hook_for(that)
            except AttributeError:
                # when that._del_hook_cache not exists, it means it is not a
                # class property.  Then, we don't need a del_hook().
                pass

    @functools.wraps(func)
    def get(self):
        try:
            return self._cache[id(self)][func]
        except AttributeError:
            self._cache = {id(self): {}, }
            add_to_del_hook_cache(self)
        except KeyError:
            try:
                self._cache[id(self)]
            except KeyError:
                self._cache[id(self)] = {}
                add_to_del_hook_cache(self)
        val = self._cache[id(self)][func] = func(self)
        return val

    return property(get)
329670
def prepare_lazy_data(content, functions_mapping=None, check_variables_set=None, cached=False):
    
    # TODO: refactor type check
    if content is None or isinstance(content, (numeric_types, bool, type)):
        return content

    elif isinstance(content, (list, set, tuple)):
        return [
            prepare_lazy_data(
                item,
                functions_mapping,
                check_variables_set,
                cached
            )
            for item in content
        ]

    elif isinstance(content, dict):
        parsed_content = {}
        for key, value in content.items():
            parsed_key = prepare_lazy_data(
                key,
                functions_mapping,
                check_variables_set,
                cached
            )
            parsed_value = prepare_lazy_data(
                value,
                functions_mapping,
                check_variables_set,
                cached
            )
            parsed_content[parsed_key] = parsed_value

        return parsed_content

    elif isinstance(content, basestring):
        # content is in string format here
        if not is_var_or_func_exist(content):
            # content is neither variable nor function
            # replace $$ notation with $ and consider it as normal char.
            # e.g. abc => abc, abc$$def => abc$def, abc$$$$def$$h => abc$$def$h
            return content.replace("$$", "$")

        functions_mapping = functions_mapping or {}
        check_variables_set = check_variables_set or set()
        content = content.strip()
        content = LazyString(content, functions_mapping, check_variables_set, cached)

    return content
336533
public <E extends Model> LazyList<E> load() {
        if (hydrated()) { throw new DBException("load() must be the last on the chain of methods"); }
        hydrate();
        return (LazyList<E>) this;
    }
482016
def all(self, lazy=False):
        
        return self.query_cls(self).build_ast()._execute(lazy)
727717
def collection(*params, &parser)
      LazyCollection.new(
        @client,
        host,
        path,
        merged_params(*params),
        &parser
      )
    end
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)
1020466
synchronized void activateLazily() {
        if (cacheManager != null)
            return; // lazy initialization has already completed

        final boolean trace = TraceComponent.isAnyTracingEnabled();
        
        Properties vendorProperties = new Properties();
        
        String uriValue = (String) configurationProperties.get("uri");
        final URI uri;
        if (uriValue != null)
            try {
                uri = new URI(uriValue);
            } catch (URISyntaxException e) {
                throw new IllegalArgumentException(Tr.formatMessage(tc, "INCORRECT_URI_SYNTAX", e), e);
            }
        else
            uri = null;
        
        for (Map.Entry<String, Object> entry : configurationProperties.entrySet()) {
            String key = entry.getKey();
            Object value = entry.getValue();

            //properties start with properties.0.
            if (key.length () > TOTAL_PREFIX_LENGTH && key.charAt(BASE_PREFIX_LENGTH) == '.' && key.startsWith(BASE_PREFIX)) {
                key = key.substring(TOTAL_PREFIX_LENGTH);
                if (!key.equals("config.referenceType")) 
                    vendorProperties.setProperty(key, (String) value);
            }
        }

        // load JCache provider from configured library, which is either specified as a libraryRef or via a bell
        final ClassLoader cl = library.getClassLoader();

        try {
            AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
                ClassLoader loader = new CachingProviderClassLoader(cl);

                if (trace && tc.isDebugEnabled())
                    CacheHashMap.tcInvoke("Caching", "getCachingProvider", loader);

                cachingProvider = Caching.getCachingProvider(loader);

                tcCachingProvider = "CachingProvider" + Integer.toHexString(System.identityHashCode(cachingProvider));

                if (trace && tc.isDebugEnabled()) {
                    CacheHashMap.tcReturn("Caching", "getCachingProvider", tcCachingProvider, cachingProvider);
                    Tr.debug(this, tc, "caching provider class is " + cachingProvider.getClass().getName());
                    CacheHashMap.tcInvoke(tcCachingProvider, "getCacheManager", uri, null, vendorProperties);
                }

                cacheManager = cachingProvider.getCacheManager(uri, null, vendorProperties);

                return null;
            });

            tcCacheManager = "CacheManager" + Integer.toHexString(System.identityHashCode(cacheManager));

            if (trace && tc.isDebugEnabled()) {
                CacheHashMap.tcReturn(tcCachingProvider, "getCacheManager", tcCacheManager, cacheManager);
                CacheHashMap.tcInvoke(tcCachingProvider, "isSupported", "STORE_BY_REFERENCE");
            }

            supportsStoreByReference = cachingProvider.isSupported(OptionalFeature.STORE_BY_REFERENCE);

            if (trace && tc.isDebugEnabled())
                CacheHashMap.tcReturn(tcCachingProvider, "isSupported", supportsStoreByReference);
        } catch (CacheException x) {
            if (library.getFiles().isEmpty()) {
                Tr.error(tc, "ERROR_CONFIG_EMPTY_LIBRARY", library.id(), Tr.formatMessage(tc, "SESSION_CACHE_CONFIG_MESSAGE", RuntimeUpdateListenerImpl.sampleConfig));
            }
            throw x;
        } catch (Error | RuntimeException x) {
            // deactivate will not be invoked if activate fails, so ensure CachingProvider is closed on error paths
            if (cachingProvider != null) {
                CacheHashMap.tcInvoke(tcCachingProvider, "close");
                cachingProvider.close();
                CacheHashMap.tcReturn(tcCachingProvider, "close");
            }
            throw x;
        }
    }
580929
@Override
    public <G> Lazy<Choice6<A, B, C, D, E, G>> lazyZip(
            Lazy<? extends Applicative<Function<? super F, ? extends G>, Choice6<A, B, C, D, E, ?>>> lazyAppFn) {
        return match(a -> lazy(a(a)),
                     b -> lazy(b(b)),
                     c -> lazy(c(c)),
                     d -> lazy(d(d)),
                     e -> lazy(e(e)),
                     f -> lazyAppFn.fmap(choiceFn -> choiceFn.<G>fmap(fn -> fn.apply(f)).coerce()));
    }
935853
private Map<Object, Object> lazyProperties() {
        if (properties == null) {
            properties = new HashMap<Object, Object>();
        }
        return properties;
    }
146825
public Iterator<Map.Entry<FieldDescriptorType, Object>> iterator() {
    if (hasLazyField) {
      return new LazyIterator<FieldDescriptorType>(
          fields.entrySet().iterator());
    }
    return fields.entrySet().iterator();
  }
74851
function lazyVisitChildren(len, children, i, f, k) {
    while (i < len) {
        var child = children[i++];
        if (child && !isEmptyNode(child)) return lazyVisit(child, f, [len, children, i, f, k]);
    }
    return appk(k);
}
786504
private void lazyLoad()
  {
    if (_major > 0)
      return;

    try {
      if (_url == null)
        throw new IllegalStateException();
      
      try (InputStream is = _url.openStream()) {
      //ReadStream rs = VfsOld.openRead(is);
        _major = 1;

        ByteCodeParser parser = new ByteCodeParser();
        parser.setClassLoader(_loader);
        parser.setJavaClass(this);

        parser.parse(is);
      }
    } catch (RuntimeException e) {
      throw e;
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
19699
public static LazyElement parse(String str) throws LazyException{
		int index=0;
		while(index<str.length()){
			char ch=str.charAt(index);
			if(ch=='['){
				return new LazyArray(str);
			}
			if(ch=='{'){
				return new LazyObject(str);
			}
			index++;
		}
		throw new LazyException("The given string is not a JSON object or array");
	}
513637
@Override
    public <B> Lazy<Compose<F, G, B>> lazyZip(
            Lazy<? extends Applicative<Function<? super A, ? extends B>, Compose<F, G, ?>>> lazyAppFn) {
        @SuppressWarnings("RedundantTypeArguments")
        Lazy<Applicative<Applicative<Function<? super A, ? extends B>, G>, F>> lazyAppFnCoerced =
                lazyAppFn
                        .<Compose<F, G, Function<? super A, ? extends B>>>fmap(
                                Applicative<Function<? super A, ? extends B>, Compose<F, G, ?>>::coerce)
                        .fmap(Compose<F, G, Function<? super A, ? extends B>>::getCompose);

        return fga.<Applicative<A, G>>fmap(upcast())
                .<Applicative<B, G>>lazyZip(lazyAppFnCoerced.fmap(fgf -> fgf.fmap(gf -> ga -> ga.zip(gf))))
                .fmap(Compose::new);
    }
448227
function lazyProduct(sets, f, context){
        if (!context){
          context=this;
        }

        var p = [];
        var max = sets.length-1;
        var lens = [];

        for (var i=sets.length;i--;) {
          lens[i] = sets[i].length;
        }

        function dive(d){
          var a = sets[d];
          var len = lens[d];

          if (d === max) {
            for (var i=0;i<len;++i) {
              p[d] = a[i];
              f.apply(context, p);
            }
          } else {
            for (var i=0;i<len;++i) {
              p[d]=a[i];
              dive(d+1);
            }
          }

          p.pop();
        }

        dive(0);
      }
1059479
private static synchronized void lazyInit() {
		if (registry==null) {
			InputStream isXml = ProteinModification.class.getResourceAsStream(DIR_XML_PTM_LIST);
			lazyInit(isXml);
		}
	}