graviti.paging.lists
#
Paging list related class.
Module Contents#
Classes#
PagingListBase is the base class of the paging list related classes. |
|
PagingList is a list composed of multiple lists (pages). |
|
PyArrowPagingList is a list composed of multiple pyarrow arrays (pages). |
- class graviti.paging.lists.PagingListBase(iterable)[source]#
PagingListBase is the base class of the paging list related classes.
- Parameters
array – The input sequence.
iterable (Iterable[Any]) –
- set_item(self, index, value)[source]#
Update the element value in PagingList at the given index.
- Parameters
index (int) – The element index.
value (Any) – The value needs to be set into the PagingList.
- Return type
None
- set_slice(self, index, values)[source]#
Update the element values at the given slice with input PagingList.
- Parameters
index (slice) – The element slice.
values (_PLB) – The PagingList which contains the elements to be set.
self (_PLB) –
- Raises
ValueError – When the input size mismatches with the slice size (when step != 1).
- Return type
None
- set_slice_iterable(self, index, values)[source]#
Update the element values in PagingList at the given slice with iterable object.
- Parameters
index (slice) – The element slice.
values (Iterable[Any]) – The iterable object which contains the elements to be set.
- Raises
ValueError – When the assign input size mismatches with the slice size (when step != 1).
- Return type
None
- extend(self, values)[source]#
Extend PagingList by appending elements from another PagingList.
- Parameters
values (_PLB) – The PagingList which contains the elements to be extended.
self (_PLB) –
- Return type
None
- extend_iterable(self, values)[source]#
Extend PagingList by appending elements from the iterable.
- Parameters
values (Iterable[Any]) – Elements to be extended into the PagingList.
- Return type
None
- class graviti.paging.lists.PagingList(iterable)[source]#
Bases:
PagingListBase
PagingList is a list composed of multiple lists (pages).
- Parameters
iterable (Iterable[Any]) –
- classmethod from_factory(cls, factory, keys, mapper)[source]#
Create PagingList from LazyFactory.
- Parameters
factory (graviti.paging.factory.LazyFactory) – The parent
LazyFactory
instance.keys (Tuple[str, Ellipsis]) – The keys to access the array from factory.
mapper (Callable[[Any], Any]) – A callable object to convert every item in the pyarrow array.
cls (Type[_PL]) –
- Returns
The PagingList instance created from given factory.
- Return type
_PL
- class graviti.paging.lists.PyArrowPagingList(iterable)[source]#
Bases:
PagingListBase
PyArrowPagingList is a list composed of multiple pyarrow arrays (pages).
- Parameters
array – The input pyarrow array.
iterable (Iterable[Any]) –
- classmethod from_pyarrow(cls, array)[source]#
Create PyArrowPagingList from pyarrow array.
- Parameters
array (pyarrow.Array) – The input pyarrow array.
cls (Type[_PPL]) –
- Returns
The PyArrowPagingList instance created from given pyarrow array.
- Return type
_PPL
- classmethod from_factory(cls, factory, keys, patype)[source]#
Create PyArrowPagingList from LazyFactory.
- Parameters
factory (graviti.paging.factory.LazyFactory) – The parent
LazyFactory
instance.keys (Tuple[str, Ellipsis]) – The keys to access the array from factory.
patype (pyarrow.DataType) – The pyarrow DataType of the elements in the list.
cls (Type[_PPL]) –
- Returns
The PyArrowPagingList instance created from given factory.
- Return type
_PPL
- set_slice(self, index, values)[source]#
Update the element values at the given slice with input PyArrowPagingList.
- Parameters
index (slice) – The element slice.
values (_PPL) – The PyArrowPagingList which contains the elements to be set.
self (_PPL) –
- Raises
ArrowTypeError – When two pyarrow types mismatch.
- Return type
None
- extend(self, values)[source]#
Extend PyArrowPagingList by appending elements from another PyArrowPagingList.
- Parameters
values (_PPL) – The PyArrowPagingList which contains the elements to be extended.
self (_PPL) –
- Raises
ArrowTypeError – When two pyarrow types mismatch.
- Return type
None
- extend_nulls(self, size)[source]#
Extend PyArrowPagingList by appending nulls.
- Parameters
size (int) – The size of the nulls to be extended.
- Return type
None