Fixed take & skip
This commit is contained in:
@@ -15,7 +15,7 @@ __title__ = 'cpl_query.enumerable'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2021 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10.0'
|
||||
__version__ = '2022.10.0.post2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@@ -27,4 +27,4 @@ from .ordered_enumerable import OrderedEnumerable
|
||||
from .ordered_enumerable_abc import OrderedEnumerableABC
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='0')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='0.post2')
|
||||
|
@@ -249,9 +249,6 @@ class Enumerable(EnumerableABC):
|
||||
|
||||
_list = self.to_list()
|
||||
|
||||
if _index >= len(_list):
|
||||
raise IndexOutOfRangeException()
|
||||
|
||||
return Enumerable(self.type, _list[_index:])
|
||||
|
||||
def skip_last(self, _index: int) -> EnumerableABC:
|
||||
@@ -263,9 +260,6 @@ class Enumerable(EnumerableABC):
|
||||
|
||||
index = len(self) - _index
|
||||
|
||||
if index >= len(self) or index < 0:
|
||||
raise IndexOutOfRangeException()
|
||||
|
||||
return self.take(len(self) - _index)
|
||||
|
||||
def take(self, _index: int) -> EnumerableABC:
|
||||
@@ -277,9 +271,6 @@ class Enumerable(EnumerableABC):
|
||||
|
||||
_list = self.to_list()
|
||||
|
||||
if _index >= len(_list):
|
||||
raise IndexOutOfRangeException()
|
||||
|
||||
return Enumerable(self.type, _list[:_index])
|
||||
|
||||
def take_last(self, _index: int) -> EnumerableABC:
|
||||
@@ -292,9 +283,6 @@ class Enumerable(EnumerableABC):
|
||||
_list = self.to_list()
|
||||
index = len(_list) - _index
|
||||
|
||||
if index >= len(_list) or index < 0:
|
||||
raise IndexOutOfRangeException()
|
||||
|
||||
return self.skip(index)
|
||||
|
||||
def sum(self, _func: Callable = None) -> Union[int, float, complex]:
|
||||
|
Reference in New Issue
Block a user