# Path: casacore/tables/tablehelper.py
# def _check_key_slice(key, nrows, name):
#     if not isinstance(key, slice):
#         inx = _check_index(key, name)
#         # A single index (possibly negative, thus from the end).
#         if inx < 0:
#             inx += nrows
#         if inx < 0 or inx >= nrows:
#             raise IndexError(name + " index out of range")
#         return [inx]
#     # Given as start:stop:step where each part is optional and can
#     # be negative.
#     incr = 1
#     if key.step is not None:
#         incr = _check_index(key.step, name)
#         if incr == 0:
#             raise RuntimeError(name + " slice step cannot be zero")
#     strow = 0
#     endrow = nrows
#     if incr < 0:
#         strow = nrows - 1
#         endrow = -1
#     if key.start is not None:
#         strow = _check_index(key.start, name)
#         if strow < 0:
#             strow += nrows
#         strow = min(max(strow, 0), nrows - 1)
#     if key.stop is not None:
#         endrow = _check_index(key.stop, name)
#         if endrow < 0:
#             endrow += nrows
#         endrow = min(max(endrow, -1), nrows)
#     if incr > 0:
#         nrow = int((endrow - strow + incr - 1) / incr)
#     else:
#         nrow = int((strow - endrow - incr - 1) / -incr)
#     nrow = max(0, nrow)
#     return [strow, nrow, incr]


from ._tables import TableRow
from .tablehelper import _check_key_slice
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
# License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with this library; if not, write to the Free Software Foundation,
# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
#
# Correspondence concerning AIPS++ should be addressed as follows:
#        Internet email: aips2-request@nrao.edu.
#        Postal address: AIPS++ Project Office
#                        National Radio Astronomy Observatory
#                        520 Edgemont Road
#                        Charlottesville, VA 22903-2475 USA
#
# $Id: tablerow.py,v 1.6 2007/08/28 07:22:18 gvandiep Exp $

# Make interface to class TableRowProxy available.



# A normal tablerow object keeps a reference to a table object to be able
# to know the actual number of rows.
# However, a mutual dependency is created when doing that for the tablerow
# object inside the table object.
# Therefore an intermediate _tablerow exists to be used in class table.

class _tablerow(TableRow):
    def __init__(self, table, columnnames, exclude=False):
        TableRow.__init__(self, table, columnnames, exclude)


# Path: casacore/tables/tablehelper.py
# def _check_key_slice(key, nrows, name):
#     if not isinstance(key, slice):
#         inx = _check_index(key, name)
#         # A single index (possibly negative, thus from the end).
#         if inx < 0:
#             inx += nrows
#         if inx < 0 or inx >= nrows:
#             raise IndexError(name + " index out of range")
#         return [inx]
#     # Given as start:stop:step where each part is optional and can
#     # be negative.
#     incr = 1
#     if key.step is not None:
#         incr = _check_index(key.step, name)
#         if incr == 0:
#             raise RuntimeError(name + " slice step cannot be zero")
#     strow = 0
#     endrow = nrows
#     if incr < 0:
#         strow = nrows - 1
#         endrow = -1
#     if key.start is not None:
#         strow = _check_index(key.start, name)
#         if strow < 0:
#             strow += nrows
#         strow = min(max(strow, 0), nrows - 1)
#     if key.stop is not None:
#         endrow = _check_index(key.stop, name)
#         if endrow < 0:
#             endrow += nrows
#         endrow = min(max(endrow, -1), nrows)
#     if incr > 0:
#         nrow = int((endrow - strow + incr - 1) / incr)
#     else:
#         nrow = int((strow - endrow - incr - 1) / -incr)
#     nrow = max(0, nrow)
#     return [strow, nrow, incr]


# Path: casacore/tables/tablerow.py
from ._tables import TableRow
from .tablehelper import _check_key_slice

# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
# License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with this library; if not, write to the Free Software Foundation,
# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
#
# Correspondence concerning AIPS++ should be addressed as follows:
#        Internet email: aips2-request@nrao.edu.
#        Postal address: AIPS++ Project Office
#                        National Radio Astronomy Observatory
#                        520 Edgemont Road
#                        Charlottesville, VA 22903-2475 USA
#
# $Id: tablerow.py,v 1.6 2007/08/28 07:22:18 gvandiep Exp $

# Make interface to class TableRowProxy available.



# A normal tablerow object keeps a reference to a table object to be able
# to know the actual number of rows.
# However, a mutual dependency is created when doing that for the tablerow
# object inside the table object.
# Therefore an intermediate _tablerow exists to be used in class table.

class _tablerow(TableRow):
    def __init__(self, table, columnnames, exclude=False):
        TableRow.__init__(self, table, columnnames, exclude)


    def iswritable(self):