def _getbasic(self, index):
key_slices = index[<NUM_LIT:0>:self.split]<EOL>value_slices = index[self.split:]<EOL>def key_check(key):<EOL><INDENT>def inrange(k, s):<EOL><INDENT>if s.step > <NUM_LIT:0>:<EOL><INDENT>return s.start <= k < s.stop<EOL><DEDENT>else:<EOL><INDENT>return s.stop < k <= s.start<EOL><DEDENT><DEDENT>def check(k, s):<EOL><INDENT>return inrange(k, s) and mod(k - s.start, s.step) == <NUM_LIT:0><EOL><DEDENT>out = [check(k, s) for k, s in zip(key, key_slices)]<EOL>return all(out)<EOL><DEDENT>def key_func(key):<EOL><INDENT>return tuple([(k - s.start)/s.step for k, s in zip(key, key_slices)])<EOL><DEDENT>filtered = self._rdd.filter(lambda kv: key_check(kv[<NUM_LIT:0>]))<EOL>if self._split == self.ndim:<EOL><INDENT>rdd = filtered.map(lambda kv: (key_func(kv[<NUM_LIT:0>]), kv[<NUM_LIT:1>]))<EOL><DEDENT>else:<EOL><INDENT>value_slices = [s if s.stop != -<NUM_LIT:1> else slice(s.start, None, s.step) for s in value_slices]<EOL>rdd = filtered.map(lambda kv: (key_func(kv[<NUM_LIT:0>]), kv[<NUM_LIT:1>][value_slices]))<EOL><DEDENT>shape = tuple([int(ceil((s.stop - s.start) / float(s.step))) for s in index])<EOL>split = self.split<EOL>return rdd, shape, split<EOL>
Basic indexing (for slices or ints).