mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Just return a list from _get_col_subset, remove ColumnView class
Summary: Just return a list from _get_col_subset, remove ColumnView class Test Plan: none Reviewers: dsagal, georgegevoian Reviewed By: dsagal, georgegevoian Subscribers: georgegevoian Differential Revision: https://phab.getgrist.com/D2975
This commit is contained in:
@@ -192,31 +192,6 @@ class RecordSet(object):
|
||||
sort_by=self._sort_by)
|
||||
|
||||
|
||||
class ColumnView(object):
|
||||
"""
|
||||
ColumnView is an iterable that represents one column of a RecordSet. You may iterate through
|
||||
its values and see its size, but it provides no other interface.
|
||||
"""
|
||||
def __init__(self, column_obj, row_ids, relation):
|
||||
self._column = column_obj
|
||||
self._row_ids = row_ids
|
||||
self._source_relation = relation
|
||||
|
||||
def __len__(self):
|
||||
return len(self._row_ids)
|
||||
|
||||
def __iter__(self):
|
||||
for row_id in self._row_ids:
|
||||
yield adjust_record(self._source_relation, self._column.get_cell_value(row_id))
|
||||
|
||||
def __eq__(self, other):
|
||||
return (isinstance(other, ColumnView) and
|
||||
(self._column, self._row_ids) == (other._column, other._row_ids))
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
|
||||
|
||||
def adjust_record(relation, value):
|
||||
"""
|
||||
Helper to adjust a Record's source relation to be the composition with the given relation. This
|
||||
|
||||
Reference in New Issue
Block a user