def _slice(self, slc): idx1, idx2 = get_slice_idx(slc, self.count) global qmode qmode = self._qmode assert len(self.files) > 0 return FileSelector(self._ctx, self.files[idx1:idx2], self._qmode, True)
def _slice(self, slc): idx1, idx2 = get_slice_idx(slc, self.count) if isinstance(idx1, int) or isinstance(idx2, int): assert isinstance(idx1, int) and isinstance(idx2, int) return getattr(self._files, self._fnames)[idx1:idx2] else: return getattr(self._files.__getslice__(idx1, idx2), self._fname)
def _slice(self, slc): idx1, idx2 = get_slice_idx(slc, self.count) tmp_file, _ = unique_tmp_path(TMP_PREFIX) with open(tmp_file, 'w') as out: cmd = ['sed', '-n', '%d,%dp' % (idx1 + 1, idx2), self.abspath] check_call(cmd, stdout=out) # TODO: check with simple test file linfos = self._linfos[slice(idx1, idx2)] return TempFile(self._ctx, tmp_file, linfos, True)
def _slice(self, slc): idx1, idx2 = get_slice_idx(slc, self.count) impls = [] for impl in self.impls: if impl.count <= idx1: idx1 -= impl.count idx2 -= impl.count continue if impl.count <= idx2: impls.append(impl[idx1:]) idx1 = 0 idx2 -= impl.count - idx1 else: impls.append(impl[idx1:idx2]) break return LineInfo(impls)
def _slice(self, slc): idx1, idx2 = get_slice_idx(slc, self.count) cnt = idx2 - idx1 return LineInfoImpl_Count(self.node, self.kind, self.date, self._file, cnt)