MCPcopy Create free account
hub / github.com/PyTables/PyTables / _check_sortby_csi

Method _check_sortby_csi

tables/table.py:1756–1780  ·  view source on GitHub ↗
(
        self, sortby: Column | str, check_csi: bool
    )

Source from the content-addressed store, hash-verified

1754 return row._iter(start, stop, step, coords=sequence)
1755
1756 def _check_sortby_csi(
1757 self, sortby: Column | str, check_csi: bool
1758 ) -> Index:
1759 if isinstance(sortby, Column):
1760 icol = sortby
1761 elif isinstance(sortby, str):
1762 icol = self.cols._f_col(sortby)
1763 else:
1764 raise TypeError(
1765 f"`sortby` can only be a `Column` or string object, "
1766 f"but you passed an object of type: {type(sortby)}"
1767 )
1768 if icol.is_indexed and icol.index.kind == "full":
1769 if check_csi and not icol.index.is_csi:
1770 # The index exists, but it is not a CSI one.
1771 raise ValueError(
1772 "Field `{sortby}` must have associated a CSI index "
1773 "in table `{self}`, but the existing one is not. "
1774 )
1775 return icol.index
1776 else:
1777 raise ValueError(
1778 f"Field `{sortby}` must have associated a 'full' index "
1779 f"in table `{self}`."
1780 )
1781
1782 def itersorted(
1783 self,

Callers 3

itersortedMethod · 0.95
read_sortedMethod · 0.95
_g_copy_rowsMethod · 0.95

Calls 1

_f_colMethod · 0.80

Tested by

no test coverage detected