return : returns a tuple (num_of_not_None_caches, [list of unset caches endpoint])
494214
def get_unset_cache(self):
        
        caches = []
        if self._cached_api_global_response is None:
            caches.append('global')
        if self._cached_api_ticker_response is None:
            caches.append('ticker')
        return (len(caches), caches)
413976
def _not_none(items):
    """"""
    if not isinstance(items, (tuple, list)):
        items = (items,)
    return all(item is not _none for item in items)
1068739
def do_not_cache():
    

    from . import index  # pylint: disable=cyclic-import

    if index.in_progress():
        # We are reindexing the site
        return True

    if request.if_none_match or request.if_modified_since:
        # we might be returning a 304 NOT MODIFIED based on a client request,
        # and we don't want to cache that as the result for *all* client
        # requests to this URI
        return True

    return False
917880
def get_cached(self):
        '''
        
        '''
        msg = self.serial.dumps('minions')
        self.creq_out.send(msg)
        min_list = self.serial.loads(self.creq_out.recv())
        return min_list
179089
def get_unspents(self):
        
        self.unspents[:] = list(map(
            lambda u: u.set_type('p2pkh' if self.is_compressed() else
                                 'p2pkh-uncompressed'),
            NetworkAPI.get_unspent(self.address)
        ))
        if self.segwit_address:
            self.unspents += list(map(
                lambda u: u.set_type('np2wkh'),
                NetworkAPI.get_unspent(self.segwit_address)
            ))
        self.balance = sum(unspent.amount for unspent in self.unspents)
        return self.unspents
475075
def set_to_cache(self):
        
        queryset = self.get_queryset()
        cache.set(self._get_cache_key(), {
            'queryset':
                [
                    queryset.none(),
                    queryset.query,
                ],
            'cls': self.__class__,
            'search_fields': tuple(self.search_fields),
            'max_results': int(self.max_results),
            'url': str(self.get_url()),
            'dependent_fields': dict(self.dependent_fields),
        })
52614
def uncache(self):
        
        if self.mode == 'spark':
            self.values.unpersist()
            return self
        else:
            notsupported(self.mode)
403730
def _clear_ignore(endpoint_props):
    '''
    
    '''
    return dict(
        (prop_name, prop_val)
        for prop_name, prop_val in six.iteritems(endpoint_props)
        if prop_name not in _DO_NOT_COMPARE_FIELDS and prop_val is not None
    )
384060
def nonull_dict(self):
        
        return {k: v for k, v in six.iteritems(self.dict) if v and k != '_codes'}
1157798
def as_dict(self, cache=None, fetch=True):
        
        if not self._fetched and fetch:
            info = self.fetch(cache)
        elif self._use_cache(cache):
            info = self._attrs.copy()
        else:
            info = {}
        info.update(url=self.url)
        return info
184794
def _memoize_cache_key(args, kwargs):
    
    cache_key_list = []

    # hack to get around the unhashability of lists,
    # add a special case to convert them to tuples
    for arg in args:
        if type(arg) is list:
            cache_key_list.append(tuple(arg))
        else:
            cache_key_list.append(arg)
    for (k, v) in sorted(kwargs.items()):
        if type(v) is list:
            cache_key_list.append((k, tuple(v)))
        else:
            cache_key_list.append((k, v))
    return tuple(cache_key_list)
1263471
def cache(self, name='cache', default_timeout=3600):
        
        return Cache(self, name=name, default_timeout=default_timeout)
941028
def _init_caches(self):
        from collections import defaultdict
        from .cache import Cache, NodesCache, EdgesCache
        self._where_cached = defaultdict(list)
        self._global_cache = self.query._global_cache = {}
        self._node_objs = node_objs = WeakValueDictionary()
        self._get_node_stuff = (node_objs, self._node_exists, self._make_node)
        self._edge_objs = edge_objs = WeakValueDictionary()
        self._get_edge_stuff = (edge_objs, self._edge_exists, self._make_edge)
        for k, v in self.query.global_items():
            if k == 'branch':
                self._obranch = v
            elif k == 'turn':
                self._oturn = int(v)
            elif k == 'tick':
                self._otick = int(v)
            else:
                self._global_cache[k] = v
        self._childbranch = defaultdict(set)
        """"""
        self._branches = {}
        """Start time, end time, and parent of each branch"""
        self._branch_parents = defaultdict(set)
        """Parents of a branch at any remove"""
        self._turn_end = defaultdict(lambda: 0)
        """Tick on which a (branch, turn) ends"""
        self._turn_end_plan = defaultdict(lambda: 0)
        """Tick on which a (branch, turn) ends, even if it hasn't been simulated"""
        self._graph_objs = {}
        self._plans = {}
        self._branches_plans = defaultdict(set)
        self._plan_ticks = defaultdict(lambda: defaultdict(list))
        self._time_plan = {}
        self._plans_uncommitted = []
        self._plan_ticks_uncommitted = []
        self._graph_val_cache = Cache(self)
        self._graph_val_cache.setdb = self.query.graph_val_set
        self._graph_val_cache.deldb = self.query.graph_val_del_time
        self._nodes_cache = NodesCache(self)
        self._nodes_cache.setdb = self.query.exist_node
        self._nodes_cache.deldb = self.query.nodes_del_time
        self._edges_cache = EdgesCache(self)
        self._edges_cache.setdb = self.query.exist_edge
        self._edges_cache.deldb = self.query.edges_del_time
        self._node_val_cache = Cache(self)
        self._node_val_cache.setdb = self.query.node_val_set
        self._node_val_cache.deldb = self.query.node_val_del_time
        self._edge_val_cache = Cache(self)
        self._edge_val_cache.setdb = self.query.edge_val_set
        self._edge_val_cache.deldb = self.query.edge_val_del_time
27903
def GetCacheSize(self):
    
    if not self._cache_start_offset or not self._cache_end_offset:
      return 0
    return self._cache_end_offset - self._cache_start_offset
765851
def get_values(self):
		
		return [self._cache.get(i.name,None) for i in self._original_evals]
1260621
def reset(self, force_flush_cache: bool = False) -> None:
        
        super(LDAPwrapper, self).reset()
        if len(self._transactions) == 0:
            raise RuntimeError("reset called outside a transaction.")
        self._transactions[-1] = []
322603
def _weak_lru_cache(maxsize=100):
    
    def decorating_function(
            user_function, tuple=tuple, sorted=sorted, len=len,
            KeyError=KeyError):

        hits, misses = [0], [0]
        kwd_mark = (object(),)    # separates positional and keyword args
        lock = Lock()             # needed because OrderedDict isn't threadsafe

        if maxsize is None:
            cache = _WeakArgsDict()  # cache without ordering or size limit

            @wraps(user_function)
            def wrapper(*args, **kwds):
                key = args
                if kwds:
                    key += kwd_mark + tuple(sorted(kwds.items()))
                try:
                    result = cache[key]
                    hits[0] += 1
                    return result
                except KeyError:
                    pass
                result = user_function(*args, **kwds)
                cache[key] = result
                misses[0] += 1
                return result
        else:
            # ordered least recent to most recent
            cache = _WeakArgsOrderedDict()
            cache_popitem = cache.popitem
            cache_renew = cache.move_to_end

            @wraps(user_function)
            def wrapper(*args, **kwds):
                key = args
                if kwds:
                    key += kwd_mark + tuple(sorted(kwds.items()))
                with lock:
                    try:
                        result = cache[key]
                        cache_renew(key)    # record recent use of this key
                        hits[0] += 1
                        return result
                    except KeyError:
                        pass
                result = user_function(*args, **kwds)
                with lock:
                    cache[key] = result     # record recent use of this key
                    misses[0] += 1
                    if len(cache) > maxsize:
                        # purge least recently used cache entry
                        cache_popitem(False)
                return result

        def cache_info():
            """Report cache statistics"""
            with lock:
                return hits[0], misses[0], maxsize, len(cache)

        def cache_clear():
            """Clear the cache and cache statistics"""
            with lock:
                cache.clear()
                hits[0] = misses[0] = 0

        wrapper.cache_info = cache_info
        wrapper.cache_clear = cache_clear
        return wrapper

    return decorating_function