XXX: prune 1/N  each time
490090
protected void pruneCache() {
        final long expired = System.currentTimeMillis() - timeToLive;
        this.cacheMap.values().removeIf(entry -> entry.createTime < expired);
    }
377812
def Trim(lst, limit):
  
  limit = max(0, limit)

  clipping = lst[limit:]
  del lst[limit:]
  return clipping
1273000
def _xfs_prune_output(out, uuid):
    '''
    
    '''
    data = {}
    cnt = []
    cutpoint = False
    for line in [l.strip() for l in out.split("\n") if l]:
        if line.startswith("-"):
            if cutpoint:
                break
            else:
                cutpoint = True
                continue

        if cutpoint:
            cnt.append(line)

    for kset in [e for e in cnt[1:] if ':' in e]:
        key, val = [t.strip() for t in kset.split(":", 1)]
        data[key.lower().replace(" ", "_")] = val

    return data.get('uuid') == uuid and data or {}
653678
def prune_dupes(self):
        
        n = 0
        pruned1 = []
        seen = set()
        deletes = {}
        for r in reversed(self.resources):
            if (r.uri in seen):
                n += 1
                if (r.uri in deletes):
                    deletes[r.uri] = r.change
            else:
                pruned1.append(r)
                seen.add(r.uri)
                if (r.change == 'deleted'):
                    deletes[r.uri] = r.change
        # go through all deletes and prune if first was create
        pruned2 = []
        for r in reversed(pruned1):
            if (r.uri in deletes and deletes[r.uri] == 'created'):
                n += 1
            else:
                pruned2.append(r)
        self.resources = pruned2
        return(n)
152853
private void pruneIfNeeded(int neededSpace) {
        if ((mTotalSize + neededSpace) < mMaxCacheSizeInBytes) {
            return;
        }
        if (VolleyLog.DEBUG) {
            VolleyLog.v("Pruning old cache entries.");
        }

        long before = mTotalSize;
        int prunedFiles = 0;
        long startTime = System.currentTimeMillis();

        Iterator<Map.Entry<String, CacheHeader>> iterator = mEntries.entrySet().iterator();
        while (iterator.hasNext()) {
            Map.Entry<String, CacheHeader> entry = iterator.next();
            CacheHeader e = entry.getValue();
            boolean deleted = getFileForKey(e.key).delete();
            if (deleted) {
                mTotalSize -= e.size;
            } else {
               VolleyLog.d("Could not delete cache entry for key=%s, filename=%s",
                       e.key, getFilenameForKey(e.key));
            }
            iterator.remove();
            prunedFiles++;

            if ((mTotalSize + neededSpace) < mMaxCacheSizeInBytes * HYSTERESIS_FACTOR) {
                break;
            }
        }

        if (VolleyLog.DEBUG) {
            VolleyLog.v("pruned %d files, %d bytes, %d ms",
                    prunedFiles, (mTotalSize - before), System.currentTimeMillis() - startTime);
        }
    }
415142
def shrink (self):
        """"""
        trim = int(0.05*len(self))
        if trim:
            items = super(LFUCache, self).items()
            # sorting function for items
            keyfunc = lambda x: x[1][0]
            values = sorted(items, key=keyfunc)
            for item in values[0:trim]:
                del self[item[0]]
600763
def randomprune(self,n):
        """"""
        self.data = random.sample(self.data, n)
22992
def isolate_element(self, x):
        """"""
        members = list(self.members(x))
        self.delete_set(x)
        self.union(*(v for v in members if v != x))
1175612
def slice_by_size(seq, size):
    """"""
    filling = null
    for it in zip(*(itertools_chain(seq, [filling] * size),) * size):
        if filling in it:
            it = tuple(i for i in it if i is not filling)
        if it:
            yield it
378643
def ptake(n: int, xs: Iterable[T]) -> Iterable[T]:
    
    return tqdm(take(n, xs), total=n)
1089205
function prune (scripts) {
  return Object.keys(scripts).reduce((all, name) => {
    const s = scripts[name]
    if (!s.isPre && !s.isPost && !s.isExplicitSub) {
      all[name] = s
    }
    return all
  }, {})
}
968402
private /*@ helper @*/ void trimLeadingZeros() {
        int i = nWords;
        if (i > 0 && (data[--i] == 0)) {
            //for (; i > 0 && data[i - 1] == 0; i--) ;
            while(i > 0 && data[i - 1] == 0) {
                i--;
            }
            this.nWords = i;
            if (i == 0) { // all words are zero
                this.offset = 0;
            }
        }
    }
1195153
public function prune()
    {
        $args = func_get_args();
        $this->prunes = array_merge($this->prunes, $this->args_to_array($args));

        return $this;
    }
1109855
def prunebyscore(self, score, retainequalscore=False):
        """"""
        if retainequalscore:
            if self.minimize:
                f = lambda x: x[0] <= score
            else:
                f = lambda x: x[0] >= score
        else:
            if self.minimize:
                f = lambda x: x[0] < score
            else:
                f = lambda x: x[0] > score
        self.data = filter(f, self.data)
30362
public void prune() {
		if (children != null) {
			List<String> removeList = new ArrayList<String>();
			for (Entry<String, DepTreeNode> entry : children.entrySet()) {
				DepTreeNode child = entry.getValue();
				child.prune();
				if ((child.defineDependencies == null && child.requireDependencies == null && child.uri == null)
						&& (child.children == null || child.children.isEmpty())) {
					removeList.add(entry.getKey());
				}
			}
			for (String key : removeList) {
				children.remove(key);
			}
		}
	}
679672
def _every(times, step_size, index):
        
        current = index * step_size
        step = current // times * times
        reached = current >= step
        overshot = current >= step + step_size
        return current and reached and not overshot
401567
function(obj) {
        var pruned = {};
        _.each(obj, function(value, key) {
            if (!_.isUndefined(value) && !_.isNull(value)) {
                pruned[key] = value;
            }
        });

        return pruned;
    }