Added sequence converters

This commit is contained in:
2022-09-14 13:23:23 +02:00
parent e868a120f0
commit f0ed0bd2e1
9 changed files with 91 additions and 5 deletions

View File

@@ -54,7 +54,7 @@ class Iterable(IterableABC):
if _value is None:
raise ArgumentNoneException(ExceptionArgument.value)
return _value in self
return self.where(lambda x: x == _value).count() > 0
def count(self, _func: Callable = None) -> int:
if self is None:

View File

@@ -57,3 +57,13 @@ class IterableABC(SequenceABC, QueryableABC):
self.append(value)
return self
def to_enumerable(self) -> 'EnumerableABC':
r"""Converts :class: `cpl_query.iterable.iterable_abc.IterableABC` to :class: `cpl_query.enumerable.enumerable_abc.EnumerableABC`
Returns
-------
:class: `cpl_query.enumerable.enumerable_abc.EnumerableABC`
"""
from cpl_query.enumerable.enumerable import Enumerable
return Enumerable(self._type, self.to_list())