Fixed take & skip
This commit is contained in:
@@ -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