Returns n evenly spaced items
357624
def spaced_items(list_, n, **kwargs):
    
    indexes = spaced_indexes(len(list_), n, **kwargs)
    items = list_[indexes]
    return items
844439
def make_data(n,m):
    """"""
    I = range(1,n+1)
    J = range(1,m+1)
    x,y,w = {},{},{}
    for i in I:
        x[i] = random.randint(0,100)
        y[i] = random.randint(0,100)
        w[i] = random.randint(1,5)
    return I,J,x,y,w
141372
def items(cls):
        
        return [
            cls.GREATER_THAN,
            cls.GREATER_THAN_EQUAL,
            cls.LESS_THAN,
            cls.LESS_THAN_EQUAL,
            cls.EQUAL,
            cls.NOT_EQUAL
        ]
903009
def chunks(items, size):
    
    return [items[i:i+size] for i in range(0, len(items), size)]
1062197
def chunks(data, n):
    """"""
    for i in range(0, len(data), n):
        yield data[i:i+n]
591355
def partition_horizontal(thelist, n):
    
    try:
        n = int(n)
        thelist = list(thelist)
    except (ValueError, TypeError):
        return [thelist]
    newlists = [list() for i in range(int(ceil(len(thelist) / float(n))))]
    for i, val in enumerate(thelist):
        newlists[i/n].append(val)
    return newlists
877454
def limit(self, n):
    
    data = self._data
    self._data = (next(data) for _ in xrange(int(round(n))))
    return self
439764
function fitWidth(s, len)
{
    s = s.trim();
    if(s.length <= len) return [s];

    var result = [];
    while(s.length > len)
    {
        var i = len
        for(; s[i] != ' ' && i >= 0; i--) 
            /* empty loop */ ;

        if(i == -1)
        {
            for(i = len + 1; s[i] != ' ' && i < s.length; i++) 
                /* empty loop */ ;
            
            if(i == s.length)
            {
                result.push(s);
                return result;
            }
        }
        result.push(s.substr(0, i));
        s = s.substr(i).trimLeft();
    }
    result.push(s);
    return result;
}
616393
def split_list_by_n(l, n):
    
    n = max(1, n)
    return list(l[i:i+n] for i in range(0, len(l), n))
221921
def chunks(l,n):
    ''''''
    #http://stackoverflow.com/a/3226719
    #...not that this is hard to understand.
    return [l[x:x+n] for x in range(0, len(l), n)];
717261
def _chunks(l, n):
    
    for i in xrange(0, len(l), n):
        yield l[i:i+n]
500369
def all_combinations(items):
    """"""
    return (set(compress(items,mask)) for mask in product(*[[0,1]]*len(items)))
949301
def get_n_r(self):
        """"""
        return math.floor(self.n / self.eta**self.i + _epsilon), math.floor(self.r * self.eta**self.i + _epsilon)
1326228
function (m, n) {
      n %= 64
      if (n === 32) {
        return [m[1], m[0]]
      } else if (n < 32) {
        return [(m[0] << n) | (m[1] >>> (32 - n)), (m[1] << n) | (m[0] >>> (32 - n))]
      } else {
        n -= 32
        return [(m[1] << n) | (m[0] >>> (32 - n)), (m[0] << n) | (m[1] >>> (32 - n))]
      }
    }
177208
def split_subsets(self, train_size:float, valid_size:float, seed=None) -> 'ItemLists':
        ""
        assert 0 < train_size < 1
        assert 0 < valid_size < 1
        assert train_size + valid_size <= 1.
        if seed is not None: np.random.seed(seed)
        n = len(self.items)
        rand_idx = np.random.permutation(range(n))
        train_cut, valid_cut = int(train_size * n), int(valid_size * n)
        return self.split_by_idxs(rand_idx[:train_cut], rand_idx[-valid_cut:])
286141
def itemsize_bits(self):
        """"""
        if self.dtype is not None:
            return self.dtype.itemsize * 8
        else:
            return sum(x[1] for x in self.format)
567975
def chunks(l, n):
    """"""
    if n:
        for i in xrange(0, len(l), n):
            yield l[i:i + n]